blob: 9017b528d01dcc7c9fc6c66dc6b831d80fe4d687 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
require "testing_env"
require "formula"
class ChecksumVerificationTests < Homebrew::TestCase
def assert_checksum_good
assert_nothing_raised { shutup { @_f.brew {} } }
end
def assert_checksum_bad
assert_raises(ChecksumMismatchError) { shutup { @_f.brew {} } }
end
def formula(&block)
super do
url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
instance_eval(&block)
end
end
def teardown
@_f.clear_cache
end
def test_good_sha256
formula do
sha256 TESTBALL_SHA256
end
assert_checksum_good
end
def test_bad_sha256
formula do
sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8"
end
assert_checksum_bad
end
end
|