aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup.sh8
-rwxr-xr-xtests/t0010-validate-html.sh9
-rwxr-xr-xtests/t0104-tree.sh2
-rwxr-xr-xtests/t0107-snapshot.sh22
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
@@ -25,11 +25,13 @@ mkrepo() {
mkdir -p $name
cd $name
git init
- for ((n=1; n<=count; n++))
+ n=1
+ while test $n -le $count
do
echo $n >file-$n
git add file-$n
git commit -m "commit $n"
+ n=$(expr $n + 1)
done
if test "$3" = "testplus"
then
@@ -101,7 +103,7 @@ run_test()
{
desc=$1
script=$2
- ((test_count++))
+ test_count=$(expr $test_count + 1)
printf "\ntest %d: name='%s'\n" $test_count "$desc" >>test-output.log
printf "test %d: eval='%s'\n" $test_count "$2" >>test-output.log
eval "$2" >>test-output.log 2>>test-output.log
@@ -111,7 +113,7 @@ run_test()
then
printf " %2d) %-60s [ok]\n" $test_count "$desc"
else
- ((test_failed++))
+ test_failed=$(expr $test_failed + 1)
printf " %2d) %-60s [failed]\n" $test_count "$desc"
fi
}
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
@@ -9,7 +9,7 @@ test_url()
test -z "$NO_TIDY_WARNINGS" || tidy_opt+=" --show-warnings no"
cgit_url "$1" >trash/tidy-$test_count || return
sed -ie "1,4d" trash/tidy-$test_count || return
- tidy $tidy_opt trash/tidy-$test_count
+ "$tidy" $tidy_opt trash/tidy-$test_count
rc=$?
# tidy returns with exitcode 1 on warnings, 2 on error
@@ -23,6 +23,13 @@ test_url()
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 ""'
run_test 'foo' 'test_url "foo"'
run_test 'foo/log' 'test_url "foo/log"'
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
@@ -15,7 +15,7 @@ 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
'
run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >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
@@ -4,36 +4,36 @@
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
'
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."
'
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
'
run_test 'count files' '
- c=$(ls -1 trash/foo/ | wc -l) &&
+ c=$(ls -1 trash/master/ | wc -l) &&
test $c = 5
'
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
'
tests_done