about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-03-04 21:58:51 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2013-03-04 19:41:26 -0500
commitd5a43b429a4248a02e3a403f76fff0cbae92ef32 (patch)
tree26f7977b14caf49f9dadea06421aa09981d802cf /tests
parenttests: make whitespace consistent (diff)
downloadcgit-pink-d5a43b429a4248a02e3a403f76fff0cbae92ef32.tar.gz
cgit-pink-d5a43b429a4248a02e3a403f76fff0cbae92ef32.zip
t0107-snapshot: add tests for ZIP archives
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'tests')
-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' '
 	tail -n +6 trash/tmp > trash/master.tar.gz
 '
 
-run_test '
-	verify gzip format' 'gunzip --test trash/master.tar.gz
+run_test 'verify gzip format' '
+	gunzip --test trash/master.tar.gz
 '
 
 run_test 'untar' '
@@ -39,4 +39,39 @@ run_test 'verify untarred file-5' '
 	test $(cat trash/master/file-5 | wc -l) = 1
 '
 
+run_test 'get foo/snapshot/master.zip' '
+	cgit_url "foo/snapshot/master.zip" >trash/tmp
+'
+
+run_test 'check HTML headers (zip)' '
+	head -n 1 trash/tmp |
+	grep "Content-Type: application/x-zip" &&
+
+	head -n 2 trash/tmp |
+	grep "Content-Disposition: inline; filename=.master.zip."
+'
+
+run_test 'strip off the header lines (zip)' '
+	tail -n +6 trash/tmp >trash/master.zip
+'
+
+run_test 'verify zip format' '
+	unzip -t trash/master.zip
+'
+
+run_test 'unzip' '
+	rm -rf trash/master &&
+	unzip trash/master.zip -d trash
+'
+
+run_test 'count files (zip)' '
+	c=$(ls -1 trash/master/ | wc -l) &&
+	test $c = 5
+'
+
+run_test 'verify unzipped file-5' '
+	 grep "^5$" trash/master/file-5 &&
+	 test $(cat trash/master/file-5 | wc -l) = 1
+'
+
 tests_done
> Also bump the message cap to 1024 because that is ostensibly useful for replying to older messages. 2021-09-14Add downgrade IRC botJune McEnroe 2021-09-14Sort by title if authors matchJune McEnroe There are probably better things to sort by but title definitely always exists. 2021-09-13Swap-remove tags as they're foundJune McEnroe This makes it even faster. From ~1s on a sqlite3.c amalgamation to ~0.85s. 2021-09-12Replace htagml regex with strncmpJune McEnroe Since ctags only ever produces regular expressions of the form /^re$/ or /^re/ with no other special characters, instead unescape the pattern and simply use strncmp. Running on a sqlite3.c amalgamation, the regex version takes ~37s while the strncmp version takes ~1s, producing identical output. Big win! 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe This fixes badly indented comments. 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe