Diff options
Diffstat (limited to 'tests/t0002-html-validity.sh')
| -rwxr-xr-x | tests/t0002-html-validity.sh | 26 |
1 file changed, 14 insertions, 12 deletions
diff --git a/tests/t0002-html-validity.sh b/tests/t0002-html-validity.sh index bdccaf2..a4a6725 100755 --- a/tests/t0002-html-validity.sh +++ b/tests/t0002-html-validity.sh @@ -17,22 +17,24 @@ test_url() { strip_headers <tidy-$test_count.tmp >tidy-$test_count || return # Tidy leaves with 1 for warnings and 2 for errors, and only an error is # worth failing the test over. - "$tidy" -eq tidy-$test_count + tidy -eq tidy-$test_count test $? != 2 } -tidy=$(command -v tidy) || { - skip_all='Skipping html validation tests: tidy not found' - test_done -} - # Releases of tidy that predate HTML5 reject the semantic elements cgit emits, -# header, nav, main and footer among them, reporting each as an error. Skip the -# validation unless tidy is new enough to understand them. -printf '<!DOCTYPE html>\n<html lang="en"><head><title>t</title></head><body><header>x</header></body></html>\n' \ - | "$tidy" -q -e >/dev/null 2>&1 -test $? -ge 2 && { - skip_all='Skipping html validation tests: tidy is too old for HTML5' +# header, nav, main and footer among them, reporting each as an error, so only +# a tidy new enough to understand them will do. +test_lazy_prereq TIDY ' + cat >probe.html <<-\EOF && + <!DOCTYPE html> + <html lang="en"><head><title>t</title></head><body><header>x</header></body></html> + EOF + tidy -q -e probe.html >/dev/null 2>&1 + test $? -lt 2 +' + +test_have_prereq TIDY || { + skip_all='Skipping html validation tests: no tidy that knows HTML5' test_done } |
