jsonparse: Add basic JSON parser
Some TODO's left and this needs benchmarking.
This commit is contained in:
parent
aebe5a93dc
commit
7cdc02e399
8 changed files with 508 additions and 21 deletions
|
|
@ -31,11 +31,9 @@ my @tests = (
|
|||
"\x01é\r\n\x1f💩", '"\u0001é\r\n\u001f💩"',
|
||||
)},
|
||||
|
||||
do { use bytes; (
|
||||
"\x011\r\n\x8c", "\"\\u00011\\r\\n\x8c\"",
|
||||
"\xff\xff", "\"\xff\xff\"",
|
||||
"\x{1f4a9}", do { use utf8; '"💩"' },
|
||||
)},
|
||||
"\x011\r\n\x8c", "\"\\u00011\\r\\n\x8c\"",
|
||||
"\xff\xff", "\"\xff\xff\"",
|
||||
"\x{1f4a9}", do { use utf8; '"💩"' },
|
||||
|
||||
[], '[]',
|
||||
[0,1], '[0,1]',
|
||||
|
|
@ -63,6 +61,8 @@ my @errors = (
|
|||
*STDOUT, qr/unable to format unknown value/,
|
||||
'NaN'+0, qr/unable to format floating point NaN or Inf as JSON/,
|
||||
'Inf'+0, qr/unable to format floating point NaN or Inf as JSON/,
|
||||
"\x{D83D}", qr/invalid codepoint encountered in string/,
|
||||
"\x{DE03}", qr/invalid codepoint encountered in string/,
|
||||
do { no warnings 'portable'; "\x{ffffffff}" }, qr/invalid codepoint encountered in string/,
|
||||
do { my $o = {}; bless $o, 'FU::Whatever' }, qr/unable to format 'FU::Whatever' object as JSON/,
|
||||
do { my $o = {}; bless $o, 'MyToJSONSelf' }, qr/MyToJSONSelf::TO_JSON method returned same object as was passed instead of a new one/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue