diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Lead a readme's relative links into the tree
A browser resolved them against the about page, where nothing lives now that the page answers 404 below itself. They resolve the way GitHub resolves a readme's links instead, from the readme's directory and on the branch it was read from.
Diffstat (limited to 'tests/extensions/harness.lua')
-rw-r--r--tests/extensions/harness.lua11
1 file changed, 9 insertions, 2 deletions
diff --git a/tests/extensions/harness.lua b/tests/extensions/harness.lua
index d9318ee..fc83a73 100644
--- a/tests/extensions/harness.lua
+++ b/tests/extensions/harness.lua
@@ -46,16 +46,23 @@ html_attr = sink(function(s)
return (s:gsub("[&<>'\"]", attr_map))
end)
+-- The bytes url_escape_table encodes, which are those a url path cannot
+-- carry plainly and those an attribute or a query would misread.
+html_url_path = sink(function(s)
+ return (s:gsub("[%c \"#%%&'+<=>?\\^`{|}\128-\255]", function(c)
+ return string.format("%%%02X", c:byte())
+ end))
+end)
+
-- No shipped extension calls the remaining sinks, so rather than risk an
-- unfaithful copy quietly passing a test, using one fails loudly until its
--- escaping is mirrored from source/html.c the way the three above are.
+-- escaping is mirrored from source/html.c the way the ones above are.
local function unmirrored(name)
return function()
error(name .. " is not mirrored by the test harness yet")
end
end
-html_url_path = unmirrored("html_url_path")
html_url_arg = unmirrored("html_url_arg")
html_include = unmirrored("html_include")