diff options
| author | Jack Nagel | 2012-06-20 00:34:05 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-07-04 22:47:34 -0500 |
| commit | 40b531deb10f5c477a85dbf5bbe8f07c164741cb (patch) | |
| tree | 230800a1c4bf6a596625eaf12fa0f7b4fbcbf4e2 | |
| parent | 90dbb8a1413c2a5e1cee0dd1ab05029d657d04af (diff) | |
| download | brew-40b531deb10f5c477a85dbf5bbe8f07c164741cb.tar.bz2 | |
Demonstrate that bottles are selected correctly
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
| -rw-r--r-- | Library/Homebrew/test/test_bottles.rb | 34 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/test/testball.rb | 62 |
3 files changed, 108 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_bottles.rb b/Library/Homebrew/test/test_bottles.rb new file mode 100644 index 000000000..f44302071 --- /dev/null +++ b/Library/Homebrew/test/test_bottles.rb @@ -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 diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index 83b77fd4d..6b68bfbc8 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -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 diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb index b61eef178..75ddf9444 100644 --- a/Library/Homebrew/test/testball.rb +++ b/Library/Homebrew/test/testball.rb @@ -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 |
