aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_checksums.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2010-01-29 10:41:03 -0800
committerAdam Vandenberg2010-02-02 09:08:10 -0800
commita309403d8ab3830fc0a02a861c7ccdefedfe4da1 (patch)
tree09a22293e7b810f1e27bd8e3dd59bcca97f18c12 /Library/Homebrew/test/test_checksums.rb
parent5474cf1a95616243f5592c8c5951048ea5cbafe3 (diff)
downloadbrew-a309403d8ab3830fc0a02a861c7ccdefedfe4da1.tar.bz2
Update test suite.
* Break single test case class into several test cases. * Fix broken arch test. * Make update tests optional (seem to only work for mxcl). * Add more tests. * Move fixtures to separate folder.
Diffstat (limited to 'Library/Homebrew/test/test_checksums.rb')
-rw-r--r--Library/Homebrew/test/test_checksums.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_checksums.rb b/Library/Homebrew/test/test_checksums.rb
new file mode 100644
index 000000000..d93af908a
--- /dev/null
+++ b/Library/Homebrew/test/test_checksums.rb
@@ -0,0 +1,57 @@
+class ChecksumTests < Test::Unit::TestCase
+ def test_md5
+ 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 { invalid_sha1.new.brew {} }
+ end
+ end
+
+ def test_sha256
+ valid_sha256 = Class.new(TestBall) do
+ @sha256='ccbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8'
+ end
+
+ assert_nothing_raised do
+ nostdout { valid_sha256.new.brew {} }
+ end
+ end
+
+ def test_badsha256
+ invalid_sha256 = Class.new(TestBall) do
+ @sha256='dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8'
+ end
+
+ assert_raises RuntimeError do
+ nostdout { invalid_sha256.new.brew {} }
+ end
+ end
+end