diff options
| author | Misty De Meo | 2013-07-27 00:11:45 -0700 |
|---|---|---|
| committer | Misty De Meo | 2013-09-01 13:19:13 -0700 |
| commit | b71682bdc79e49e43bfc4f9652f613a2ed398ed2 (patch) | |
| tree | 86a7bc3c082f081f7f67037f21368fd5bb774de8 /Library/Homebrew/test | |
| parent | 3ac74331a86d031179c3e25fe46bcb9f292dacc1 (diff) | |
| download | brew-b71682bdc79e49e43bfc4f9652f613a2ed398ed2.tar.bz2 | |
Tab: track C++ stdlib in use
There are subtle incompatibilities between Apple's libstdc++ and the
libstdc++ used by the various GNU GCC formulae. In addition, we'll
likely also be supporting libc++ in the future, and that's also
incompatible with the other stdlibs.
Tracking it in the tab lets us make sure that dependencies are all
built against the same stdlib to avoid subtle breakage.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_stdlib.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_stdlib.rb b/Library/Homebrew/test/test_stdlib.rb new file mode 100644 index 000000000..a5e276746 --- /dev/null +++ b/Library/Homebrew/test/test_stdlib.rb @@ -0,0 +1,62 @@ +require 'testing_env' +require 'test/testball' +require 'formula' +require 'cxxstdlib' +require 'tab' + +class CxxStdlibTests < Test::Unit::TestCase + def setup + @clang = CxxStdlib.new(:libstdcxx, :clang) + @gcc = CxxStdlib.new(:libstdcxx, :gcc) + @llvm = CxxStdlib.new(:libstdcxx, :llvm) + @gcc4 = CxxStdlib.new(:libstdcxx, :gcc_4_0) + @gcc48 = CxxStdlib.new(:libstdcxx, 'gcc-4.8') + @gcc49 = CxxStdlib.new(:libstdcxx, 'gcc-4.9') + @lcxx = CxxStdlib.new(:libcxx, :clang) + end + + def test_apple_libstdcxx_intercompatibility + assert @clang.compatible_with?(@gcc) + assert @clang.compatible_with?(@llvm) + assert @clang.compatible_with?(@gcc4) + end + + def test_compatibility_same_compilers_and_type + assert @gcc48.compatible_with?(@gcc48) + assert @clang.compatible_with?(@clang) + end + + def test_apple_gnu_libstdcxx_incompatibility + assert !@clang.compatible_with?(@gcc48) + assert !@gcc48.compatible_with?(@clang) + end + + def test_gnu_cross_version_incompatibility + assert !@clang.compatible_with?(@gcc48) + assert !@gcc48.compatible_with?(@clang) + end + + def test_libstdcxx_libcxx_incompatibility + assert !@clang.compatible_with?(@lcxx) + assert !@lcxx.compatible_with?(@clang) + end + + def test_apple_compiler_reporting + assert @clang.apple_compiler? + assert @gcc.apple_compiler? + assert @llvm.apple_compiler? + assert @gcc4.apple_compiler? + assert !@gcc48.apple_compiler? + end + + def test_type_string_formatting + assert_equal @clang.type_string, 'libstdc++' + assert_equal @lcxx.type_string, 'libc++' + end + + def test_constructing_from_tab + stdlib = Tab.dummy_tab.cxxstdlib + assert_equal stdlib.compiler, :clang + assert_equal stdlib.type, :libstdcxx + end +end |
