2 # Copyright (C) 2010, Parrot Foundation.
7 t/library/archive_tar.t
11 Test the Archive/Tar library
15 % prove t/library/archive_tar.t
20 .include 'test_more.pir'
22 load_bytecode 'Archive/Tar.pir'
30 $P0 = new ['Archive';'Tar']
31 $I0 = isa $P0, ['Archive';'Tar']
32 ok($I0, "new ['Archive';'Tar']")
33 $P0 = new ['Archive';'Tar';'File']
34 $I0 = isa $P0, ['Archive';'Tar';'File']
35 ok($I0, "new ['Archive';'Tar';'File']")
39 .local pmc archive, entry
40 archive = new ['Archive';'Tar']
41 $I0 = isa archive, ['Archive';'Tar']
43 entry = archive.'add_data'('msg.txt', "some data")
44 $I0 = isa entry, ['Archive';'Tar';'File']
45 ok($I0, "entry is an ['Archive';'Tar';'File']")
47 is($S0, "some data", "data")
48 $S0 = entry.'full_path'()
49 is($S0, 'msg.txt', "full_path")
51 header = entry.'_format_tar_entry'()
53 is($I0, 512, "length header")
54 $I0 = index header, 'msg.txt'
55 is($I0, 0, "header starts by filename")
56 $I0 = index header, 'ustar'
57 is($I0, 257, "magic at 257")
60 fh = new 'StringHandle'
61 fh.'open'('in_memory', 'wb')
67 $I0 = index $S0, 'msg.txt'
68 is($I0, 0, 'filename')
69 $I0 = index $S0, 'some data'
77 # vim: expandtab shiftwidth=4 ft=pir: