Fix quote escapes in JSON tests (#481)

This commit is contained in:
Gautham 2022-07-12 06:34:51 +05:30 committed by GitHub
parent 0272f638a5
commit 3c10fb5580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 178 additions and 261 deletions

View file

@ -31,172 +31,168 @@
-- ljson should reject all of them as invalid
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_no-colon.json
assert(false == pcall(DecodeJson, [[ {"a" ]]))
assert(false == pcall(DecodeJson, ' {"a" '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_missing_value.json
assert(false == pcall(DecodeJson, [[ {"a": ]]))
assert(false == pcall(DecodeJson, ' {"a": '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_missing_key.json
assert(false == pcall(DecodeJson, [[ {:"b"} ]]))
assert(false == pcall(DecodeJson, ' {:"b"} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_missing_colon.json
assert(false == pcall(DecodeJson, [[ {"a" b} ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_lone_continuation_byte_in_key_and_trailing_comma.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\x22\xb9\x22\x3a\x22\x30\x22\x2c\x7d ]]))
assert(false == pcall(DecodeJson, ' {"a" b} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_key_with_single_quotes.json
assert(false == pcall(DecodeJson, [[ {key: 'value'} ]]))
assert(false == pcall(DecodeJson, ' {key: \'value\'} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_garbage_at_end.json
assert(false == pcall(DecodeJson, [[ {"a":"a" 123} ]]))
assert(false == pcall(DecodeJson, ' {"a":"a" 123} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_emoji.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\xf0\x9f\x87\xa8\xf0\x9f\x87\xad\x7d ]]))
assert(false == pcall(DecodeJson, ' \x7b\xf0\x9f\x87\xa8\xf0\x9f\x87\xad\x7d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_bracket_key.json
assert(false == pcall(DecodeJson, [[ {[: "x"} ]]))
assert(false == pcall(DecodeJson, ' {[: "x"} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_with_alpha_char.json
assert(false == pcall(DecodeJson, [[ [1.8011670033376514H-308] ]]))
assert(false == pcall(DecodeJson, ' [1.8011670033376514H-308] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_with_alpha.json
assert(false == pcall(DecodeJson, [[ [1.2a-3] ]]))
assert(false == pcall(DecodeJson, ' [1.2a-3] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_starting_with_dot.json
assert(false == pcall(DecodeJson, [[ [.123] ]]))
assert(false == pcall(DecodeJson, ' [.123] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_real_with_invalid_utf8_after_e.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x31\x65\xe5\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x31\x65\xe5\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_real_garbage_after_e.json
assert(false == pcall(DecodeJson, [[ [1ea] ]]))
assert(false == pcall(DecodeJson, ' [1ea] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_neg_with_garbage_at_end.json
assert(false == pcall(DecodeJson, [[ [-1x] ]]))
assert(false == pcall(DecodeJson, ' [-1x] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_neg_real_without_int_part.json
assert(false == pcall(DecodeJson, [[ [-.123] ]]))
assert(false == pcall(DecodeJson, ' [-.123] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_minus_sign_with_trailing_garbage.json
assert(false == pcall(DecodeJson, [[ [-foo] ]]))
assert(false == pcall(DecodeJson, ' [-foo] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_minus_infinity.json
assert(false == pcall(DecodeJson, [[ [-Infinity] ]]))
assert(false == pcall(DecodeJson, ' [-Infinity] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_invalid-utf-8-in-int.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x30\xe5\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x30\xe5\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_invalid-utf-8-in-exponent.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x31\x65\x31\xe5\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x31\x65\x31\xe5\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_invalid-utf-8-in-bigger-int.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x31\x32\x33\xe5\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x31\x32\x33\xe5\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_invalid-negative-real.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x2d\x31\x32\x33\x2e\x31\x32\x33\x66\x6f\x6f\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x2d\x31\x32\x33\x2e\x31\x32\x33\x66\x6f\x6f\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_invalid+-.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x30\x65\x2b\x2d\x31\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x30\x65\x2b\x2d\x31\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_infinity.json
assert(false == pcall(DecodeJson, [[ [Infinity] ]]))
assert(false == pcall(DecodeJson, ' [Infinity] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_hex_2_digits.json
assert(false == pcall(DecodeJson, [[ [0x42] ]]))
assert(false == pcall(DecodeJson, ' [0x42] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_hex_1_digit.json
assert(false == pcall(DecodeJson, [[ [0x1] ]]))
assert(false == pcall(DecodeJson, ' [0x1] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_expression.json
assert(false == pcall(DecodeJson, [[ [1+2] ]]))
assert(false == pcall(DecodeJson, ' [1+2] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_U+FF11_fullwidth_digit_one.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\xef\xbc\x91\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\xef\xbc\x91\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_NaN.json
assert(false == pcall(DecodeJson, [[ [NaN] ]]))
assert(false == pcall(DecodeJson, ' [NaN] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_Inf.json
assert(false == pcall(DecodeJson, [[ [Inf] ]]))
assert(false == pcall(DecodeJson, ' [Inf] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_9.e+.json
assert(false == pcall(DecodeJson, [[ [9.e+] ]]))
assert(false == pcall(DecodeJson, ' [9.e+] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_1eE2.json
assert(false == pcall(DecodeJson, [[ [1eE2] ]]))
assert(false == pcall(DecodeJson, ' [1eE2] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_1.0e.json
assert(false == pcall(DecodeJson, [[ [1.0e] ]]))
assert(false == pcall(DecodeJson, ' [1.0e] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_1.0e-.json
assert(false == pcall(DecodeJson, [[ [1.0e-] ]]))
assert(false == pcall(DecodeJson, ' [1.0e-] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_1.0e+.json
assert(false == pcall(DecodeJson, [[ [1.0e+] ]]))
assert(false == pcall(DecodeJson, ' [1.0e+] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0e.json
assert(false == pcall(DecodeJson, [[ [0e] ]]))
assert(false == pcall(DecodeJson, ' [0e] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0e+.json
assert(false == pcall(DecodeJson, [[ [0e+] ]]))
assert(false == pcall(DecodeJson, ' [0e+] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0_capital_E.json
assert(false == pcall(DecodeJson, [[ [0E] ]]))
assert(false == pcall(DecodeJson, ' [0E] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0_capital_E+.json
assert(false == pcall(DecodeJson, [[ [0E+] ]]))
assert(false == pcall(DecodeJson, ' [0E+] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0.3e.json
assert(false == pcall(DecodeJson, [[ [0.3e] ]]))
assert(false == pcall(DecodeJson, ' [0.3e] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0.3e+.json
assert(false == pcall(DecodeJson, [[ [0.3e+] ]]))
assert(false == pcall(DecodeJson, ' [0.3e+] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_0.1.2.json
assert(false == pcall(DecodeJson, [[ [0.1.2] ]]))
assert(false == pcall(DecodeJson, ' [0.1.2] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_.2e-3.json
assert(false == pcall(DecodeJson, [[ [.2e-3] ]]))
assert(false == pcall(DecodeJson, ' [.2e-3] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_.-1.json
assert(false == pcall(DecodeJson, [[ [.-1] ]]))
assert(false == pcall(DecodeJson, ' [.-1] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_-NaN.json
assert(false == pcall(DecodeJson, [[ [-NaN] ]]))
assert(false == pcall(DecodeJson, ' [-NaN] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_-1.0..json
assert(false == pcall(DecodeJson, [[ [-1.0.] ]]))
assert(false == pcall(DecodeJson, ' [-1.0.] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_+Inf.json
assert(false == pcall(DecodeJson, [[ [+Inf] ]]))
assert(false == pcall(DecodeJson, ' [+Inf] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_+1.json
assert(false == pcall(DecodeJson, [[ [+1] ]]))
assert(false == pcall(DecodeJson, ' [+1] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_number_++.json
assert(false == pcall(DecodeJson, [[ [++1234] ]]))
assert(false == pcall(DecodeJson, ' [++1234] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_incomplete_true.json
assert(false == pcall(DecodeJson, [[ [tru] ]]))
assert(false == pcall(DecodeJson, ' [tru] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_incomplete_null.json
assert(false == pcall(DecodeJson, [[ [nul] ]]))
assert(false == pcall(DecodeJson, ' [nul] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_incomplete_false.json
assert(false == pcall(DecodeJson, [[ [fals] ]]))
assert(false == pcall(DecodeJson, ' [fals] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_unclosed_with_object_inside.json
assert(false == pcall(DecodeJson, [[ [{} ]]))
assert(false == pcall(DecodeJson, ' [{} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_unclosed_with_new_lines.json
assert(false == pcall(DecodeJson, [[
@ -205,17 +201,17 @@ assert(false == pcall(DecodeJson, [[
,1 ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_unclosed_trailing_comma.json
assert(false == pcall(DecodeJson, [[ [1, ]]))
assert(false == pcall(DecodeJson, ' [1, '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_unclosed.json
assert(false == pcall(DecodeJson, [[ ["" ]]))
assert(false == pcall(DecodeJson, ' ["" '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_star_inside.json
assert(false == pcall(DecodeJson, [[ [*] ]]))
assert(false == pcall(DecodeJson, ' [*] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_spaces_vertical_tab_formfeed.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\xb\x61\x22\x5c\x66\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x22\x0b\x61\x22\x5c\x66\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_newlines_unclosed.json
assert(false == pcall(DecodeJson, [[
@ -224,22 +220,22 @@ assert(false == pcall(DecodeJson, [[
,1, ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_items_separated_by_semicolon.json
assert(false == pcall(DecodeJson, [[ [1:2] ]]))
assert(false == pcall(DecodeJson, ' [1:2] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_invalid_utf8.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\xff\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\xff\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_incomplete_invalid_value.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x78 ]]))
assert(false == pcall(DecodeJson, ' \x5b\x78 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_incomplete.json
assert(false == pcall(DecodeJson, [[ ["x" ]]))
assert(false == pcall(DecodeJson, ' ["x" '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_colon_instead_of_comma.json
assert(false == pcall(DecodeJson, [[ ["": 1] ]]))
assert(false == pcall(DecodeJson, ' ["": 1] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_array_a_invalid_utf8.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x61\xe5\x5d ]]))
assert(false == pcall(DecodeJson, ' \x5b\x61\xe5\x5d '))

View file

@ -32,127 +32,125 @@
-- ljson should reject all of them as invalid
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_whitespace_formfeed.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\xc\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x0c\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_whitespace_U+2060_word_joiner.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\xe2\x81\xa0\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\xe2\x81\xa0\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_unicode-identifier.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \xc3\xa5 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \xc3\xa5 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_unclosed_object.json
assert(false == pcall(DecodeJson, [[ {"asd":"asd" ]]))
assert(false == pcall(DecodeJson, ' {"asd":"asd" '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_unclosed_array_unfinished_true.json
assert(false == pcall(DecodeJson, [[ [ false, tru ]]))
assert(false == pcall(DecodeJson, ' [ false, tru '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_unclosed_array_unfinished_false.json
assert(false == pcall(DecodeJson, [[ [ true, fals ]]))
assert(false == pcall(DecodeJson, ' [ true, fals '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_unclosed_array_partial_null.json
assert(false == pcall(DecodeJson, [[ [ false, nul ]]))
assert(false == pcall(DecodeJson, ' [ false, nul '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_unclosed_array.json
assert(false == pcall(DecodeJson, [[ [1 ]]))
assert(false == pcall(DecodeJson, ' [1 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_uescaped_LF_before_string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x5c\x75\x30\x30\x30\x41\x22\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x5c\x75\x30\x30\x30\x41\x22\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_single_star.json
assert(false == pcall(DecodeJson, [[ * ]]))
assert(false == pcall(DecodeJson, ' * '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_single_eacute.json
assert(false == pcall(DecodeJson, [[ é ]]))
assert(false == pcall(DecodeJson, ' é '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_open.json
assert(false == pcall(DecodeJson, [[ ["\{["\{["\{["\{ ]]))
assert(false == pcall(DecodeJson, [[ ["{["{["{["{ ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_object_string_with_apostrophes.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\x27\x61\x27 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x7b\x27\x61\x27 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_object_open_string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\x22\x61 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x7b\x22\x61 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_object_open_array.json
assert(false == pcall(DecodeJson, [[ {[ ]]))
assert(false == pcall(DecodeJson, ' {[ '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_object_comma.json
assert(false == pcall(DecodeJson, [[ {, ]]))
assert(false == pcall(DecodeJson, ' {, '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_object_close_array.json
assert(false == pcall(DecodeJson, [[ {] ]]))
assert(false == pcall(DecodeJson, ' {] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_object.json
assert(false == pcall(DecodeJson, [[ { ]]))
assert(false == pcall(DecodeJson, ' { '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_array_string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x61\x22 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x61\x22 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_array_open_string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x61 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x61 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_array_open_object.json
assert(false == pcall(DecodeJson, [[ [{ ]]))
assert(false == pcall(DecodeJson, ' [{ '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_array_comma.json
assert(false == pcall(DecodeJson, [[ [, ]]))
assert(false == pcall(DecodeJson, ' [, '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_open_array_apostrophe.json
assert(false == pcall(DecodeJson, [[ [' ]]))
assert(false == pcall(DecodeJson, ' [\' '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_object_with_comment.json
assert(false == pcall(DecodeJson, [[ {"a":/*comment*/"b"} ]]))
assert(false == pcall(DecodeJson, ' {"a":/*comment*/"b"} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_object_unclosed_no_value.json
assert(false == pcall(DecodeJson, [[ {"": ]]))
assert(false == pcall(DecodeJson, ' {"": '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_null-byte-outside-string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x0\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x00\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_lone-open-bracket.json
assert(false == pcall(DecodeJson, [[ [ ]]))
assert(false == pcall(DecodeJson, ' [ '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_lone-invalid-utf-8.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \xe5 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \xe5 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_incomplete_UTF8_BOM.json
assert(false == pcall(DecodeJson, [[ ï»{} ]]))
assert(false == pcall(DecodeJson, ' ï»{} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_comma_instead_of_closing_brace.json
assert(false == pcall(DecodeJson, [[ {"x": true, ]]))
assert(false == pcall(DecodeJson, ' {"x": true, '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_capitalized_True.json
assert(false == pcall(DecodeJson, [[ [True] ]]))
assert(false == pcall(DecodeJson, ' [True] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_ascii-unicode-identifier.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x61\xc3\xa5 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x61\xc3\xa5 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_array_with_unclosed_string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x61\x73\x64\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x61\x73\x64\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_angle_bracket_null.json
assert(false == pcall(DecodeJson, [[ [<null>] ]]))
assert(false == pcall(DecodeJson, ' [<null>] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_angle_bracket_..json
assert(false == pcall(DecodeJson, [[ <.> ]]))
assert(false == pcall(DecodeJson, ' <.> '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_UTF8_BOM_no_data.json
assert(false == pcall(DecodeJson, [[  ]]))
assert(false == pcall(DecodeJson, '  '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_structure_U+2060_word_joined.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\xe2\x81\xa0\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\xe2\x81\xa0\x5d '))

View file

@ -5663,5 +5663,3 @@ assert(false == pcall(DecodeJson, [[
[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [
[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [
]]))

View file

@ -30,144 +30,70 @@
-- these test cases are prefixed with n_
-- ljson should reject all of them as invalid
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_with_trailing_garbage.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x22\x22\x78 ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_unicode_CapitalU.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x22\x5c\x55\x41\x36\x36\x44\x22 ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_unescaped_tab.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x9\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_unescaped_newline.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x6e\x65\x77\xa\x6c\x69\x6e\x65\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_unescaped_ctrl_char.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x61\x0\x61\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_start_escape_unclosed.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x5c '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_single_string_no_double_quotes.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x61\x62\x63 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x61\x62\x63 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_single_quote.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x27\x73\x69\x6e\x67\x6c\x65\x20\x71\x75\x6f\x74\x65\x27\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_single_doublequote.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x22 ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x27\x73\x69\x6e\x67\x6c\x65\x20\x71\x75\x6f\x74\x65\x27\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_no_quotes_with_bad_escape.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x5c\x6e\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x5c\x6e\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_leading_uescaped_thinspace.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x5c\x75\x30\x30\x32\x30\x22\x61\x73\x64\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_invalid_utf8_after_escape.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\xe5\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_invalid_unicode_escape.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x71\x71\x71\x71\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_invalid_backslash_esc.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x61\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_invalid-utf-8-in-escape.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\xe5\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x5c\x75\x30\x30\x32\x30\x22\x61\x73\x64\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_incomplete_surrogate_escape_invalid.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x44\x38\x30\x30\x5c\x78\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_incomplete_surrogate.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x33\x34\x5c\x75\x44\x64\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_incomplete_escaped_character.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x30\x30\x41\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x44\x38\x30\x30\x5c\x78\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_incomplete_escape.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_escaped_emoji.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\xf0\x9f\x8c\x80\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_escaped_ctrl_char_tab.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x9\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x5c\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_escaped_backslash_bad.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x5c\x5c\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x5c\x5c\x5c\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_escape_x.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x78\x30\x30\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_backslash_00.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x0\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x5c\x78\x30\x30\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_accentuated_char_no_quotes.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\xc3\xa9\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_1_surrogate_then_escape_u1x.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x31\x78\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_1_surrogate_then_escape_u1.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x31\x22\x5d ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_1_surrogate_then_escape_u.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\xc3\xa9\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_string_1_surrogate_then_escape.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x22\x5d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_with_single_string.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\x20\x22\x66\x6f\x6f\x22\x20\x3a\x20\x22\x62\x61\x72\x22\x2c\x20\x22\x61\x22\x20\x7d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x7b\x20\x22\x66\x6f\x6f\x22\x20\x3a\x20\x22\x62\x61\x72\x22\x2c\x20\x22\x61\x22\x20\x7d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_unterminated-value.json
assert(false == pcall(DecodeJson, [[ {"a":"a ]]))
assert(false == pcall(DecodeJson, ' {"a":"a '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_unquoted_key.json
assert(false == pcall(DecodeJson, [[ {a: "b"} ]]))
assert(false == pcall(DecodeJson, ' {a: "b"} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_single_quote.json
assert(false == pcall(DecodeJson, [[ {'a':0} ]]))
assert(false == pcall(DecodeJson, ' {\'a\':0} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_repeated_null_null.json
assert(false == pcall(DecodeJson, [[ {null:null,null:null} ]]))
assert(false == pcall(DecodeJson, ' {null:null,null:null} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_non_string_key_but_huge_number_instead.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\x39\x39\x39\x39\x45\x39\x39\x39\x39\x3a\x31\x7d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x7b\x39\x39\x39\x39\x45\x39\x39\x39\x39\x3a\x31\x7d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/n_object_non_string_key.json
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, [[ \x7b\x31\x3a\x31\x7d ]]))
-- (converted to binary for safety)
assert(false == pcall(DecodeJson, ' \x7b\x31\x3a\x31\x7d '))

View file

@ -34,7 +34,7 @@
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_structure_UTF-8_BOM_empty_object.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \xef\xbb\xbf{} ]]))
assert(nil ~= pcall(DecodeJson, ' \xef\xbb\xbf{} '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_structure_500_nested_arrays.json
-- (added spaces between [[ and ]] so lua doesn't get confused)
@ -67,124 +67,123 @@ assert(nil ~= pcall(DecodeJson, [[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_utf16LE_no_BOM.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x0\x22\x0\xe9\x0\x22\x0\x5d\x0 ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x00\x22\x00\xe9\x00\x22\x00\x5d\x00 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_utf16BE_no_BOM.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x0\x5b\x0\x22\x0\xe9\x0\x22\x0\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x00\x5b\x00\x22\x00\xe9\x00\x22\x00\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_truncated-utf-8.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xe0\xff\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xe0\xff\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_overlong_sequence_6_bytes_null.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xfc\x80\x80\x80\x80\x80\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xfc\x80\x80\x80\x80\x80\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_overlong_sequence_6_bytes.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xfc\x83\xbf\xbf\xbf\xbf\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xfc\x83\xbf\xbf\xbf\xbf\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_overlong_sequence_2_bytes.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xc0\xaf\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xc0\xaf\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_not_in_unicode_range.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xf4\xbf\xbf\xbf\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xf4\xbf\xbf\xbf\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_lone_utf8_continuation_byte.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x81\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x81\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_lone_second_surrogate.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x46\x41\x41\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x46\x41\x41\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_iso_latin_1.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xe9\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xe9\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_inverted_surrogates_U+1D11E.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x64\x31\x65\x5c\x75\x44\x38\x33\x34\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x64\x31\x65\x5c\x75\x44\x38\x33\x34\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_invalid_utf-8.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xff\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xff\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_invalid_surrogate.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x64\x38\x30\x30\x61\x62\x63\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x64\x38\x30\x30\x61\x62\x63\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_invalid_lonely_surrogate.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x64\x38\x30\x30\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x64\x38\x30\x30\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_incomplete_surrogates_escape_valid.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x44\x38\x30\x30\x5c\x6e\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x75\x44\x38\x30\x30\x5c\x6e\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_incomplete_surrogate_pair.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x64\x31\x65\x61\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x64\x31\x65\x61\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_incomplete_surrogate_and_escape_valid.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x6e\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x38\x30\x30\x5c\x6e\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_UTF8_surrogate_U+D800.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xed\xa0\x80\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xed\xa0\x80\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_UTF-8_invalid_sequence.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\xe6\x97\xa5\xd1\x88\xfa\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\xe6\x97\xa5\xd1\x88\xfa\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_UTF-16LE_with_BOM.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \xff\xfe\x5b\x0\x22\x0\xe9\x0\x22\x0\x5d\x0 ]]))
assert(nil ~= pcall(DecodeJson, ' \xff\xfe\x5b\x00\x22\x00\xe9\x00\x22\x00\x5d\x00 '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_1st_valid_surrogate_2nd_invalid.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x38\x38\x38\x5c\x75\x31\x32\x33\x34\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x38\x38\x38\x5c\x75\x31\x32\x33\x34\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_1st_surrogate_but_2nd_missing.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x5b\x22\x5c\x75\x44\x41\x44\x41\x22\x5d ]]))
assert(nil ~= pcall(DecodeJson, ' \x5b\x22\x5c\x75\x44\x41\x44\x41\x22\x5d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_object_key_lone_2nd_surrogate.json
-- (converted to binary for safety)
assert(nil ~= pcall(DecodeJson, [[ \x7b\x22\x5c\x75\x44\x46\x41\x41\x22\x3a\x30\x7d ]]))
assert(nil ~= pcall(DecodeJson, ' \x7b\x22\x5c\x75\x44\x46\x41\x41\x22\x3a\x30\x7d '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_very_big_negative_int.json
assert(nil ~= pcall(DecodeJson, [[ [-237462374673276894279832749832423479823246327846] ]]))
assert(nil ~= pcall(DecodeJson, ' [-237462374673276894279832749832423479823246327846] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_too_big_pos_int.json
assert(nil ~= pcall(DecodeJson, [[ [100000000000000000000] ]]))
assert(nil ~= pcall(DecodeJson, ' [100000000000000000000] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_too_big_neg_int.json
assert(nil ~= pcall(DecodeJson, [[ [-123123123123123123123123123123] ]]))
assert(nil ~= pcall(DecodeJson, ' [-123123123123123123123123123123] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_real_underflow.json
assert(nil ~= pcall(DecodeJson, [[ [123e-10000000] ]]))
assert(nil ~= pcall(DecodeJson, ' [123e-10000000] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_real_pos_overflow.json
assert(nil ~= pcall(DecodeJson, [[ [123123e100000] ]]))
assert(nil ~= pcall(DecodeJson, ' [123123e100000] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_real_neg_overflow.json
assert(nil ~= pcall(DecodeJson, [[ [-123123e100000] ]]))
assert(nil ~= pcall(DecodeJson, ' [-123123e100000] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_pos_double_huge_exp.json
assert(nil ~= pcall(DecodeJson, [[ [1.5e+9999] ]]))
assert(nil ~= pcall(DecodeJson, ' [1.5e+9999] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_neg_int_huge_exp.json
assert(nil ~= pcall(DecodeJson, [[ [-1e+9999] ]]))
assert(nil ~= pcall(DecodeJson, ' [-1e+9999] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_huge_exp.json
assert(nil ~= pcall(DecodeJson, [[ [0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] ]]))
assert(nil ~= pcall(DecodeJson, ' [0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] '))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_number_double_huge_neg_exp.json
assert(nil ~= pcall(DecodeJson, [[ [123.456e-789] ]]))
assert(nil ~= pcall(DecodeJson, ' [123.456e-789] '))