Diff options
Diffstat (limited to 'tests/extensions/test-email-avatar.lua')
| -rw-r--r-- | tests/extensions/test-email-avatar.lua | 16 |
1 file changed, 8 insertions, 8 deletions
diff --git a/tests/extensions/test-email-avatar.lua b/tests/extensions/test-email-avatar.lua index 5929634..c9a9ec0 100644 --- a/tests/extensions/test-email-avatar.lua +++ b/tests/extensions/test-email-avatar.lua @@ -101,14 +101,14 @@ h.contains("a name keeps the escaping cgit gave it", out, "> A & B") h.excludes("and is not escaped again", out, "&amp;") -- A commit can carry any bytes in its address, and a log page runs the --- filter once per row, so the trim has to stay linear in a run of spaces. -local started = os.clock() -render("<a" .. string.rep(" ", 40000) .. "b>", "x") -h.check("a long run of inner spaces is trimmed quickly", os.clock() - started < 0.5) - -started = os.clock() -render(string.rep("<", 40000), "x") -h.check("a long run of open brackets is unwrapped quickly", os.clock() - started < 0.5) +-- filter once per row, so trimming and unwrapping have to stay linear. +local function address_only(text) + return (render(text, "x")) +end +h.stays_linear("a long run of inner spaces is trimmed in linear time", address_only, + function(count) return "<a" .. string.rep(" ", count) .. "b>" end, 10000) +h.stays_linear("an address of open brackets is scanned in linear time", address_only, + function(count) return string.rep("<", count) end, 10000) h.check("text around the brackets is dropped", hash_of(render("x <author@example.com> y", "x")) == plain) |
