aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authormsbit2016-06-16 22:15:28 +1000
committerMartin Afanasjew2016-06-16 14:15:28 +0200
commit01e8e180a89a761ba6ce9bacf0a54a478b9dcf65 (patch)
tree28022105a2a1d455dbb90b82d9288da366a2a92d /Library/Homebrew/test
parent62dd4b14ba98519e72d804f904a7017c9b88d0d7 (diff)
downloadbrew-01e8e180a89a761ba6ce9bacf0a54a478b9dcf65.tar.bz2
ENV: mark gcc-6 as supporting C++11 (#349)
Add SharedEnvExtension#gcc_with_cxx11_support? to centralise the logic for checking whether a compiler is known to support C++11. Update logic to accept GCC 4.8 and above (including 6). Thereby also address oversight in #163 where support for GCC 6 was added without updating the C++11 compiler whitelist. Add tests for Superenv#cxx11. Closes #346.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_ENV.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_ENV.rb b/Library/Homebrew/test/test_ENV.rb
index 74d1cff79..665e344e6 100644
--- a/Library/Homebrew/test/test_ENV.rb
+++ b/Library/Homebrew/test/test_ENV.rb
@@ -141,4 +141,33 @@ class SuperenvTests < Homebrew::TestCase
assert_equal [], @env.deps
assert_equal [], @env.keg_only_deps
end
+
+ def test_unsupported_cxx11
+ %w[gcc gcc-4.7].each do |compiler|
+ @env["HOMEBREW_CC"] = compiler
+ assert_raises do
+ @env.cxx11
+ end
+ refute_match "x", @env["HOMEBREW_CCCFG"]
+ end
+ end
+
+ def test_supported_cxx11_gcc_5
+ @env["HOMEBREW_CC"] = "gcc-5"
+ @env.cxx11
+ assert_match "x", @env["HOMEBREW_CCCFG"]
+ end
+
+ def test_supported_cxx11_gcc_6
+ @env["HOMEBREW_CC"] = "gcc-6"
+ @env.cxx11
+ assert_match "x", @env["HOMEBREW_CCCFG"]
+ end
+
+ def test_supported_cxx11_clang
+ @env["HOMEBREW_CC"] = "clang"
+ @env.cxx11
+ assert_match "x", @env["HOMEBREW_CCCFG"]
+ assert_match "g", @env["HOMEBREW_CCCFG"]
+ end
end