# 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
---