summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/single.lua17
1 files changed, 17 insertions, 0 deletions
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