aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_format_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-11 13:39:58 +0100
committerKim Alvefur <zash@zash.se>2021-12-11 13:39:58 +0100
commit0ddd204a2715415ff1d6c9c69c7c871f17745b62 (patch)
treef3d9b1003238a1bfc02f8096eaaf7200f16b71c1 /spec/util_format_spec.lua
parent1eca4e8870f69699f7bc9bbd132a7bf64ca70918 (diff)
downloadprosody-0ddd204a2715415ff1d6c9c69c7c871f17745b62.tar.gz
prosody-0ddd204a2715415ff1d6c9c69c7c871f17745b62.zip
util.format: Also handle the %p format added in Lua 5.4
Diffstat (limited to 'spec/util_format_spec.lua')
-rw-r--r--spec/util_format_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util_format_spec.lua b/spec/util_format_spec.lua
index 0e6a36b7..f19697df 100644
--- a/spec/util_format_spec.lua
+++ b/spec/util_format_spec.lua
@@ -25,5 +25,14 @@ describe("util.format", function()
assert.equal("\"Hello w\\195rld\"", format("%s", "Hello w\195rld"));
end);
+ if _VERSION >= "Lua 5.4" then
+ it("handles %p formats", function ()
+ assert.matches("a 0x%x+ b", format("%s %p %s", "a", {}, "b"));
+ end)
+ else
+ it("does something with %p formats", function ()
+ assert.string(format("%p", {}));
+ end)
+ end
end);
end);