Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpx/lua-cjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/test.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test.lua b/tests/test.lua
index 1bf8d2b..e0f99f6 100755
--- a/tests/test.lua
+++ b/tests/test.lua
@@ -98,8 +98,8 @@ local cjson_tests = {
{ "Decode string",
json.decode, { '"test string"' }, true, { "test string" } },
{ "Decode numbers",
- json.decode, { '[ 0.0, -5e3, -1, 0.3e-3, 1023.2, 00123, 05.2, 0e10 ]' },
- true, { { 0.0, -5000, -1, 0.0003, 1023.2, 123, 5.2, 0 } } },
+ json.decode, { '[ 0.0, -5e3, -1, 0.3e-3, 1023.2, 0e10 ]' },
+ true, { { 0.0, -5000, -1, 0.0003, 1023.2, 0 } } },
{ "Decode null",
json.decode, { 'null' }, true, { json.null } },
{ "Decode true",
@@ -219,7 +219,9 @@ local cjson_tests = {
{ "Set decode_invalid_numbers(true)",
json.decode_invalid_numbers, { true }, true, { true } },
{ "Decode hexadecimal",
- json.decode, { '0x6' }, true, { 6 } },
+ json.decode, { '0x6.ffp1' }, true, { 13.9921875 } },
+ { "Decode numbers with leading zero",
+ json.decode, { '[ 0123, 00.33 ]' }, true, { { 123, 0.33 } } },
{ "Decode +-Inf",
json.decode, { '[ +Inf, Inf, -Inf ]' }, true, { { Inf, Inf, -Inf } } },
{ "Decode +-Infinity",
@@ -238,6 +240,9 @@ local cjson_tests = {
{ "Decode hexadecimal [throw error]",
json.decode, { '0x6' },
false, { "Expected value but found invalid number at character 1" } },
+ { "Decode numbers with leading zero [throw error]",
+ json.decode, { '[ 0123, 00.33 ]' },
+ false, { "Expected value but found invalid number at character 3" } },
{ "Decode +-Inf [throw error]",
json.decode, { '[ +Inf, Inf, -Inf ]' },
false, { "Expected value but found invalid token at character 3" } },