aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_build_options.rb15
-rw-r--r--Library/Homebrew/test/test_formula_installer.rb1
-rw-r--r--Library/Homebrew/test/test_install.rb6
3 files changed, 22 insertions, 0 deletions
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