cosmopolitan/test/tool/net/samples/jsonorg-fail.lua

133 lines
3.2 KiB
Lua
Raw Normal View History

2022-07-11 18:54:24 +00:00
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail11.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
{"Illegal expression": 1 + 2}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail12.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
{"Illegal invocation": alert()}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail13.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
{"Numbers cannot have leading zeroes": 013}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail14.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
{"Numbers cannot be hex": 0x14}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail16.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ \naked]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail17.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ "Illegal backslash escape: \017"]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail22.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ "Colon instead of comma": false]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail23.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ "Bad value", truth]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail24.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ 'single quote']
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail29.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ 0e]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail2.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ "Unclosed array"
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail30.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ 0e+]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail31.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ 0e+-1]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail32.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
{"Comma instead if closing brace": true,
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail33.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
[ "mismatch"}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail3.json
2022-07-12 06:06:49 +00:00
assert(not DecodeJson([[
2022-07-11 18:54:24 +00:00
{unquoted_key: "keys must be quoted"}
]]))
2022-07-12 06:06:49 +00:00
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail21.json
assert(not DecodeJson([[
{"Comma instead of colon", null}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail8.json
assert(not DecodeJson([[
[ "Extra close"] ]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail7.json
assert(not DecodeJson([[
[ "Comma after the close"] ,
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail10.json
assert(not DecodeJson([[
{"Extra value after close": true} "misplaced quoted value"
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail26.json
assert(not DecodeJson([[
[ "tab\ character\ in\ string\ "]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail28.json
assert(not DecodeJson([[
[ "line\
break"]
]]))