aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-28 08:06:59 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-03-28 08:06:59 +0200
commitc34c0ad9ea78d0a40b0aa0716d9096f961681a97 (patch)
tree3451d42383a1135cfab0094c53cdf67b6db2c501 /tests
parent245e582eaad5293fc5b8d4620d140a527c3b42c4 (diff)
downloadfengari-c34c0ad9ea78d0a40b0aa0716d9096f961681a97.tar.gz
fengari-c34c0ad9ea78d0a40b0aa0716d9096f961681a97.tar.bz2
fengari-c34c0ad9ea78d0a40b0aa0716d9096f961681a97.zip
Fixed lua_number2strx
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