about summary refs log tree commit diff stats
path: root/tests/t0010-validate-html.sh
diff options
context:
space:
mode:
authorJohn Keeping2013-04-01 15:09:05 +0100
committerJason A. Donenfeld2013-04-08 22:27:11 +0200
commitc95cc5ec56dbb7394015eb18201403be6d80f69b (patch)
tree7014b96a1a1408b5291532c0c442082aba693a80 /tests/t0010-validate-html.sh
parentDo not load user or system gitconfig and gitattributes (diff)
downloadcgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.tar.gz
cgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.zip
tests: use Git's test framework
This allows tests to run in parallel as well as letting us use "prove"
or another TAP harness to run the tests.

Git's test framework requires Git to be fully built before letting any
tests run, so add a new target to the top-level Makefile which builds
all of Git instead of just libgit.a and make the "test" target depend on
that.

Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'tests/t0010-validate-html.sh')
-rwxr-xr-xtests/t0010-validate-html.sh31
1 files changed, 15 insertions, 16 deletions
diff --git a/tests/t0010-validate-html.sh b/tests/t0010-validate-html.sh index 3fe4800..5bd0a25 100755 --- a/tests/t0010-validate-html.sh +++ b/tests/t0010-validate-html.sh
@@ -1,5 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3test_description='Validate html with tidy'
3. ./setup.sh 4. ./setup.sh
4 5
5 6
@@ -7,9 +8,9 @@ test_url()
7{ 8{
8 tidy_opt="-eq" 9 tidy_opt="-eq"
9 test -z "$NO_TIDY_WARNINGS" || tidy_opt+=" --show-warnings no" 10 test -z "$NO_TIDY_WARNINGS" || tidy_opt+=" --show-warnings no"
10 cgit_url "$1" >trash/tidy-$test_count || return 11 cgit_url "$1" >tidy-$test_count || return
11 sed -ie "1,4d" trash/tidy-$test_count || return 12 sed -ie "1,4d" tidy-$test_count || return
12 "$tidy" $tidy_opt trash/tidy-$test_count 13 "$tidy" $tidy_opt tidy-$test_count
13 rc=$? 14 rc=$?
14 15
15 # tidy returns with exitcode 1 on warnings, 2 on error 16 # tidy returns with exitcode 1 on warnings, 2 on error
@@ -21,21 +22,19 @@ test_url()
21 fi 22 fi
22} 23}
23 24
24prepare_tests 'Validate html with tidy' 25tidy=`which tidy 2>/dev/null`
25
26tidy=`which tidy`
27test -n "$tidy" || { 26test -n "$tidy" || {
28 echo "Skipping tests: tidy not found" 27 skip_all='Skipping html validation tests: tidy not found'
29 tests_done 28 test_done
30 exit 29 exit
31} 30}
32 31
33run_test 'index page' 'test_url ""' 32test_expect_success 'index page' 'test_url ""'
34run_test 'foo' 'test_url "foo"' 33test_expect_success 'foo' 'test_url "foo"'
35run_test 'foo/log' 'test_url "foo/log"' 34test_expect_success 'foo/log' 'test_url "foo/log"'
36run_test 'foo/tree' 'test_url "foo/tree"' 35test_expect_success 'foo/tree' 'test_url "foo/tree"'
37run_test 'foo/tree/file-1' 'test_url "foo/tree/file-1"' 36test_expect_success 'foo/tree/file-1' 'test_url "foo/tree/file-1"'
38run_test 'foo/commit' 'test_url "foo/commit"' 37test_expect_success 'foo/commit' 'test_url "foo/commit"'
39run_test 'foo/diff' 'test_url "foo/diff"' 38test_expect_success 'foo/diff' 'test_url "foo/diff"'
40 39
41tests_done 40test_done