method
assert_headers_equal
v2_2_9 -
Show latest stable
-
0 notes -
Class: TarTestCase
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
assert_headers_equal(expected, actual)
public
Hide source
# File lib/rubygems/package/tar_test_case.rb, line 25 def assert_headers_equal(expected, actual) expected = expected.to_s unless String === expected actual = actual.to_s unless String === actual fields = ] name 100 mode 8 uid 8 gid 8 size 12 mtime 12 checksum 8 typeflag 1 linkname 100 magic 6 version 2 uname 32 gname 32 devmajor 8 devminor 8 prefix 155 ] offset = 0 until fields.empty? do name = fields.shift length = fields.shift.to_i if name == "checksum" then chksum_off = offset offset += length next end assert_equal expected[offset, length], actual[offset, length], "Field #{name} of the tar header differs." offset += length end assert_equal expected[chksum_off, 8], actual[chksum_off, 8] end