From 62e14ea6733c9302889bc89820c7f88fbb593964 Mon Sep 17 00:00:00 2001 From: Bruce Steedman Date: Mon, 3 Oct 2016 09:42:53 +0100 Subject: invalid build options - fixed conflicts; rename --- Library/Homebrew/test/test_build_options.rb | 15 +++++++++++++++ Library/Homebrew/test/test_formula_installer.rb | 1 + Library/Homebrew/test/test_install.rb | 6 ++++++ 3 files changed, 22 insertions(+) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/test_build_options.rb b/Library/Homebrew/test/test_build_options.rb index dab418792..02f4be0fa 100644 --- a/Library/Homebrew/test/test_build_options.rb +++ b/Library/Homebrew/test/test_build_options.rb @@ -7,6 +7,8 @@ class BuildOptionsTests < Homebrew::TestCase args = Options.create(%w[--with-foo --with-bar --without-qux]) opts = Options.create(%w[--with-foo --with-bar --without-baz --without-qux]) @build = BuildOptions.new(args, opts) + bad_args = Options.create(%w[--with-foo --with-bar --without-bas --without-qux --without-abc]) + @bad_build = BuildOptions.new(bad_args, opts) end def test_include @@ -31,4 +33,17 @@ class BuildOptionsTests < Homebrew::TestCase def test_unused_options assert_includes @build.unused_options, "--without-baz" end + + def test_invalid_options + assert_empty @build.invalid_options + assert_includes @bad_build.invalid_options, "--without-bas" + assert_includes @bad_build.invalid_options, "--without-abc" + refute_includes @bad_build.invalid_options, "--with-foo" + refute_includes @bad_build.invalid_options, "--with-baz" + end + + def test_invalid_opt_names + assert_empty @build.invalid_opt_names + assert_equal @bad_build.invalid_opt_names, %w[--without-abc --without-bas] + end end diff --git a/Library/Homebrew/test/test_formula_installer.rb b/Library/Homebrew/test/test_formula_installer.rb index 5b937d1df..18bd910a6 100644 --- a/Library/Homebrew/test/test_formula_installer.rb +++ b/Library/Homebrew/test/test_formula_installer.rb @@ -37,6 +37,7 @@ class InstallTests < Homebrew::TestCase end def test_a_basic_install + ARGV << "--with-invalid_flag" # added to ensure it doesn't fail install temporary_install(Testball.new) do |f| # Test that things made it into the Keg assert_predicate f.prefix+"readme", :exist? diff --git a/Library/Homebrew/test/test_install.rb b/Library/Homebrew/test/test_install.rb index 5d27d978b..e0a40b5d7 100644 --- a/Library/Homebrew/test/test_install.rb +++ b/Library/Homebrew/test/test_install.rb @@ -21,4 +21,10 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase assert_match "testball1 already installed, it's just not migrated", cmd("install", "testball2") end + + def test_install_with_invalid_option + setup_test_formula "testball1" + assert_match "testball1: --with-fo is invalid for this formula and will be ignored!", + cmd("install", "testball1", "--with-fo") + end end -- cgit v1.2.3 From bbea4ac87123c8565d350d11bfae79de105c493c Mon Sep 17 00:00:00 2001 From: Bruce Steedman Date: Mon, 3 Oct 2016 09:53:20 +0100 Subject: fix bad method name in test --- Library/Homebrew/test/test_build_options.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/test_build_options.rb b/Library/Homebrew/test/test_build_options.rb index 02f4be0fa..e460d25cc 100644 --- a/Library/Homebrew/test/test_build_options.rb +++ b/Library/Homebrew/test/test_build_options.rb @@ -42,8 +42,8 @@ class BuildOptionsTests < Homebrew::TestCase refute_includes @bad_build.invalid_options, "--with-baz" end - def test_invalid_opt_names - assert_empty @build.invalid_opt_names - assert_equal @bad_build.invalid_opt_names, %w[--without-abc --without-bas] + def test_invalid_option_names + assert_empty @build.invalid_option_names + assert_equal @bad_build.invalid_option_names, %w[--without-abc --without-bas] end end -- cgit v1.2.3 From 592905d3dabdda338520ea737e97ea273a127ff2 Mon Sep 17 00:00:00 2001 From: Bruce Steedman Date: Sat, 12 Nov 2016 12:13:27 +0000 Subject: fix test --- Library/Homebrew/test/test_install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/test_install.rb b/Library/Homebrew/test/test_install.rb index e0a40b5d7..7135dddb2 100644 --- a/Library/Homebrew/test/test_install.rb +++ b/Library/Homebrew/test/test_install.rb @@ -24,7 +24,7 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase def test_install_with_invalid_option setup_test_formula "testball1" - assert_match "testball1: --with-fo is invalid for this formula and will be ignored!", + assert_match "testball1: this formula has no --with-fo option so it will be ignored!", cmd("install", "testball1", "--with-fo") end end -- cgit v1.2.3