Diff

spec/util_format_spec.lua @ 12985:c0e3e0d79574

util.format: Update tests for serialization changes
author Kim Alvefur <zash@zash.se>
date Sun, 26 Mar 2023 00:49:25 +0100
parent 12571:c4337ff4f1c4
line wrap: on
line diff
--- a/spec/util_format_spec.lua	Sun Mar 26 00:33:20 2023 +0100
+++ b/spec/util_format_spec.lua	Sun Mar 26 00:49:25 2023 +0100
@@ -13,7 +13,7 @@
 			assert.equal("true", format("%s", true));
 			assert.equal("[true]", format("%d", true));
 			assert.equal("% [true]", format("%%", true));
-			assert.equal("{ }", format("%q", { }));
+			assert.equal("{}", format("%q", {}));
 			assert.equal("[1.5]", format("%d", 1.5));
 			assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464));
 		end);
@@ -668,7 +668,7 @@
 
 			describe("to %q", function ()
 				it("works", function ()
-					assert.matches('{__type="function",__error="fail"}', format("%q", function() end))
+					assert.matches('%[%[function: 0[xX]%x+]]', format("%q", function() end))
 				end);
 			end);
 
@@ -767,7 +767,7 @@
 
 			describe("to %q", function ()
 				it("works", function ()
-					assert.matches('{__type="thread",__error="fail"}', format("%q", coroutine.create(function() end)))
+					assert.matches('_%[%[thread: 0[xX]%x+]]', format("%q", coroutine.create(function() end)))
 				end);
 			end);
 
@@ -880,8 +880,8 @@
 
 			describe("to %q", function ()
 				it("works", function ()
-					assert.matches("{ }", format("%q", { }))
-					assert.equal("{ }", format("%q", setmetatable({},{__tostring=function ()return "foo \1\2\3 bar"end})))
+					assert.matches("{}", format("%q", { }))
+					assert.equal("{}", format("%q", setmetatable({},{__tostring=function ()return "foo \1\2\3 bar"end})))
 				end);
 			end);