Make ljson more strict (#482)

This commit is contained in:
Gautham 2022-07-13 15:09:19 +05:30 committed by GitHub
parent 30cc2c8dc1
commit 12d9f7ade6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 116 additions and 131 deletions

View file

@ -130,3 +130,50 @@ assert(not DecodeJson([[
[ "line\
break"]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail4.json
assert(not DecodeJson([[
[ "extra comma",]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail5.json
assert(not DecodeJson([[
[ "double extra comma",,]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail6.json
assert(not DecodeJson([[
[ , "<-- missing value"]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail9.json
assert(not DecodeJson([[
{"Extra comma": true,}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail20.json
assert(not DecodeJson([[
{"Double colon":: null}
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail25.json
assert(not DecodeJson([[
[ " tab character in string "]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail27.json
assert(not DecodeJson([[
[ "line
break"]
]]))
-- https://www.json.org/JSON_checker/test.zip
-- JSON parsing sample test case: fail15.json
assert(not DecodeJson(' ["Illegal backslash escape: \x15"] '))