aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-10-19 20:06:15 +0800
committerXu Cheng2015-10-19 21:41:36 +0800
commit4ef15427bacc84622561bde6b8474a1df996eb52 (patch)
treeb8c0cf473ac8087f27a3e6064753e2361b9fbebb
parentf41925b360012b619ba7af48386cc95cb7d5623a (diff)
downloadbrew-4ef15427bacc84622561bde6b8474a1df996eb52.tar.bz2
add test for bottle disable
Closes Homebrew/homebrew#43935. Signed-off-by: Xu Cheng <xucheng@me.com>
-rw-r--r--Library/Homebrew/test/test_bottle_hooks.rb1
-rw-r--r--Library/Homebrew/test/test_formula_installer.rb16
-rw-r--r--Library/Homebrew/test/test_formula_support.rb14
3 files changed, 31 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_bottle_hooks.rb b/Library/Homebrew/test/test_bottle_hooks.rb
index ff9d95c9c..1f889da17 100644
--- a/Library/Homebrew/test/test_bottle_hooks.rb
+++ b/Library/Homebrew/test/test_bottle_hooks.rb
@@ -6,6 +6,7 @@ class BottleHookTests < Homebrew::TestCase
class FormulaDouble
def bottle; end
def local_bottle_path; end
+ def bottle_disabled?; false end
def some_random_method
true
diff --git a/Library/Homebrew/test/test_formula_installer.rb b/Library/Homebrew/test/test_formula_installer.rb
index 1bf3e43ba..5c545692d 100644
--- a/Library/Homebrew/test/test_formula_installer.rb
+++ b/Library/Homebrew/test/test_formula_installer.rb
@@ -51,4 +51,20 @@ class InstallTests < Homebrew::TestCase
assert_equal 3, bin.children.length
end
end
+
+ def test_bottle_unneeded_formula_install
+ MacOS.stubs(:has_apple_developer_tools?).returns(false)
+
+ formula = Testball.new
+ formula.stubs(:bottle_unneeded?).returns(true)
+ formula.stubs(:bottle_disabled?).returns(true)
+
+ refute_predicate formula, :bottled?
+ assert_predicate formula, :bottle_unneeded?
+ assert_predicate formula, :bottle_disabled?
+
+ temporary_install(formula) do |f|
+ assert_predicate f, :installed?
+ end
+ end
end
diff --git a/Library/Homebrew/test/test_formula_support.rb b/Library/Homebrew/test/test_formula_support.rb
index 08d10292f..25514a032 100644
--- a/Library/Homebrew/test/test_formula_support.rb
+++ b/Library/Homebrew/test/test_formula_support.rb
@@ -11,3 +11,17 @@ class KegOnlyReasonTests < Homebrew::TestCase
assert_match(/^OS X already provides/, r.to_s)
end
end
+
+class BottleDisableReasonTests < Homebrew::TestCase
+ def test_bottle_unneeded
+ bottle_disable_reason = BottleDisableReason.new :unneeded, nil
+ assert_predicate bottle_disable_reason, :unneeded?
+ assert_equal "This formula doesn't require compiling.", bottle_disable_reason.to_s
+ end
+
+ def test_bottle_disabled
+ bottle_disable_reason = BottleDisableReason.new :disable, "reason"
+ refute_predicate bottle_disable_reason, :unneeded?
+ assert_equal "reason", bottle_disable_reason.to_s
+ end
+end