From 01e8e180a89a761ba6ce9bacf0a54a478b9dcf65 Mon Sep 17 00:00:00 2001 From: msbit Date: Thu, 16 Jun 2016 22:15:28 +1000 Subject: 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.--- Library/Homebrew/test/test_ENV.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Library/Homebrew/test') 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 -- cgit v1.2.3