| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  | require 'testing_env' | 
					
						
							|  |  |  | require 'formula' | 
					
						
							|  |  |  | require 'cxxstdlib' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 20:32:51 -05:00
										 |  |  | class CxxStdlibTests < Homebrew::TestCase | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |   def setup | 
					
						
							| 
									
										
										
										
											2014-08-02 19:29:59 -05:00
										 |  |  |     @clang = CxxStdlib.create(:libstdcxx, :clang) | 
					
						
							|  |  |  |     @gcc   = CxxStdlib.create(:libstdcxx, :gcc) | 
					
						
							|  |  |  |     @llvm  = CxxStdlib.create(:libstdcxx, :llvm) | 
					
						
							|  |  |  |     @gcc4  = CxxStdlib.create(:libstdcxx, :gcc_4_0) | 
					
						
							|  |  |  |     @gcc48 = CxxStdlib.create(:libstdcxx, 'gcc-4.8') | 
					
						
							|  |  |  |     @gcc49 = CxxStdlib.create(:libstdcxx, 'gcc-4.9') | 
					
						
							|  |  |  |     @lcxx  = CxxStdlib.create(:libcxx, :clang) | 
					
						
							|  |  |  |     @purec = CxxStdlib.create(nil, :clang) | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |   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 | 
					
						
							| 
									
										
										
										
											2014-04-19 09:11:52 +01:00
										 |  |  |     assert @gcc.compatible_with?(@gcc) | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |     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 | 
					
						
							| 
									
										
										
										
											2014-04-19 09:11:52 +01:00
										 |  |  |     assert !@gcc48.compatible_with?(@gcc49) | 
					
						
							|  |  |  |     assert !@gcc49.compatible_with?(@gcc48) | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_libstdcxx_libcxx_incompatibility | 
					
						
							|  |  |  |     assert !@clang.compatible_with?(@lcxx) | 
					
						
							|  |  |  |     assert !@lcxx.compatible_with?(@clang) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_apple_compiler_reporting | 
					
						
							| 
									
										
										
										
											2014-06-11 12:21:03 -05:00
										 |  |  |     assert_predicate @clang, :apple_compiler? | 
					
						
							|  |  |  |     assert_predicate @gcc, :apple_compiler? | 
					
						
							|  |  |  |     assert_predicate @llvm, :apple_compiler? | 
					
						
							|  |  |  |     assert_predicate @gcc4, :apple_compiler? | 
					
						
							|  |  |  |     refute_predicate @gcc48, :apple_compiler? | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_type_string_formatting | 
					
						
							| 
									
										
										
										
											2014-06-11 13:05:10 -05:00
										 |  |  |     assert_equal "libstdc++", @clang.type_string | 
					
						
							|  |  |  |     assert_equal "libc++", @lcxx.type_string | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-06 16:59:39 -07:00
										 |  |  |   def test_compatibility_for_non_cxx_software | 
					
						
							|  |  |  |     assert @purec.compatible_with?(@clang) | 
					
						
							| 
									
										
										
										
											2014-08-02 20:03:42 -05:00
										 |  |  |     assert @clang.compatible_with?(@purec) | 
					
						
							|  |  |  |     assert @purec.compatible_with?(@purec) | 
					
						
							|  |  |  |     assert @purec.compatible_with?(@gcc48) | 
					
						
							|  |  |  |     assert @gcc48.compatible_with?(@purec) | 
					
						
							| 
									
										
										
										
											2013-10-06 16:59:39 -07:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-07-27 00:11:45 -07:00
										 |  |  | end |