summaryrefslogtreecommitdiff
path: root/libziparchive/cli-tests/zipinfo.test
blob: d5bce1c01a502e7128618620fc74ece22f9c8dd7 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# zipinfo tests.

# Note: since "master key", Android uses libziparchive for all zip file
# handling, and that scans the whole central directory immediately. Not only
# lookups by name but also iteration is implemented using the resulting hash
# table, meaning that any test that makes assumptions about iteration order
# will fail on Android.

name: zipinfo -1
command: zipinfo -1 $FILES/example.zip | sort
expected-stdout:
	d1/
	d1/d2/a.txt
	d1/d2/b.txt
	d1/d2/c.txt
	d1/d2/dir/
	d1/d2/empty.txt
	d1/d2/x.txt
---

name: zipinfo header
command: zipinfo $FILES/example.zip | head -2
expected-stdout:
	Archive:  $FILES/example.zip
	Zip file size: 1082 bytes, number of entries: 7
---

name: zipinfo footer
command: zipinfo $FILES/example.zip | tail -1
expected-stdout:
	7 files, 1033 bytes uncompressed, 20 bytes compressed:  98.1%
---

name: zipinfo directory
# The RI doesn't use ISO dates.
command: zipinfo $FILES/example.zip d1/ | sed s/17-Jun-/2017-06-/
expected-stdout:
	drwxr-x---  3.0 unx        0 bx stor 2017-06-04 08:40 d1/
---

name: zipinfo stored
# The RI doesn't use ISO dates.
command: zipinfo $FILES/example.zip d1/d2/empty.txt | sed s/17-Jun-/2017-06-/
expected-stdout:
	-rw-r-----  3.0 unx        0 bx stor 2017-06-04 08:43 d1/d2/empty.txt
---

name: zipinfo deflated
# The RI doesn't use ISO dates.
command: zipinfo $FILES/example.zip d1/d2/x.txt | sed s/17-Jun-/2017-06-/
expected-stdout:
	-rw-r-----  3.0 unx     1024 tx defN 2017-06-04 08:45 d1/d2/x.txt
---