Fix breakage in option recognition

Fixes Homebrew/homebrew#22347.
This commit is contained in:
Jack Nagel 2013-09-05 18:50:42 -05:00
parent 896173a999
commit a871baadf5
2 changed files with 7 additions and 3 deletions

View File

@ -107,7 +107,7 @@ class BuildOptions
end end
def has_opposite_of? option def has_opposite_of? option
true if args.include? opposite_of option @options.include? opposite_of(option)
end end
def opposite_of option def opposite_of option

View File

@ -1,9 +1,9 @@
require 'testing_env' require 'testing_env'
require 'build_options' require 'build_options'
class BuildOptionsTests < Test::Unit::TestCase class BuildOptionsTests < Test::Unit::TestCase
def setup def setup
args = %w{--with-foo --with-bar --without-qux} # args fake the command line args = %w{--with-foo --with-bar --without-qux}
@build = BuildOptions.new(args) @build = BuildOptions.new(args)
@build.add("with-foo") @build.add("with-foo")
@build.add("with-bar") @build.add("with-bar")
@ -67,4 +67,8 @@ class BuildOptionsTests < Test::Unit::TestCase
assert !@build.has_opposite_of?("--without-qux") assert !@build.has_opposite_of?("--without-qux")
assert !@build.has_opposite_of?("--without-nonexisting") assert !@build.has_opposite_of?("--without-nonexisting")
end end
def test_actually_recognizes_implicit_options
assert @build.has_opposite_of?("--with-baz")
end
end end