diff --git a/scripts/check-links.test.sh b/scripts/check-links.test.sh index 120a78a..fdb59b7 100755 --- a/scripts/check-links.test.sh +++ b/scripts/check-links.test.sh @@ -131,6 +131,18 @@ expect_out 'anchor missing: index\.html -> /t\.html#viewport' "meta name is not expect_out 'anchor missing: index\.html -> /t\.html#a\.b' "dot in an anchor is literal" expect_no_out 'anchor missing: index\.html -> /t\.html#(ok|named|x\.y)' "real id, and literal-dot anchors still pass" +echo "case: every ERE metacharacter in an anchor is literal, in both the id= and arms" +root="$(new_site anchor-metachars)" +printf 'abcdef' > "$root/index.html" +printf '
top' > "$root/t.html" +run_checker "$root" +expect_rc 1 "unescaped-metachar false passes fail" +expect_out 'anchor missing: index\.html -> /t\.html#a\+b' "plus in an id= anchor is literal" +expect_out 'anchor missing: index\.html -> /t\.html#q\(1\)' "parens in an id= anchor are literal" +expect_out 'anchor missing: index\.html -> /t\.html#n\.m' "dot in an anchor is literal" +expect_no_out 'anchor missing: index\.html -> /t\.html#(c\+d|r\(2\)|with-attrs)' "literal metachar ids, metachar and after other attributes still pass" +expect_out 'Internal errors: 3\.' "only the three false passes counted" + echo "case: single-quoted and unquoted href/src are checked; ?src= and empty href are not" root="$(new_site quoting-forms)" cat > "$root/index.html" <<'HTML'