mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-08 15:33:33 +00:00
142 lines
10 KiB
Lua
142 lines
10 KiB
Lua
|
--
|
|||
|
--
|
|||
|
-- Nicolas Seriot's JSONTestSuite
|
|||
|
-- https://github.com/nst/JSONTestSuite
|
|||
|
-- commit d64aefb55228d9584d3e5b2433f720ea8fd00c82
|
|||
|
--
|
|||
|
-- MIT License
|
|||
|
--
|
|||
|
-- Copyright (c) 2016 Nicolas Seriot
|
|||
|
--
|
|||
|
-- 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:
|
|||
|
--
|
|||
|
-- The above copyright notice and this permission notice shall be included in all
|
|||
|
-- copies or substantial portions of the Software.
|
|||
|
--
|
|||
|
-- 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.
|
|||
|
--
|
|||
|
|
|||
|
|
|||
|
-- these test cases are prefixed with i_
|
|||
|
-- ljson is free to accept or reject,
|
|||
|
-- but we run them anyway to check for segfaults
|
|||
|
|
|||
|
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_structure_UTF-8_BOM_empty_object.json
|
|||
|
assert(nil ~= pcall(DecodeJson, [[ {} ]]))
|
|||
|
|
|||
|
-- 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)
|
|||
|
assert(nil ~= pcall(DecodeJson, [[
|
|||
|
[ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [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] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ]]))
|
|||
|
|
|||
|
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_UTF8_surrogate_U+D800.json
|
|||
|
assert(nil ~= pcall(DecodeJson, [[ ["<22><><EFBFBD>"] ]]))
|
|||
|
|
|||
|
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_UTF-8_invalid_sequence.json
|
|||
|
assert(nil ~= pcall(DecodeJson, [[ ["日ш<E697A5>"] ]]))
|
|||
|
|
|||
|
-- https://github.com/nst/JSONTestSuite/tree/d64aefb55228d9584d3e5b2433f720ea8fd00c82/test_parsing/i_string_UTF-16LE_with_BOM.json
|
|||
|
assert(nil ~= pcall(DecodeJson, [[ <20><>[ |