Debian Codegraph @

t/116_incr_parse_fixed.t

raw
1 use strict;
2 use warnings;
3 use Test::More tests => 4;
4
5 BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
6
7 use JSON;
8
9 my $json = JSON->new->allow_nonref(1);
10
11 my @vs = $json->incr_parse('"a\"bc');
12
13 ok( not scalar(@vs) );
14
15 @vs = $json->incr_parse('"');
16
17 is( $vs[0], "a\"bc" );
18
19
20 $json = JSON->new->allow_nonref(0);
21
22 @vs = $json->incr_parse('"a\"bc');
23 ok( not scalar(@vs) );
24 @vs = eval { $json->incr_parse('"') };
25 ok($@ =~ qr/JSON text must be an object or array/);
26