Partially revert e1f97e2 to pass new test cases
This commit is contained in:
parent
018aeb05ab
commit
fccfddb510
@ -23,7 +23,18 @@ class CxxStdlib
|
|||||||
# libstdc++ is compatible across Apple compilers, but
|
# libstdc++ is compatible across Apple compilers, but
|
||||||
# not between Apple and GNU compilers, or between GNU compiler versions
|
# not between Apple and GNU compilers, or between GNU compiler versions
|
||||||
def compatible_with?(other)
|
def compatible_with?(other)
|
||||||
type.nil? || other.type.nil? || type == other.type
|
return true if type.nil? || other.type.nil?
|
||||||
|
|
||||||
|
return false unless type == other.type
|
||||||
|
|
||||||
|
if apple_compiler?
|
||||||
|
return false unless other.apple_compiler?
|
||||||
|
else
|
||||||
|
return false if other.apple_compiler?
|
||||||
|
return false unless compiler.to_s[4..6] == other.compiler.to_s[4..6]
|
||||||
|
end
|
||||||
|
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_dependencies(formula, deps)
|
def check_dependencies(formula, deps)
|
||||||
@ -50,21 +61,11 @@ class CxxStdlib
|
|||||||
def apple_compiler?
|
def apple_compiler?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def compatible_with?(other)
|
|
||||||
super && other.apple_compiler?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class GnuStdlib < CxxStdlib
|
class GnuStdlib < CxxStdlib
|
||||||
def apple_compiler?
|
def apple_compiler?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def compatible_with?(other)
|
|
||||||
super &&
|
|
||||||
!other.apple_compiler? &&
|
|
||||||
compiler.to_s[4..6] == other.compiler.to_s[4..6]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -57,5 +57,9 @@ class CxxStdlibTests < Homebrew::TestCase
|
|||||||
|
|
||||||
def test_compatibility_for_non_cxx_software
|
def test_compatibility_for_non_cxx_software
|
||||||
assert @purec.compatible_with?(@clang)
|
assert @purec.compatible_with?(@clang)
|
||||||
|
assert @clang.compatible_with?(@purec)
|
||||||
|
assert @purec.compatible_with?(@purec)
|
||||||
|
assert @purec.compatible_with?(@gcc48)
|
||||||
|
assert @gcc48.compatible_with?(@purec)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user