From a871baadf56164a7e7edc6d26d0b836593e03892 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 5 Sep 2013 18:50:42 -0500 Subject: [PATCH] Fix breakage in option recognition Fixes Homebrew/homebrew#22347. --- Library/Homebrew/build_options.rb | 2 +- Library/Homebrew/test/test_build_options.rb | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb index 441a81bc29..6400b36cea 100644 --- a/Library/Homebrew/build_options.rb +++ b/Library/Homebrew/build_options.rb @@ -107,7 +107,7 @@ class BuildOptions end def has_opposite_of? option - true if args.include? opposite_of option + @options.include? opposite_of(option) end def opposite_of option diff --git a/Library/Homebrew/test/test_build_options.rb b/Library/Homebrew/test/test_build_options.rb index 9e2a9e06f0..38eeae22bd 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 fake the command line + args = %w{--with-foo --with-bar --without-qux} @build = BuildOptions.new(args) @build.add("with-foo") @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-nonexisting") end + + def test_actually_recognizes_implicit_options + assert @build.has_opposite_of?("--with-baz") + end end