all repos — cgit @ v1.2

a hyperfast web frontend for git written in c

tests/t0010-validate-html.sh (view raw)

 1#!/bin/sh
 2
 3test_description='Validate html with tidy'
 4. ./setup.sh
 5
 6
 7test_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
25tidy=`which tidy 2>/dev/null`
26test -n "$tidy" || {
27	skip_all='Skipping html validation tests: tidy not found'
28	test_done
29	exit
30}
31
32test_expect_success 'index page' 'test_url ""'
33test_expect_success 'foo' 'test_url "foo"'
34test_expect_success 'foo/log' 'test_url "foo/log"'
35test_expect_success 'foo/tree' 'test_url "foo/tree"'
36test_expect_success 'foo/tree/file-1' 'test_url "foo/tree/file-1"'
37test_expect_success 'foo/commit' 'test_url "foo/commit"'
38test_expect_success 'foo/diff' 'test_url "foo/diff"'
39
40test_done