diff options
author | gregor herrmann <gregoa@debian.org> | 2022-07-18 16:52:53 +0200 |
---|---|---|
committer | gregor herrmann <gregoa@debian.org> | 2022-07-18 16:52:53 +0200 |
commit | c931619c80a36c5c5066ea7c0ada2e3e982084b4 (patch) | |
tree | 573e0ece05a0e923c5ea3606cc5c5da42f2faf60 | |
parent | 12e30082a547ba75545e41487ce415a7aefae37f (diff) | |
parent | abdd48005c1ecb162b53b7fb3ead69d4bc57268e (diff) |
Update upstream source from tag 'upstream/0.62'
Update to upstream version '0.62'
with Debian dir 9f42e9f31d9bcc0f5d26a62b58dc099255f9daa7
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | META.json | 6 | ||||
-rw-r--r-- | META.yml | 4 | ||||
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | json-entry-points.c | 1 | ||||
-rw-r--r-- | json-perl.c | 2 | ||||
-rw-r--r-- | lib/JSON/Parse.pm | 20 | ||||
-rw-r--r-- | lib/JSON/Parse.pod | 107 | ||||
-rw-r--r-- | lib/JSON/Tokenize.pm | 18 | ||||
-rw-r--r-- | lib/JSON/Tokenize.pod | 6 | ||||
-rw-r--r-- | lib/JSON/Whitespace.pm | 2 | ||||
-rw-r--r-- | lib/JSON/Whitespace.pod | 6 | ||||
-rwxr-xr-x | script/validjson | 4 | ||||
-rw-r--r-- | t/tokenize-bug.t | 14 | ||||
-rw-r--r-- | t/u-in-key.t | 17 | ||||
-rw-r--r-- | unicode.c | 3 |
17 files changed, 159 insertions, 67 deletions
@@ -1,3 +1,7 @@ +0.62 2022-07-16 + +* Bug fix for tokenize with backslash-double quote + 0.61 2021-02-11 * Add upgrade_utf8 method @@ -57,6 +57,8 @@ t/syntax-error-1.json t/syntax.t t/test-empty-string.t t/test.json +t/tokenize-bug.t +t/u-in-key.t t/unicode.t t/upgrade-utf8.t t/utf8.t @@ -4,7 +4,7 @@ "Ben Bullock <bkb@cpan.org>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -53,6 +53,6 @@ "web" : "https://github.com/benkasminbullock/JSON-Parse" } }, - "version" : "0.61", - "x_serialization_backend" : "JSON::PP version 4.04" + "version" : "0.62", + "x_serialization_backend" : "JSON::PP version 4.06" } @@ -7,7 +7,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,5 +27,5 @@ requires: resources: bugtracker: https://github.com/benkasminbullock/JSON-Parse/issues repository: git://github.com/benkasminbullock/JSON-Parse.git -version: '0.61' +version: '0.62' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' @@ -6,7 +6,7 @@ -This is the README for JSON::Parse version 0.61. +This is the README for JSON::Parse version 0.62. JSON::Parse is a "module" for the Perl computer programming language, a library of computer code to install on a computer. This document contains @@ -75,11 +75,11 @@ If you have the App::cpanminus installer, you may prefer cpanm JSON::Parse -To install the module from the source file, JSON-Parse-0.61.tar.gz, follow +To install the module from the source file, JSON-Parse-0.62.tar.gz, follow this sequence of commands: - tar xfz JSON-Parse-0.61.tar.gz - cd JSON-Parse-0.61 + tar xfz JSON-Parse-0.62.tar.gz + cd JSON-Parse-0.62 perl Makefile.PL make make install @@ -104,6 +104,6 @@ repository on github at ----------------------------------------------------------------------------- -This README was written on Thu Feb 11 09:14:35 2021. +This README was written on Sat Jul 16 08:23:59 2022. ----------------------------------------------------------------------------- diff --git a/json-entry-points.c b/json-entry-points.c index 1d2b94b..281a550 100644 --- a/json-entry-points.c +++ b/json-entry-points.c @@ -3,6 +3,7 @@ static void fail_empty (json_parse_t * parser) { parser->bad_type = json_initial_state; + parser->expected = 0; parser->error = json_error_empty_input; failbadinput (parser); } diff --git a/json-perl.c b/json-perl.c index a3c6919..a39e4ee 100644 --- a/json-perl.c +++ b/json-perl.c @@ -548,7 +548,7 @@ PREFIX (string) (json_parse_t * parser) /* Location of first quote. */ start - 1, /* Location of last quote. */ - parser->end, + parser->end - 1, json_token_string); #else parser->end = start; diff --git a/lib/JSON/Parse.pm b/lib/JSON/Parse.pm index 1a083f6..871a028 100644 --- a/lib/JSON/Parse.pm +++ b/lib/JSON/Parse.pm @@ -4,21 +4,21 @@ use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw/ - assert_valid_json - json_file_to_perl - json_to_perl - parse_json - parse_json_safe - read_json - valid_json - validate_json - /; + assert_valid_json + json_file_to_perl + json_to_perl + parse_json + parse_json_safe + read_json + valid_json + validate_json +/; our %EXPORT_TAGS = ( all => \@EXPORT_OK, ); use Carp; -our $VERSION = '0.61'; +our $VERSION = '0.62'; require XSLoader; XSLoader::load (__PACKAGE__, $VERSION); diff --git a/lib/JSON/Parse.pod b/lib/JSON/Parse.pod index 02fd78d..24302b8 100644 --- a/lib/JSON/Parse.pod +++ b/lib/JSON/Parse.pod @@ -23,8 +23,8 @@ Convert JSON into Perl. =head1 VERSION -This documents version 0.61 of JSON::Parse corresponding to -L<git commit 033269fa8972fdce8626aa65cd11a5394ab50492|https://github.com/benkasminbullock/JSON-Parse/commit/033269fa8972fdce8626aa65cd11a5394ab50492> released on Thu Feb 11 09:14:04 2021 +0900. +This documents version 0.62 of JSON::Parse corresponding to +L<git commit d04630086f6c92fea720cba4568faa0cbbdde5a6|https://github.com/benkasminbullock/JSON-Parse/commit/d04630086f6c92fea720cba4568faa0cbbdde5a6> released on Sat Jul 16 08:23:13 2022 +0900. @@ -70,7 +70,7 @@ produces output -(This example is included as L<F<assert.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/assert.pl> in the distribution.) +(This example is included as L<F<assert.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/assert.pl> in the distribution.) This is the underlying function for L</valid_json>. It runs at the @@ -115,7 +115,7 @@ produces output HASH -(This example is included as L<F<hash.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/hash.pl> in the distribution.) +(This example is included as L<F<hash.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/hash.pl> in the distribution.) If the input JSON text is a serialized array, an array reference is @@ -133,7 +133,7 @@ produces output ARRAY -(This example is included as L<F<array.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/array.pl> in the distribution.) +(This example is included as L<F<array.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/array.pl> in the distribution.) Otherwise a Perl scalar is returned. @@ -307,7 +307,7 @@ produces output -(This example is included as L<F<collide.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/collide.pl> in the distribution.) +(This example is included as L<F<collide.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/collide.pl> in the distribution.) The C<detect_collisions (1)> behaviour is the behaviour of @@ -740,7 +740,7 @@ produces output Native Perl: かあ -(This example is included as L<F<unicode-details.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/unicode-details.pl> in the distribution.) +(This example is included as L<F<unicode-details.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/unicode-details.pl> in the distribution.) Although in general the above would be an unsafe practice, JSON::Parse @@ -807,7 +807,7 @@ produces output Ambiguous key 'a' is 2 -(This example is included as L<F<key-collision.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/key-collision.pl> in the distribution.) +(This example is included as L<F<key-collision.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/key-collision.pl> in the distribution.) Here the key "a" could be either 1 or 2. As seen in the example, @@ -935,7 +935,7 @@ produces output {"clapton":true,"hendrix":false} -(This example is included as L<F<json-tiny-round-trip-demo.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.61/examples/json-tiny-round-trip-demo.pl> in the distribution.) +(This example is included as L<F<json-tiny-round-trip-demo.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.62/examples/json-tiny-round-trip-demo.pl> in the distribution.) Most of the other CPAN modules use similar methods to L<JSON::Tiny>, @@ -1343,8 +1343,8 @@ able to fully work out the reason behind the better speed. There is some benchmarking code in the github repository under the directory "benchmarks" for those wishing to test these claims. The -script L<F<benchmarks/bench>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/benchmarks/bench> is an adaptation of the similar -script in the L<JSON::XS> distribution. The script L<F<benchmarks/pub-bench.pl>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/benchmarks/pub-bench.pl> runs the benchmarks and prints them +script L<F<benchmarks/bench>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/benchmarks/bench> is an adaptation of the similar +script in the L<JSON::XS> distribution. The script L<F<benchmarks/pub-bench.pl>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/benchmarks/pub-bench.pl> runs the benchmarks and prints them out as POD. The following benchmark tests used version 0.58_01 of JSON::Parse, version 4.03 of L</JSON::XS>, and version 4.25 of L</Cpanel::JSON::XS> on Perl @@ -1508,7 +1508,7 @@ part of JSON. =item L<Cpanel::JSON::XS> -[⭐⭐ Author: L<RURBAN|https://metacpan.org/author/RURBAN>; Date: C<2020-10-28>; Version: C<4.25>] +[⭐⭐ Author: L<RURBAN|https://metacpan.org/author/RURBAN>; Date: C<2021-04-12>; Version: C<4.26>] @@ -1566,6 +1566,16 @@ a wide variety of non-JSON formats such as comments, single-quoted strings, trailing commas, etc. +=item L<JSON::Parser::Regexp> + + +[Author: L<RAJ|https://metacpan.org/author/RAJ>; Date: C<2021-03-16>; Version: C<0.04>] + + + +Uses L<Regexp::Grammars> to parse JSON. + + =item L<JSON::PP> @@ -1648,7 +1658,7 @@ requests have been ignored. =item L<Mojo::JSON> -[⭐⭐⭐ Author: L<SRI|https://metacpan.org/author/SRI>; Date: C<2021-01-17>; Version: C<8.71>] +[⭐⭐⭐ Author: L<SRI|https://metacpan.org/author/SRI>; Date: C<2021-04-13>; Version: C<9.17>] @@ -1830,7 +1840,7 @@ output JSON. =item L<JSON::Typist> -[⭐ Author: L<RJBS|https://metacpan.org/author/RJBS>; Date: C<2019-12-26>; Version: C<0.006>] +[⭐ Author: L<RJBS|https://metacpan.org/author/RJBS>; Date: C<2021-05-03>; Version: C<0.007>] @@ -1924,7 +1934,7 @@ Create JSON under memory limitations. =item L<JSON::Color> -[⭐ Author: L<PERLANCAR|https://metacpan.org/author/PERLANCAR>; Date: C<2020-06-09>; Version: C<0.130>] +[⭐ Author: L<PERLANCAR|https://metacpan.org/author/PERLANCAR>; Date: C<2021-05-07>; Version: C<0.131>] @@ -1982,14 +1992,38 @@ tied scalars. values/matches" +=item L<JSON::Conditional> + + +[Author: L<LNATION|https://metacpan.org/author/LNATION>; Date: C<2021-03-29>; Version: C<1.00>] + + + + =item L<JSON::GRDDL> +[Author: L<TOBYINK|https://metacpan.org/author/TOBYINK>; Date: C<2014-09-11>; Version: C<0.002>] + + =item L<JSON::Hyper> +[⭐ Author: L<TOBYINK|https://metacpan.org/author/TOBYINK>; Date: C<2012-10-12>; Version: C<0.011>] + + + + +=item L<JSON::JQ> + + +[Author: L<DONGXU|https://metacpan.org/author/DONGXU>; Date: C<2021-05-16>; Version: C<0.06>] + + + +Perl access to the C<jq> tool via L<Alien::LibJQ>. =item L<JSON::MergePatch> @@ -2015,7 +2049,7 @@ shows an example of altering nested hashes in Perl. =item L<JSON::Path> -[⭐ Author: L<POPEFELIX|https://metacpan.org/author/POPEFELIX>; Date: C<2018-05-05>; Version: C<0.420>] +[⭐ Author: L<POPEFELIX|https://metacpan.org/author/POPEFELIX>; Date: C<2021-01-28>; Version: C<0.431>] @@ -2035,6 +2069,9 @@ Extract parts of a JSON string. =item L<JSON::Schema::ToJSON> +[⭐ Author: L<LEEJO|https://metacpan.org/author/LEEJO>; Date: C<2021-04-06>; Version: C<0.19>] + + "Generate example JSON structures from JSON Schema definitions" @@ -2060,13 +2097,23 @@ Transform JSON using JsonT =item L<JSON::Validator> -[⭐⭐ Author: L<JHTHORSEN|https://metacpan.org/author/JHTHORSEN>; Date: C<2021-01-24>; Version: C<4.12>] +[⭐⭐ Author: L<JHTHORSEN|https://metacpan.org/author/JHTHORSEN>; Date: C<2021-04-28>; Version: C<4.17>] "Validate data against a JSON schema" - you can decide what the JSON is supposed to contain. + +=item L<Template::Plugin::JSON> + + +[Author: L<ETHER|https://metacpan.org/author/ETHER>; Date: C<2019-03-07>; Version: C<0.08>] + + + +"Adds a .json vmethod for all TT values." - for use with L<Template>. + =back =item JSON extensions @@ -2096,6 +2143,14 @@ These modules extend JSON with comments and other things. "An extension of JSON that allows for better human-readability". +=item L<JSON::WithComments> + + +[Author: L<RJRAY|https://metacpan.org/author/RJRAY>; Date: C<2017-09-02>; Version: C<0.003>] + + + + =item L<JSONY> @@ -2115,7 +2170,7 @@ These modules extend JSON with comments and other things. =item L<Crypt::JWT> -[⭐⭐ Author: L<MIK|https://metacpan.org/author/MIK>; Date: C<2021-01-10>; Version: C<0.031>] +[⭐⭐ Author: L<MIK|https://metacpan.org/author/MIK>; Date: C<2021-05-01>; Version: C<0.033>] @@ -2313,8 +2368,6 @@ decode Perl scalar references and code references to JSON. -Something about one-liners. - =item L<JSON::JSend> @@ -2327,7 +2380,7 @@ Something about one-liners. =item L<JSON::Lines> -[⭐ Author: L<LNATION|https://metacpan.org/author/LNATION>; Date: C<2020-10-25>; Version: C<0.03>] +[⭐ Author: L<LNATION|https://metacpan.org/author/LNATION>; Date: C<2021-03-29>; Version: C<1.00>] @@ -2502,7 +2555,7 @@ supplied with the module in the F</t/> subdirectory of the distribution. More extensive testing code is in the git repository. This is not -supplied in the CPAN distribution. A script, L<F<randomjson.pl>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/randomjson.pl>, +supplied in the CPAN distribution. A script, L<F<randomjson.pl>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/randomjson.pl>, generates a set number of bytes of random JSON and checks that the module's bytewise validation of input is correct. It does this by taking a valid fragment, then adding each possible byte from 0 to 255 @@ -2512,17 +2565,17 @@ it to the fragment and continuing the process until a complete valid JSON input is formed. The module has undergone about a billion repetitions of this test. -This setup relies on a C file, L<F<json-random-test.c>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/json-random-test.c>, which -isn't in the CPAN distribution, and it also requires L<F<Json3.xs>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/Json3.xs> to be edited to make the macro C<TESTRANDOM> true +This setup relies on a C file, L<F<json-random-test.c>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/json-random-test.c>, which +isn't in the CPAN distribution, and it also requires L<F<Json3.xs>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/Json3.xs> to be edited to make the macro C<TESTRANDOM> true (uncomment line 7 of the file). The testing code uses C setjmp/longjmp, so it's not guaranteed to work on all operating systems and is commented out for CPAN releases. -A pure C version called L<F<random-test.c>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/random-test.c> also exists. This applies +A pure C version called L<F<random-test.c>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/random-test.c> also exists. This applies exactly the same tests, and requires no Perl at all. If you're interested in testing your own JSON parser, the outputs -generated by L<F<randomjson.pl>|https://github.com/benkasminbullock/JSON-Parse/033269fa8972fdce8626aa65cd11a5394ab50492/randomjson.pl> are quite a good place to +generated by L<F<randomjson.pl>|https://github.com/benkasminbullock/JSON-Parse/d04630086f6c92fea720cba4568faa0cbbdde5a6/randomjson.pl> are quite a good place to start. The default is to produce UTF-8 output, which looks pretty horrible since it tends to produce long strings of UTF-8 garbage. (This is because it chooses randomly from 256 bytes and the @@ -2579,7 +2632,7 @@ Ben Bullock, <bkb@cpan.org> =head1 COPYRIGHT & LICENCE This package and associated files are copyright (C) -2013-2021 +2013-2022 Ben Bullock. You can use, copy, modify and redistribute this package and associated diff --git a/lib/JSON/Tokenize.pm b/lib/JSON/Tokenize.pm index 2ac6a4c..73227f2 100644 --- a/lib/JSON/Tokenize.pm +++ b/lib/JSON/Tokenize.pm @@ -5,17 +5,17 @@ require Exporter; our @ISA = qw(Exporter); use JSON::Parse; our @EXPORT_OK = qw/ - tokenize_child - tokenize_end - tokenize_json - tokenize_next - tokenize_start - tokenize_text - tokenize_type - /; + tokenize_child + tokenize_end + tokenize_json + tokenize_next + tokenize_start + tokenize_text + tokenize_type +/; our %EXPORT_TAGS = ('all' => \@EXPORT_OK); use Carp; -our $VERSION = '0.61'; +our $VERSION = '0.62'; sub tokenize_text { diff --git a/lib/JSON/Tokenize.pod b/lib/JSON/Tokenize.pod index 4790caa..8565e8c 100644 --- a/lib/JSON/Tokenize.pod +++ b/lib/JSON/Tokenize.pod @@ -49,8 +49,8 @@ This outputs =head1 VERSION -This documents version 0.61 of JSON::Tokenize corresponding to -L<git commit 033269fa8972fdce8626aa65cd11a5394ab50492|https://github.com/benkasminbullock/JSON-Parse/commit/033269fa8972fdce8626aa65cd11a5394ab50492> released on Thu Feb 11 09:14:04 2021 +0900. +This documents version 0.62 of JSON::Tokenize corresponding to +L<git commit d04630086f6c92fea720cba4568faa0cbbdde5a6|https://github.com/benkasminbullock/JSON-Parse/commit/d04630086f6c92fea720cba4568faa0cbbdde5a6> released on Sat Jul 16 08:23:13 2022 +0900. @@ -132,7 +132,7 @@ Ben Bullock, <bkb@cpan.org> =head1 COPYRIGHT & LICENCE This package and associated files are copyright (C) -2016-2021 +2016-2022 Ben Bullock. You can use, copy, modify and redistribute this package and associated diff --git a/lib/JSON/Whitespace.pm b/lib/JSON/Whitespace.pm index b074d9e..60fff5f 100644 --- a/lib/JSON/Whitespace.pm +++ b/lib/JSON/Whitespace.pm @@ -11,7 +11,7 @@ our %EXPORT_TAGS = ( use warnings; use strict; use Carp; -our $VERSION = '0.61'; +our $VERSION = '0.62'; use JSON::Tokenize 'tokenize_json'; diff --git a/lib/JSON/Whitespace.pod b/lib/JSON/Whitespace.pod index ff556c3..42910f6 100644 --- a/lib/JSON/Whitespace.pod +++ b/lib/JSON/Whitespace.pod @@ -35,8 +35,8 @@ This outputs =head1 VERSION -This documents version 0.61 of JSON::Whitespace corresponding to -L<git commit 033269fa8972fdce8626aa65cd11a5394ab50492|https://github.com/benkasminbullock/JSON-Parse/commit/033269fa8972fdce8626aa65cd11a5394ab50492> released on Thu Feb 11 09:14:04 2021 +0900. +This documents version 0.62 of JSON::Whitespace corresponding to +L<git commit d04630086f6c92fea720cba4568faa0cbbdde5a6|https://github.com/benkasminbullock/JSON-Parse/commit/d04630086f6c92fea720cba4568faa0cbbdde5a6> released on Sat Jul 16 08:23:13 2022 +0900. @@ -78,7 +78,7 @@ Ben Bullock, <bkb@cpan.org> =head1 COPYRIGHT & LICENCE This package and associated files are copyright (C) -2016-2021 +2016-2022 Ben Bullock. You can use, copy, modify and redistribute this package and associated diff --git a/script/validjson b/script/validjson index abd93ed..2368fd2 100755 --- a/script/validjson +++ b/script/validjson @@ -1,8 +1,8 @@ #!/home/ben/software/install/bin/perl use warnings; use strict; -use lib '/home/ben/projects/Json3/blib/lib'; -use lib '/home/ben/projects/Json3/blib/arch'; +use lib '/home/ben/projects/json-parse/blib/lib'; +use lib '/home/ben/projects/json-parse/blib/arch'; use JSON::Parse 'assert_valid_json'; use Getopt::Long; my $ok = GetOptions ( diff --git a/t/tokenize-bug.t b/t/tokenize-bug.t new file mode 100644 index 0000000..75f42e1 --- /dev/null +++ b/t/tokenize-bug.t @@ -0,0 +1,14 @@ +use warnings 'all'; +use strict; +use Test::More; +use JSON::Tokenize ':all'; +use JSON::Parse 'assert_valid_json'; + +my $input = '{"tuttie":["fruity\"\"\"\"", true, 100]}'; +eval { + my $token = tokenize_json ($input); +}; +ok (! $@); +done_testing (); +exit; + diff --git a/t/u-in-key.t b/t/u-in-key.t new file mode 100644 index 0000000..bdf70a4 --- /dev/null +++ b/t/u-in-key.t @@ -0,0 +1,17 @@ +use FindBin '$Bin'; +use lib "$Bin"; +use JPT; +my $test = <<'EOF'; +{"\u0041":"A","\u3000":" ","\t":"tab"} +EOF +my $out = parse_json ($test); +TODO: { + local $TODO = 'Support \u escapes in keys'; + ok ($out->{A}, "Got a key"); + is ($out->{A}, 'A', "Got right value for A"); + ok ($out->{' '}, "Got U+3000 key"); + is ($out->{' '}, ' ', "Got right value for U+3000"); + ok ($out->{"\x{09}"}, "got a tab as key"); + is ($out->{"\x{09}"}, 'tab', "Got right value for tab as key"); +}; +done_testing (); @@ -993,7 +993,8 @@ trim_to_utf8_start (const uint8_t ** ptr) /* Given a return value "code" which is negative or zero, return a string which describes what the return value means. Positive non-zero return values never indicate errors or statuses in this - library. */ + library. Unknown error codes result in a default string being + returned. */ const char * unicode_code_to_error (int32_t code) |