From c34c0ad9ea78d0a40b0aa0716d9096f961681a97 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 28 Mar 2017 08:06:59 +0200 Subject: Fixed lua_number2strx --- tests/single.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/single.lua b/tests/single.lua index 8ca9fbb..6faf448 100644 --- a/tests/single.lua +++ b/tests/single.lua @@ -170,3 +170,20 @@ assert(string.format("-%.20s.20s", string.rep("%", 2000)) == "-"..string.rep("%", 20)..".20s") assert(string.format('"-%20s.20s"', string.rep("%", 2000)) == string.format("%q", "-"..string.rep("%", 2000)..".20s")) + +do + local function checkQ (v) + local s = string.format("%q", v) + local nv = load("return " .. s)() + assert(v == nv and math.type(v) == math.type(nv)) + end + -- checkQ("\0\0\1\255\u{234}") + -- checkQ(math.maxinteger) + -- checkQ(math.mininteger) + -- checkQ(math.pi) + checkQ(0.1) + -- checkQ(true) + -- checkQ(nil) + -- checkQ(false) + -- checkerror("no literal", string.format, "%q", {}) +end -- cgit v1.2.3-70-g09d2