diff options
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_build_options.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Library/Homebrew/test/test_build_options.rb b/Library/Homebrew/test/test_build_options.rb index cc5fd01d7..9e2a9e06f 100644 --- a/Library/Homebrew/test/test_build_options.rb +++ b/Library/Homebrew/test/test_build_options.rb @@ -1,9 +1,9 @@ -require 'testing_env' + require 'testing_env' require 'build_options' class BuildOptionsTests < Test::Unit::TestCase def setup - args = %w{--with-foo --with-bar --without-qux} + args = %w{--with-foo --with-bar --without-qux} # args fake the command line @build = BuildOptions.new(args) @build.add("with-foo") @build.add("with-bar") @@ -44,7 +44,7 @@ class BuildOptionsTests < Test::Unit::TestCase end def test_implicit_options - # --without-baz is not explicitly specified on the command line + # --without-baz is not explicitly specified on the command line (i.e. args) # therefore --with-baz should be implicitly assumed: assert @build.implicit_options.include?("--with-baz") # But all these should not be in the implict_options: @@ -53,4 +53,18 @@ class BuildOptionsTests < Test::Unit::TestCase assert !@build.implicit_options.include?("--without-bar") assert !@build.implicit_options.include?("--with-qux") end + + def test_opposite_of + assert @build.opposite_of(Option.new("with-foo")) == Option.new("without-foo") + assert @build.opposite_of("without-foo") == Option.new("with-foo") + assert @build.opposite_of(Option.new("enable-spam")) == Option.new("disable-spam") + assert @build.opposite_of("disable-beer") == Option.new("enable-beer") + end + + def test_has_opposite_of? + assert @build.has_opposite_of?("--without-foo") + assert @build.has_opposite_of?(Option.new("--with-qux")) + assert !@build.has_opposite_of?("--without-qux") + assert !@build.has_opposite_of?("--without-nonexisting") + end end |
