]> gitweb.ps.run Git - ps-cgit/blob - tests/t0010-validate-html.sh
ui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'
[ps-cgit] / tests / t0010-validate-html.sh
1 #!/bin/sh
2
3 test_description='Validate html with tidy'
4 . ./setup.sh
5
6
7 test_url()
8 {
9         tidy_opt="-eq"
10         test -z "$NO_TIDY_WARNINGS" || tidy_opt+=" --show-warnings no"
11         cgit_url "$1" >tidy-$test_count.tmp || return
12         sed -e "1,4d" tidy-$test_count.tmp >tidy-$test_count || return
13         "$tidy" $tidy_opt tidy-$test_count
14         rc=$?
15
16         # tidy returns with exitcode 1 on warnings, 2 on error
17         if test $rc = 2
18         then
19                 false
20         else
21                 :
22         fi
23 }
24
25 tidy=`which tidy 2>/dev/null`
26 test -n "$tidy" || {
27         skip_all='Skipping html validation tests: tidy not found'
28         test_done
29         exit
30 }
31
32 test_expect_success 'index page' 'test_url ""'
33 test_expect_success 'foo' 'test_url "foo"'
34 test_expect_success 'foo/log' 'test_url "foo/log"'
35 test_expect_success 'foo/tree' 'test_url "foo/tree"'
36 test_expect_success 'foo/tree/file-1' 'test_url "foo/tree/file-1"'
37 test_expect_success 'foo/commit' 'test_url "foo/commit"'
38 test_expect_success 'foo/diff' 'test_url "foo/diff"'
39
40 test_done