diff options
author | John Keeping | 2013-03-04 21:58:51 +0000 |
---|---|---|
committer | Jason A. Donenfeld | 2013-03-04 19:41:26 -0500 |
commit | d5a43b429a4248a02e3a403f76fff0cbae92ef32 (patch) | |
tree | 26f7977b14caf49f9dadea06421aa09981d802cf /tests | |
parent | tests: make whitespace consistent (diff) | |
download | cgit-d5a43b429a4248a02e3a403f76fff0cbae92ef32.tar.gz cgit-d5a43b429a4248a02e3a403f76fff0cbae92ef32.zip |
t0107-snapshot: add tests for ZIP archives
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/t0107-snapshot.sh | 39 |
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 | ||
23 | run_test ' | 23 | run_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 | ||
27 | run_test 'untar' ' | 27 | run_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 | ||
42 | run_test 'get foo/snapshot/master.zip' ' | ||
43 | cgit_url "foo/snapshot/master.zip" >trash/tmp | ||
44 | ' | ||
45 | |||
46 | run_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 | |||
54 | run_test 'strip off the header lines (zip)' ' | ||
55 | tail -n +6 trash/tmp >trash/master.zip | ||
56 | ' | ||
57 | |||
58 | run_test 'verify zip format' ' | ||
59 | unzip -t trash/master.zip | ||
60 | ' | ||
61 | |||
62 | run_test 'unzip' ' | ||
63 | rm -rf trash/master && | ||
64 | unzip trash/master.zip -d trash | ||
65 | ' | ||
66 | |||
67 | run_test 'count files (zip)' ' | ||
68 | c=$(ls -1 trash/master/ | wc -l) && | ||
69 | test $c = 5 | ||
70 | ' | ||
71 | |||
72 | run_test 'verify unzipped file-5' ' | ||
73 | grep "^5$" trash/master/file-5 && | ||
74 | test $(cat trash/master/file-5 | wc -l) = 1 | ||
75 | ' | ||
76 | |||
42 | tests_done | 77 | tests_done |