aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorÉtienne Barrié2009-09-07 15:26:43 +0200
committerÉtienne Barrié2009-09-07 15:26:43 +0200
commitb2e12c4517e36a8efa8d5cceac7b256d9cad7f6b (patch)
tree65a9d6d3633854bb927bc50845399b8931ed343f /Library
parentfc52e1a69d3f94940279f656e9dae5fb66546c6c (diff)
downloadbrew-b2e12c4517e36a8efa8d5cceac7b256d9cad7f6b.tar.bz2
Add test for SHA1
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/unittest.rb38
1 files changed, 28 insertions, 10 deletions
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 34ab4f509..9cdf46cc8 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -60,14 +60,6 @@ class TestZip <Formula
end
end
-class TestBallValidMd5 <TestBall
- @md5='71aa838a9e4050d1876a295a9e62cbe6'
-end
-
-class TestBallInvalidMd5 <TestBall
- @md5='61aa838a9e4050d1876a295a9e62cbe6'
-end
-
class TestBadVersion <TestBall
@version="versions can't have spaces"
end
@@ -269,12 +261,38 @@ class BeerTasting <Test::Unit::TestCase
end
def test_md5
- assert_nothing_raised { nostdout { TestBallValidMd5.new.brew {} } }
+ valid_md5 = Class.new(TestBall) do
+ @md5='71aa838a9e4050d1876a295a9e62cbe6'
+ end
+
+ assert_nothing_raised { nostdout { valid_md5.new.brew {} } }
end
def test_badmd5
+ invalid_md5 = Class.new(TestBall) do
+ @md5='61aa838a9e4050d1876a295a9e62cbe6'
+ end
+
+ assert_raises RuntimeError do
+ nostdout { invalid_md5.new.brew {} }
+ end
+ end
+
+ def test_sha1
+ valid_sha1 = Class.new(TestBall) do
+ @sha1='6ea8a98acb8f918df723c2ae73fe67d5664bfd7e'
+ end
+
+ assert_nothing_raised { nostdout { valid_sha1.new.brew {} } }
+ end
+
+ def test_badsha1
+ invalid_sha1 = Class.new(TestBall) do
+ @sha1='7ea8a98acb8f918df723c2ae73fe67d5664bfd7e'
+ end
+
assert_raises RuntimeError do
- nostdout { TestBallInvalidMd5.new.brew {} }
+ nostdout { invalid_sha1.new.brew {} }
end
end