-rwxr-xr-x | tests/setup.sh | 8 | ||||
-rwxr-xr-x | tests/t0010-validate-html.sh | 9 | ||||
-rwxr-xr-x | tests/t0104-tree.sh | 2 | ||||
-rwxr-xr-x | tests/t0107-snapshot.sh | 22 |
4 files changed, 25 insertions, 16 deletions
diff --git a/tests/setup.sh b/tests/setup.sh index 1457dd5..30f90d5 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -27,3 +27,4 @@ mkrepo() { git init - for ((n=1; n<=count; n++)) + n=1 + while test $n -le $count do @@ -32,2 +33,3 @@ mkrepo() { git commit -m "commit $n" + n=$(expr $n + 1) done @@ -103,3 +105,3 @@ run_test() script=$2 - ((test_count++)) + test_count=$(expr $test_count + 1) printf "\ntest %d: name='%s'\n" $test_count "$desc" >>test-output.log @@ -113,3 +115,3 @@ run_test() else - ((test_failed++)) + test_failed=$(expr $test_failed + 1) printf " %2d) %-60s [failed]\n" $test_count "$desc" diff --git a/tests/t0010-validate-html.sh b/tests/t0010-validate-html.sh index 94aa52b..3fe4800 100755 --- a/tests/t0010-validate-html.sh +++ b/tests/t0010-validate-html.sh @@ -11,3 +11,3 @@ test_url() sed -ie "1,4d" trash/tidy-$test_count || return - tidy $tidy_opt trash/tidy-$test_count + "$tidy" $tidy_opt trash/tidy-$test_count rc=$? @@ -25,2 +25,9 @@ prepare_tests 'Validate html with tidy' +tidy=`which tidy` +test -n "$tidy" || { + echo "Skipping tests: tidy not found" + tests_done + exit +} + run_test 'index page' 'test_url ""' diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 0d62cc8..33f4eb0 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -17,3 +17,3 @@ run_test 'find line 1' ' run_test 'no line 2' ' - grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp + ! grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp ' diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh index d97c465..8ab4912 100755 --- a/tests/t0107-snapshot.sh +++ b/tests/t0107-snapshot.sh @@ -6,4 +6,4 @@ prepare_tests "Verify snapshot" -run_test 'get foo/snapshot/test.tar.gz' ' - cgit_url "foo/snapshot/test.tar.gz" >trash/tmp +run_test 'get foo/snapshot/master.tar.gz' ' + cgit_url "foo/snapshot/master.tar.gz" >trash/tmp ' @@ -12,6 +12,6 @@ run_test 'check html headers' ' head -n 1 trash/tmp | - grep -e "Content-Type: application/x-tar" && + grep -e "Content-Type: application/x-gzip" && head -n 2 trash/tmp | - grep -e "Content-Disposition: inline; filename=.test.tar.gz." + grep -e "Content-Disposition: inline; filename=.master.tar.gz." ' @@ -19,9 +19,9 @@ run_test 'check html headers' ' run_test 'strip off the header lines' ' - tail -n +6 trash/tmp > trash/test.tar.gz + tail -n +6 trash/tmp > trash/master.tar.gz ' -run_test 'verify gzip format' 'gunzip --test trash/test.tar.gz' +run_test 'verify gzip format' 'gunzip --test trash/master.tar.gz' run_test 'untar' ' - rm -rf trash/foo && - tar -xf trash/test.tar.gz -C trash + rm -rf trash/master && + tar -xf trash/master.tar.gz -C trash ' @@ -29,3 +29,3 @@ run_test 'untar' ' run_test 'count files' ' - c=$(ls -1 trash/foo/ | wc -l) && + c=$(ls -1 trash/master/ | wc -l) && test $c = 5 @@ -34,4 +34,4 @@ run_test 'count files' ' run_test 'verify untarred file-5' ' - grep -e "^5$" trash/foo/file-5 && - test $(cat trash/foo/file-5 | wc -l) = 1 + grep -e "^5$" trash/master/file-5 && + test $(cat trash/master/file-5 | wc -l) = 1 ' |