diff options
-rwxr-xr-x | tests/test.lua | 11 |
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 = { | |||
98 | { "Decode string", | 98 | { "Decode string", |
99 | json.decode, { '"test string"' }, true, { "test string" } }, | 99 | json.decode, { '"test string"' }, true, { "test string" } }, |
100 | { "Decode numbers", | 100 | { "Decode numbers", |
101 | json.decode, { '[ 0.0, -5e3, -1, 0.3e-3, 1023.2, 00123, 05.2, 0e10 ]' }, | 101 | json.decode, { '[ 0.0, -5e3, -1, 0.3e-3, 1023.2, 0e10 ]' }, |
102 | true, { { 0.0, -5000, -1, 0.0003, 1023.2, 123, 5.2, 0 } } }, | 102 | true, { { 0.0, -5000, -1, 0.0003, 1023.2, 0 } } }, |
103 | { "Decode null", | 103 | { "Decode null", |
104 | json.decode, { 'null' }, true, { json.null } }, | 104 | json.decode, { 'null' }, true, { json.null } }, |
105 | { "Decode true", | 105 | { "Decode true", |
@@ -219,7 +219,9 @@ local cjson_tests = { | |||
219 | { "Set decode_invalid_numbers(true)", | 219 | { "Set decode_invalid_numbers(true)", |
220 | json.decode_invalid_numbers, { true }, true, { true } }, | 220 | json.decode_invalid_numbers, { true }, true, { true } }, |
221 | { "Decode hexadecimal", | 221 | { "Decode hexadecimal", |
222 | json.decode, { '0x6' }, true, { 6 } }, | 222 | json.decode, { '0x6.ffp1' }, true, { 13.9921875 } }, |
223 | { "Decode numbers with leading zero", | ||
224 | json.decode, { '[ 0123, 00.33 ]' }, true, { { 123, 0.33 } } }, | ||
223 | { "Decode +-Inf", | 225 | { "Decode +-Inf", |
224 | json.decode, { '[ +Inf, Inf, -Inf ]' }, true, { { Inf, Inf, -Inf } } }, | 226 | json.decode, { '[ +Inf, Inf, -Inf ]' }, true, { { Inf, Inf, -Inf } } }, |
225 | { "Decode +-Infinity", | 227 | { "Decode +-Infinity", |
@@ -238,6 +240,9 @@ local cjson_tests = { | |||
238 | { "Decode hexadecimal [throw error]", | 240 | { "Decode hexadecimal [throw error]", |
239 | json.decode, { '0x6' }, | 241 | json.decode, { '0x6' }, |
240 | false, { "Expected value but found invalid number at character 1" } }, | 242 | false, { "Expected value but found invalid number at character 1" } }, |
243 | { "Decode numbers with leading zero [throw error]", | ||
244 | json.decode, { '[ 0123, 00.33 ]' }, | ||
245 | false, { "Expected value but found invalid number at character 3" } }, | ||
241 | { "Decode +-Inf [throw error]", | 246 | { "Decode +-Inf [throw error]", |
242 | json.decode, { '[ +Inf, Inf, -Inf ]' }, | 247 | json.decode, { '[ +Inf, Inf, -Inf ]' }, |
243 | false, { "Expected value but found invalid token at character 3" } }, | 248 | false, { "Expected value but found invalid token at character 3" } }, |