diff options
Diffstat (limited to 'tests/extensions')
-rw-r--r--tests/extensions/test-email-avatar.lua13
1 file changed, 11 insertions, 2 deletions
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("<author@example.com>", "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+)%?")