From 22a37b2f5d3a57ec5732b0dcc8bb0474b4a47700 Mon Sep 17 00:00:00 2001 From: Thomas Maurer Date: Sat, 4 Feb 2017 13:20:00 +0100 Subject: Add failing reinstall test with invalid install option --- Library/Homebrew/test/reinstall_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/test/reinstall_test.rb b/Library/Homebrew/test/reinstall_test.rb index 613c06188..2906983c3 100644 --- a/Library/Homebrew/test/reinstall_test.rb +++ b/Library/Homebrew/test/reinstall_test.rb @@ -12,4 +12,13 @@ class IntegrationCommandTestReinstall < IntegrationCommandTestCase cmd("reinstall", "testball") assert foo_dir.exist? end + + def test_reinstall_with_invalid_option + setup_test_formula "testball" + + cmd("install", "testball", "--with-foo") + + assert_match "testball: this formula has no --with-fo option so it will be ignored!", + cmd("reinstall", "testball", "--with-fo") + end end -- cgit v1.2.3 From 6594650eb1c37170e7d70e7e9c75b48d154e38a9 Mon Sep 17 00:00:00 2001 From: Thomas Maurer Date: Sat, 4 Feb 2017 18:10:37 +0100 Subject: Pass invalid option names to formula installer This is the same that happens in the command 'install'. By passing the invalid option names, we enable the formula installer to output warnings if necessary. --- Library/Homebrew/cmd/reinstall.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 2eb2840a5..586405909 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -25,19 +25,21 @@ module Homebrew backup keg end - options = BuildOptions.new(Options.create(ARGV.flags_only), f.options).used_options + build_options = BuildOptions.new(Options.create(ARGV.flags_only), f.options) + options = build_options.used_options options |= f.build.used_options options &= f.options fi = FormulaInstaller.new(f) - fi.options = options - fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?) - fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? - fi.force_bottle = ARGV.force_bottle? - fi.interactive = ARGV.interactive? - fi.git = ARGV.git? - fi.verbose = ARGV.verbose? - fi.debug = ARGV.debug? + fi.options = options + fi.invalid_option_names = build_options.invalid_option_names + fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?) + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? + fi.force_bottle = ARGV.force_bottle? + fi.interactive = ARGV.interactive? + fi.git = ARGV.git? + fi.verbose = ARGV.verbose? + fi.debug = ARGV.debug? fi.prelude oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}" -- cgit v1.2.3