diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-03-24 14:28:18 +0100 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-03-24 14:50:27 +0100 |
commit | 379b86fdea9f01c4bbff7fe66dec5a659ae82b27 (patch) | |
tree | e8283b52597b47b493ede5a3df661cee25dbbc0c /tests | |
parent | f893be002aebd215b499b0c72803dd1346f4eb05 (diff) | |
download | fengari-379b86fdea9f01c4bbff7fe66dec5a659ae82b27.tar.gz fengari-379b86fdea9f01c4bbff7fe66dec5a659ae82b27.tar.bz2 fengari-379b86fdea9f01c4bbff7fe66dec5a659ae82b27.zip |
string.format operate on byte array instead of js strings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/single.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/single.lua b/tests/single.lua index f74c096..e206568 100644 --- a/tests/single.lua +++ b/tests/single.lua @@ -138,3 +138,15 @@ if math.tointeger(4611686018427387904) then -- no overflow? (64 bits) assert(tostring(4611686018427387904) == "4611686018427387904") assert(tostring(-4611686018427387904) == "-4611686018427387904") end + +if tostring(0.0) == "0.0" then -- "standard" coercion float->string + assert('' .. 12 == '12' and 12.0 .. '' == '12.0') + assert(tostring(-1203 + 0.0) == "-1203.0") +else -- compatible coercion + assert(tostring(0.0) == "0") + assert('' .. 12 == '12' and 12.0 .. '' == '12') + assert(tostring(-1203 + 0.0) == "-1203") +end + +x = '"ílo"\n\\' +assert(string.format('%q%s', x, x) == '"\\"ílo\\"\\\n\\\\""ílo"\n\\') |