| 
									
										
										
										
											2014-08-13 11:09:57 -05:00
										 |  |  | require "testing_env" | 
					
						
							|  |  |  | require "build_options" | 
					
						
							|  |  |  | require "options" | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 20:32:51 -05:00
										 |  |  | class BuildOptionsTests < Homebrew::TestCase | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   def setup | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     args = Options.create(%w[--with-foo --with-bar --without-qux]) | 
					
						
							|  |  |  |     opts = Options.create(%w[--with-foo --with-bar --without-baz --without-qux]) | 
					
						
							| 
									
										
										
										
											2014-07-31 19:37:39 -05:00
										 |  |  |     @build = BuildOptions.new(args, opts) | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_include | 
					
						
							| 
									
										
										
										
											2014-06-11 13:03:06 -05:00
										 |  |  |     assert_includes @build, "with-foo" | 
					
						
							|  |  |  |     refute_includes @build, "with-qux" | 
					
						
							|  |  |  |     refute_includes @build, "--with-foo" | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:26 -06:00
										 |  |  |   def test_with_without | 
					
						
							|  |  |  |     assert @build.with?("foo") | 
					
						
							|  |  |  |     assert @build.with?("bar") | 
					
						
							|  |  |  |     assert @build.with?("baz") | 
					
						
							|  |  |  |     assert @build.without?("qux") | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   def test_used_options | 
					
						
							| 
									
										
										
										
											2014-06-11 13:03:06 -05:00
										 |  |  |     assert_includes @build.used_options, "--with-foo" | 
					
						
							|  |  |  |     assert_includes @build.used_options, "--with-bar" | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_unused_options | 
					
						
							| 
									
										
										
										
											2014-06-11 13:03:06 -05:00
										 |  |  |     assert_includes @build.unused_options, "--without-baz" | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:24 -06:00
										 |  |  |   end | 
					
						
							|  |  |  | end |