From 0ddd204a2715415ff1d6c9c69c7c871f17745b62 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 11 Dec 2021 13:39:58 +0100 Subject: util.format: Also handle the %p format added in Lua 5.4 --- spec/util_format_spec.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'spec') 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); -- cgit v1.2.3