From d8a045c91469b1d121b8fd14dffaa367b194831d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 6 Sep 2026 21:46:52 -1000 Subject: Clean up the whole tree --- tests/extensions/harness.lua | 18 ++---- tests/extensions/lib.sh | 3 +- tests/extensions/test-about-render.lua | 84 +++++++++------------------ tests/extensions/test-auth.lua | 93 ++++++++++-------------------- tests/extensions/test-email-avatar.lua | 3 +- tests/extensions/test-link-commits.lua | 15 ++--- tests/extensions/test-syntax-highlight.lua | 33 ++++------- 7 files changed, 83 insertions(+), 166 deletions(-) (limited to 'tests/extensions') diff --git a/tests/extensions/harness.lua b/tests/extensions/harness.lua index d0299e3..d9318ee 100644 --- a/tests/extensions/harness.lua +++ b/tests/extensions/harness.lua @@ -198,8 +198,7 @@ function harness.stub_auth_modules() new = function(key, algorithm) return { final = function(self, payload) - return fake_digest_bytes(key .. "\1" .. - algorithm .. "\1" .. payload) + return fake_digest_bytes(key .. "\1" .. algorithm .. "\1" .. payload) end, } end, @@ -227,26 +226,21 @@ end function harness.equals(name, got, want) checks = checks + 1 if got ~= want then - fail(name, "wanted " .. tostring(want) .. - "\n got " .. tostring(got)) + fail(name, "wanted " .. tostring(want) .. "\n got " .. tostring(got)) end end function harness.contains(name, haystack, needle) checks = checks + 1 - if type(haystack) ~= "string" - or not haystack:find(needle, 1, true) then - fail(name, "wanted " .. needle .. - "\nwithin " .. tostring(haystack)) + if type(haystack) ~= "string" or not haystack:find(needle, 1, true) then + fail(name, "wanted " .. needle .. "\nwithin " .. tostring(haystack)) end end function harness.excludes(name, haystack, needle) checks = checks + 1 - if type(haystack) ~= "string" - or haystack:find(needle, 1, true) then - fail(name, "did not want " .. needle .. - "\nwithin " .. tostring(haystack)) + if type(haystack) ~= "string" or haystack:find(needle, 1, true) then + fail(name, "did not want " .. needle .. "\nwithin " .. tostring(haystack)) end end diff --git a/tests/extensions/lib.sh b/tests/extensions/lib.sh index f472faf..26fcbec 100644 --- a/tests/extensions/lib.sh +++ b/tests/extensions/lib.sh @@ -64,6 +64,5 @@ repo.url=lua-probe repo.path=$cgit_lua_probe_gitdir repo.commit-filter=lua:$PWD/lua-probe.lua EOF - CGIT_CONFIG="$PWD/lua-probe-cgitrc" QUERY_STRING="url=lua-probe/commit/" \ - cgit | grep -q LUA_PROBE_YES + CGIT_CONFIG="$PWD/lua-probe-cgitrc" QUERY_STRING="url=lua-probe/commit/" cgit | grep -q LUA_PROBE_YES } diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index aa7e6ad..338949a 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -37,8 +37,7 @@ h.contains("no extension renders as plain text", out, h.equals("close answers zero", ret, 0) out = render("notes.txt", "just text") -h.contains("an unknown extension renders as plain text", out, - "
just text
") +h.contains("an unknown extension renders as plain text", out, "
just text
") out = render(nil, "no name at all") h.contains("a missing filename renders as plain text", out, @@ -56,11 +55,9 @@ h.contains("writes are joined before rendering", out, "two writes") if mode == "nolpeg" then out = render("README.md", "# Title") - h.contains("markdown without lpeg falls back to plain text", out, - "
# Title
") + h.contains("markdown without lpeg falls back to plain text", out, "
# Title
") out = render("page.1", ".SH NAME") - h.contains("man without lpeg falls back to plain text", out, - "
.SH NAME
") + h.contains("man without lpeg falls back to plain text", out, "
.SH NAME
") h.finish() end @@ -71,27 +68,22 @@ end -- Markdown. out = render("README.md", "# Title") -h.contains("a heading renders inside the wrapper", - out, "

Title

") +h.contains("a heading renders inside the wrapper", out, "

Title

") out = render("README.md", "## Sub ##") -h.contains("trailing hashes are stripped from a heading", out, - "

Sub

") +h.contains("trailing hashes are stripped from a heading", out, "

Sub

") out = render("README.MD", "# Upper") h.contains("the extension matches whatever its case", out, "

Upper

") out = render("readme.markdown", "# Long") -h.contains("the long markdown extension dispatches too", out, - "

Long

") +h.contains("the long markdown extension dispatches too", out, "

Long

") out = render("README.md", "line one\nline two") -h.contains("a paragraph keeps its line break", out, - "

line one
line two

") +h.contains("a paragraph keeps its line break", out, "

line one
line two

") out = render("README.md", "first para\r\nsecond line") -h.contains("crlf line endings are normalised", out, - "

first para
second line

") +h.contains("crlf line endings are normalised", out, "

first para
second line

") out = render("README.md", "a **bold** and *leaning* word") h.contains("double stars embolden", out, "bold") @@ -105,21 +97,17 @@ out = render("README.md", "run `x < y` here") h.contains("inline code is escaped", out, "x < y") out = render("README.md", "raw here") -h.contains("markup in text reaches the page escaped", out, - "<script>alert(1)</script>") +h.contains("markup in text reaches the page escaped", out, "<script>alert(1)</script>") h.excludes("no live tag slips through", out, "