about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJohn Keeping2013-03-04 21:58:51 +0000
committerJason A. Donenfeld2013-03-04 19:41:26 -0500
commitd5a43b429a4248a02e3a403f76fff0cbae92ef32 (patch)
tree26f7977b14caf49f9dadea06421aa09981d802cf
parenttests: make whitespace consistent (diff)
downloadcgit-d5a43b429a4248a02e3a403f76fff0cbae92ef32.tar.gz
cgit-d5a43b429a4248a02e3a403f76fff0cbae92ef32.zip
t0107-snapshot: add tests for ZIP archives
Signed-off-by: John Keeping <john@keeping.me.uk>
-rwxr-xr-xtests/t0107-snapshot.sh39
1 files changed, 37 insertions, 2 deletions
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index d23bf97..132d2e9 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh
@@ -20,8 +20,8 @@ run_test 'strip off the header lines' '
20 tail -n +6 trash/tmp > trash/master.tar.gz 20 tail -n +6 trash/tmp > trash/master.tar.gz
21' 21'
22 22
23run_test ' 23run_test 'verify gzip format' '
24 verify gzip format' 'gunzip --test trash/master.tar.gz 24 gunzip --test trash/master.tar.gz
25' 25'
26 26
27run_test 'untar' ' 27run_test 'untar' '
@@ -39,4 +39,39 @@ run_test 'verify untarred file-5' '
39 test $(cat trash/master/file-5 | wc -l) = 1 39 test $(cat trash/master/file-5 | wc -l) = 1
40' 40'
41 41
42run_test 'get foo/snapshot/master.zip' '
43 cgit_url "foo/snapshot/master.zip" >trash/tmp
44'
45
46run_test 'check HTML headers (zip)' '
47 head -n 1 trash/tmp |
48 grep "Content-Type: application/x-zip" &&
49
50 head -n 2 trash/tmp |
51 grep "Content-Disposition: inline; filename=.master.zip."
52'
53
54run_test 'strip off the header lines (zip)' '
55 tail -n +6 trash/tmp >trash/master.zip
56'
57
58run_test 'verify zip format' '
59 unzip -t trash/master.zip
60'
61
62run_test 'unzip' '
63 rm -rf trash/master &&
64 unzip trash/master.zip -d trash
65'
66
67run_test 'count files (zip)' '
68 c=$(ls -1 trash/master/ | wc -l) &&
69 test $c = 5
70'
71
72run_test 'verify unzipped file-5' '
73 grep "^5$" trash/master/file-5 &&
74 test $(cat trash/master/file-5 | wc -l) = 1
75'
76
42tests_done 77tests_done