Diff options
Diffstat (limited to '')
| -rwxr-xr-x | tests/t0002-html-validity.sh | 33 |
1 file changed, 5 insertions, 28 deletions
diff --git a/tests/t0002-html-validity.sh b/tests/t0002-html-validity.sh index f5e918c..bdccaf2 100755 --- a/tests/t0002-html-validity.sh +++ b/tests/t0002-html-validity.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Runs the tidy checker over one page of each kind cgit renders, caring only +# Runs the tidy checker over one page of most kinds cgit renders, caring only # about the shape of the markup. What the pages say is the business of the # t01xx scripts. Tidy is optional and old versions predate the elements cgit # uses, so the file steps aside when a usable one cannot be found. @@ -9,36 +9,21 @@ test_description='Validate html with tidy' . ./setup.sh test_url() { - tidy_options="-eq" - test -z "$NO_TIDY_WARNINGS" || tidy_options="$tidy_options --show-warnings no" # A second argument names a config of its own, for pages the shared # config keeps turned off. - if test -n "$2" - then - CGIT_CONFIG="$PWD/$2" QUERY_STRING="url=$1" cgit >tidy-$test_count.tmp || return - else - cgit_url "$1" >tidy-$test_count.tmp || return - fi + cgit_rc "${2:-cgitrc}" "url=$1" >tidy-$test_count.tmp || return # Tidy reads what it is given as a whole document, so the response # headers are dropped before it sees the page. strip_headers <tidy-$test_count.tmp >tidy-$test_count || return - "$tidy" $tidy_options tidy-$test_count - status=$? - # Tidy leaves with 1 for warnings and 2 for errors, and only an error is # worth failing the test over. - if test $status = 2 - then - false - else - : - fi + "$tidy" -eq tidy-$test_count + test $? != 2 } tidy=$(command -v tidy) || { skip_all='Skipping html validation tests: tidy not found' test_done - exit } # Releases of tidy that predate HTML5 reject the semantic elements cgit emits, @@ -49,7 +34,6 @@ printf '<!DOCTYPE html>\n<html lang="en"><head><title>t</title></head><body><hea test $? -ge 2 && { skip_all='Skipping html validation tests: tidy is too old for HTML5' test_done - exit } test_expect_success 'index page' 'test_url ""' @@ -65,14 +49,7 @@ test_expect_success 'error page' 'test_url "no-such-repo"' # Stats and blame stay off in the shared config, so their pages validate # through a config of their own. test_expect_success 'set up a features config' ' - { - echo "virtual-root=/" && - echo "cache-size=0" && - echo "max-stats=year" && - echo "enable-blame=1" && - echo "repo.url=feat" && - echo "repo.path=$PWD/repos/foo/.git" - } >featrc + cgitrc_repo featrc feat max-stats=year enable-blame=1 "repo.path=$PWD/repos/foo/.git" ' test_expect_success 'stats page' 'test_url "feat/stats/" featrc' |
