From 3f35f7c5992db07f06893aa04df0912596a5d327 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 11:08:07 -1000 Subject: Compare link-commits output whole Four checks only looked for a missing anchor, which output with the text dropped also passes, and no message held the entities cgit escapes it with. --- tests/extensions/test-link-commits.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/extensions/test-link-commits.lua b/tests/extensions/test-link-commits.lua index dca16d4..58b63ea 100644 --- a/tests/extensions/test-link-commits.lua +++ b/tests/extensions/test-link-commits.lua @@ -17,23 +17,23 @@ local function render(text) return h.run({}, { text }) end -local out, ret = render("see #123 near deadbee") +local out = render("see #123 near deadbee") h.equals("an unedited copy leaves issue marks as text", out, "see #123 near deadbee") h.load_with(script, { { "-- { pattern = \"#(%d+)\"", "{ pattern = \"#(%d+)\"" } }) +local ret out, ret = render("see #123 for details") -h.contains("issue mark becomes a link", out, "#123") -h.contains("text around the link survives", out, "see ") -h.contains("text after the link survives", out, " for details") +h.equals("issue mark becomes a link amid its text", out, + "see #123 for details") h.equals("close answers zero", ret, 0) out = render("fixed in deadbee") h.contains("seven hex characters link", out, "deadbee") out = render("fixed in deadbe") -h.excludes("six hex characters stay text", out, "1234567") @@ -47,13 +47,13 @@ out = render("commit " .. sha256) h.contains("a full sha256 name links", out, "'./?id=" .. sha256 .. "'") out = render("commit " .. sha256 .. "0") -h.excludes("sixty five hex characters stay text", out, "deadbeef>") + -- A rule broad enough to capture a quote or a percent sign still has to -- leave a url that stays inside its attribute and means what it says. h.load_with(script, { { "local rules = {", "local rules = { { pattern = \"T:(%S+)\", url = \"https://t/%s\" }," } }) -- cgit 2.12.1