cosmopolitan/test/tool/net/jsontestsuite_pass_test.lua

341 lines
18 KiB
Lua
Raw Normal View History

--
2022-07-11 18:54:24 +00:00
-- Nicolas Seriot's JSONTestSuite
-- https://github.com/nst/JSONTestSuite
-- commit d64aefb55228d9584d3e5b2433f720ea8fd00c82
--
2022-07-11 18:54:24 +00:00
-- MIT License
--
2022-07-11 18:54:24 +00:00
-- Copyright (c) 2016 Nicolas Seriot
--
2022-07-11 18:54:24 +00:00
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
2022-07-11 18:54:24 +00:00
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
2022-07-11 18:54:24 +00:00
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--
2022-07-11 18:54:24 +00:00
assert(unix.pledge("stdio"))
2022-07-23 12:22:19 +00:00
2022-07-11 18:54:24 +00:00
-- these test cases are prefixed with y_
-- ljson should accept all of them as valid
2022-07-12 19:30:42 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_lonely_null.json
val, err = DecodeJson([[ null ]])
assert(not val)
assert(val == nil)
assert(err == nil)
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_lonely_false.json
val, err = DecodeJson([[ false ]])
assert(not val)
assert(val == false)
assert(err == nil)
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_whitespace_array.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_true_in_array.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [true] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_trailing_newline.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["a"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_string_empty.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ "" ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_lonely_true.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ true ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_lonely_string.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ "asd" ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_lonely_negative_real.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ -0.1 ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_structure_lonely_int.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ 42 ]]))
2022-07-11 18:54:24 +00:00
2022-07-12 19:30:42 +00:00
-- Raw ASCII DEL allowed in string literals
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_with_del_character.json
2022-07-12 19:30:42 +00:00
assert(DecodeJson(" [\"a\x7fa\"] "))
assert(EncodeJson(DecodeJson(" [\"a\x7fa\"] ")) == '["a\\u007fa"]')
2022-07-11 18:54:24 +00:00
2022-07-12 19:30:42 +00:00
-- EURO SIGN (20AC) and MUSICAL SYMBOL G CLEF (1D11E) in string literal
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_utf8.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["€𝄞"] ]]))
2022-07-12 19:30:42 +00:00
assert(EncodeJson(DecodeJson([[ ["€𝄞"] ]])) == "[\"\\u20ac\\ud834\\udd1e\"]")
assert(EncodeJson(DecodeJson([[ ["€𝄞"] ]])) == EncodeJson(DecodeJson(" [\"\xe2\x82\xac\xf0\x9d\x84\x9e\"] ")))
2022-07-11 18:54:24 +00:00
2022-07-12 19:30:42 +00:00
-- unicode escape for double quote
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_escaped_double_quote.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0022"] ]]))
2022-07-12 19:30:42 +00:00
assert(DecodeJson([[ ["\u0022"] ]])[1] == '"')
2022-07-12 19:30:42 +00:00
-- replacement character
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_U+FFFE_nonchar.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uFFFE"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_U+FDD0_nonchar.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uFDD0"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_U+2064_invisible_plus.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u2064"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u200B"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_U+1FFFE_nonchar.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uD83F\uDFFE"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_U+10FFFE_nonchar.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uDBFF\uDFFE"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode_2.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["⍂㈴⍂"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicodeEscapedBackslash.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u005C"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unicode.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uA66D"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_unescaped_char_delete.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [""] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_uescaped_newline.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["new\u000Aline"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_uEscape.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0061\u30af\u30EA\u30b9"] ]]))
2022-07-12 19:30:42 +00:00
-- paragraph separator trojan source
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_u+2029_par_sep.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [""] ]]))
2022-07-11 18:54:24 +00:00
2022-07-12 19:30:42 +00:00
-- line separator trojan source
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_u+2028_line_sep.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [""] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_two-byte-utf-8.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0123"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_three-byte-utf-8.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0821"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uD834\uDd1e"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_space.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ " " ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_simple_ascii.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["asd "] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_reservedCharacterInUTF-8_U+1BFFF.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["𛿿"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_pi.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["π"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_one-byte-utf-8.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u002c"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_null_escape.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0000"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_nonCharacterInUTF-8_U+FFFF.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["￿"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_nonCharacterInUTF-8_U+10FFFF.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["􏿿"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_nbsp_uescaped.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["new\u00A0line"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_last_surrogates_1_and_2.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uDBFF\uDFFF"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_in_array_with_leading_space.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [ "asd"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_in_array.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["asd"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_escaped_noncharacter.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uFFFF"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_escaped_control_character.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0012"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_double_escape_n.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\\n"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_double_escape_a.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\\a"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_comments.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["a/*b*/c/*d//e"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_backslash_doublequotes.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\""] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_backslash_and_u_escaped_zero.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\\u0000"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_allowed_escapes.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\"\\\/\b\f\n\r\t"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_accepted_surrogate_pairs.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\ud83d\ude39\ud83d\udc8d"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_accepted_surrogate_pair.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\uD801\udc37"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_string_1_2_3_bytes_UTF-8_sequences.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["\u0060\u012a\u12AB"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_with_newlines.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[
2022-07-11 18:54:24 +00:00
{
"a": "b"
} ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_string_unicode.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"title":"\u041f\u043e\u043b\u0442\u043e\u0440\u0430 \u0417\u0435\u043c\u043b\u0435\u043a\u043e\u043f\u0430" } ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_simple.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"a":[]} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_long_strings.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"x":[{"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}], "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_extreme_numbers.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ { "min": -1.0e+28, "max": 1.0e+28 } ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_escaped_null_in_key.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"foo\u0000bar": 42} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_empty_key.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"":0} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_empty.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_duplicated_key_and_value.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"a":"b","a":"b"} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_duplicated_key.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"a":"b","a":"c"} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object_basic.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"asd":"sdf"} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_object.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ {"asd":"sdf", "dfg":"fgh"} ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_simple_real.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [123.456789] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_simple_int.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [123] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_pos_exponent.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1e+2] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_neg_exp.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1e-2] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_fraction_exponent.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [123.456e78] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_exponent.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [123e45] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_capital_e_pos_exp.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1E+2] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_capital_e_neg_exp.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1E-2] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_real_capital_e.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1E22] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_negative_zero.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [-0] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_negative_one.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [-1] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_negative_int.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [-123] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_minus_zero.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [-0] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_int_with_exp.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [20e1] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_double_close_to_zero.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [-0.000000000000000000000000000000000000000000000000000000000000000000000000000001] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_after_space.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [ 4] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_0e1.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [0e1] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number_0e+1.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [0e+1] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_number.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [123e65] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_with_trailing_space.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [2] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_with_several_null.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1,null,null,null,2] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_with_leading_space.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [1] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_with_1_and_newline.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[
2022-07-11 18:54:24 +00:00
[1
] ]]))
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_null.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [null] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_heterogeneous.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [null, 1, "1", {}] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_false.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [false] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_ending_with_newline.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ ["a"] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_empty.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_empty-string.json
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[ [""] ]]))
2022-07-11 18:54:24 +00:00
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/y_array_arraysWithSpaces.json
-- (added spaces between [[ and ]] so lua doesn't get confused)
2022-07-12 06:06:49 +00:00
assert(DecodeJson([[
2022-07-11 18:54:24 +00:00
[ [ ] ] ]]))