Demonstrate that bottles are selected correctly
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
90dbb8a141
commit
40b531deb1
34
Library/Homebrew/test/test_bottles.rb
Normal file
34
Library/Homebrew/test/test_bottles.rb
Normal file
@ -0,0 +1,34 @@
|
||||
require 'testing_env'
|
||||
require 'test/testball'
|
||||
|
||||
# We temporarily redefine bottles_supported? because the
|
||||
# following tests assume it is true, but other tests may
|
||||
# expect the real value.
|
||||
def bottles_are_supported &block
|
||||
alias :old_bottles_supported? :bottles_supported?
|
||||
def bottles_supported?; true end
|
||||
instance_eval(&block)
|
||||
def bottles_supported?; old_bottles_supported? end
|
||||
end
|
||||
|
||||
class BottleTests < Test::Unit::TestCase
|
||||
def test_bottle_spec_selection
|
||||
bottles_are_supported do
|
||||
f = SnowLeopardBottleSpecTestBall.new
|
||||
|
||||
assert_equal case MacOS.cat
|
||||
when :snowleopard then f.bottle
|
||||
else f.stable
|
||||
end, f.active_spec
|
||||
|
||||
f = LionBottleSpecTestBall.new
|
||||
assert_equal case MacOS.cat
|
||||
when :lion then f.bottle
|
||||
else f.stable
|
||||
end, f.active_spec
|
||||
|
||||
f = AllCatsBottleSpecTestBall.new
|
||||
assert_equal f.bottle, f.active_spec
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -105,6 +105,7 @@ class FormulaTests < Test::Unit::TestCase
|
||||
assert_equal case MacOS.cat
|
||||
when :snowleopard then 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
||||
when :lion then 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d'
|
||||
when :mountainlion then '8badf00d8badf00d8badf00d8badf00d8badf00d'
|
||||
end, f.bottle.checksum.hexdigest
|
||||
assert_match /[0-9a-fA-F]{40}/, f.stable.checksum.hexdigest
|
||||
assert_match /[0-9a-fA-F]{64}/, f.devel.checksum.hexdigest
|
||||
@ -295,4 +296,15 @@ class FormulaTests < Test::Unit::TestCase
|
||||
assert_equal({ :tag => '0.3' }, f.devel.specs)
|
||||
assert f.head.specs.empty?
|
||||
end
|
||||
|
||||
def test_revised_bottle_specs
|
||||
f = RevisedBottleSpecTestBall.new
|
||||
|
||||
assert_equal 1, f.bottle.revision
|
||||
assert_equal case MacOS.cat
|
||||
when :snowleopard then 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
||||
when :lion then 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d'
|
||||
when :mountainlion then '8badf00d8badf00d8badf00d8badf00d8badf00d'
|
||||
end, f.bottle.checksum.hexdigest
|
||||
end
|
||||
end
|
||||
|
||||
@ -112,6 +112,7 @@ class SpecTestBall < Formula
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d' => :lion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountainlion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
@ -224,3 +225,64 @@ class ExplicitStrategySpecTestBall < Formula
|
||||
super "explicitstrategyspectestball"
|
||||
end
|
||||
end
|
||||
|
||||
class SnowLeopardBottleSpecTestBall < Formula
|
||||
homepage 'http://example.com'
|
||||
url 'file:///foo.com/testball-0.1.tbz'
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
super "snowleopardbottlespectestball"
|
||||
end
|
||||
end
|
||||
|
||||
class LionBottleSpecTestBall < Formula
|
||||
homepage 'http://example.com'
|
||||
url 'file:///foo.com/testball-0.1.tbz'
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
super "lionbottlespectestball"
|
||||
end
|
||||
end
|
||||
|
||||
class AllCatsBottleSpecTestBall < Formula
|
||||
homepage 'http://example.com'
|
||||
url 'file:///foo.com/testball-0.1.tbz'
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d' => :lion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountainlion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
super "allcatsbottlespectestball"
|
||||
end
|
||||
end
|
||||
|
||||
class RevisedBottleSpecTestBall < Formula
|
||||
homepage 'http://example.com'
|
||||
url 'file:///foo.com/testball-0.1.tbz'
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
bottle do
|
||||
version 1
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d' => :lion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountainlion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
super "revisedbottlespectestball"
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user