add test for bottle disable
Closes Homebrew/homebrew#43935. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
f41925b360
commit
4ef15427ba
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user