From 7fc84f6abaac95b4c67a8fed500e5971106609d8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 2 Nov 2026 20:49:31 -1000 Subject: Name a missing Lua module in the error log --- tests/extensions/test-about-render.lua | 7 +++++++ tests/extensions/test-email-avatar.lua | 6 ++++++ tests/extensions/test-syntax-highlight.lua | 4 ++++ 3 files changed, 17 insertions(+) (limited to 'tests/extensions') diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index 95e95bb..45cc5b3 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -24,6 +24,13 @@ end h.load(script) +-- A missing lpeg is written to the error log as the script loads. +if mode == "nolpeg" then + h.contains("a missing lpeg is named in the error log", h.error_log(), "Unable to load lpeg") +elseif has_lpeg then + h.equals("with lpeg the error log stays empty", h.error_log(), "") +end + local function render(filename, text) return h.run({ filename }, { text }) end diff --git a/tests/extensions/test-email-avatar.lua b/tests/extensions/test-email-avatar.lua index 3f14eac..aa021e2 100644 --- a/tests/extensions/test-email-avatar.lua +++ b/tests/extensions/test-email-avatar.lua @@ -26,6 +26,12 @@ end h.load(script) +if mode == "missing" then + h.contains("a missing luaossl is named in the error log", h.error_log(), "Unable to load openssl.digest") +else + h.equals("with luaossl the error log stays empty", h.error_log(), "") +end + local function render(email, name) return h.run({ email, "commit" }, { name }) end diff --git a/tests/extensions/test-syntax-highlight.lua b/tests/extensions/test-syntax-highlight.lua index a0debc6..8acbf91 100644 --- a/tests/extensions/test-syntax-highlight.lua +++ b/tests/extensions/test-syntax-highlight.lua @@ -23,9 +23,12 @@ if mode == "nolexers" then local out, ret = render("hello.fake", "if 42") h.equals("without lexers source is served escaped", out, "if 42") h.equals("close answers zero", ret, 0) + h.contains("and the error log says the lexers would not load", h.error_log(), + "Unable to load the Scintillua lexers") out = render("hello.fake", "a & c") h.equals("the fallback escapes markup", out, "a <b> & c") + h.equals("and the error log hears of it only once", h.error_log(), "") -- Large output leaves in slices, and a byte lost at a boundary would -- put the line numbers beside it out of step, so the whole escaped @@ -48,6 +51,7 @@ if mode == "nolexers" then end local out, ret = render("hello.fake", "if 42 'hi' & zz") +h.equals("loaded lexers leave the error log empty", h.error_log(), "") h.contains("keywords are wrapped in their class", out, "if") h.contains("numbers are wrapped in their class", out, "42") h.contains("a dotted tag maps by its first component", out, "'hi'") -- cgit 2.12.1