From 3c80ecb3987237b8bbb4089779c385b7759499bd Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 22:05:39 -1000 Subject: Draw no avatar when luaossl is missing The require at the top raised as cgit loaded the filter, so every page that lists an author stopped at its first author cell with an error. --- tests/extensions/test-email-avatar.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/extensions/test-email-avatar.lua') diff --git a/tests/extensions/test-email-avatar.lua b/tests/extensions/test-email-avatar.lua index 4960ec3..bedcfe8 100644 --- a/tests/extensions/test-email-avatar.lua +++ b/tests/extensions/test-email-avatar.lua @@ -3,8 +3,8 @@ -- two scripts differ only in the service they point at, so the expected host -- is picked from the script's name. The second argument chooses how the -- openssl.digest dependency is met, stub swaps in the deterministic fake --- from the harness, and real uses an installed luaossl and adds the one --- check only a genuine MD5 can pass. +-- from the harness, real uses an installed luaossl and adds the one check +-- only a genuine MD5 can pass, and missing makes the module fail to load. local test_directory = arg[0]:match("^(.*)/") or "." local h = dofile(test_directory .. "/harness.lua") @@ -21,6 +21,8 @@ end if mode == "stub" then h.stub_digest() +elseif mode == "missing" then + h.preload_failure("openssl.digest") end h.load(script) @@ -29,6 +31,13 @@ local function render(email, name) return h.run({ email, "commit" }, { name }) end +if mode == "missing" then + local out, ret = render("", "A U Thor") + h.equals("without luaossl the name stands alone", out, "A U Thor") + h.equals("and close still answers zero", ret, 0) + h.finish() +end + local function hash_of(output) local prefix = base_url:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1") return output:match("src='" .. prefix .. "(%x+)%?") -- cgit