aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-06-20 00:34:05 -0500
committerJack Nagel2012-07-04 22:47:34 -0500
commit3e2c41c7d970bfd33a9920b5c78e2eaf773c1072 (patch)
tree48a80d581d653bc513c84df0829e9866def9ea13 /Library
parentf3dc89c1edc74e7a30bca72bdd955813aac23f32 (diff)
downloadhomebrew-3e2c41c7d970bfd33a9920b5c78e2eaf773c1072.tar.bz2
Demonstrate that bottles are selected correctly
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_bottles.rb34
-rw-r--r--Library/Homebrew/test/test_formula.rb12
-rw-r--r--Library/Homebrew/test/testball.rb62
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