xref: /openbsd-src/gnu/usr.bin/perl/cpan/JSON-PP/t/116_incr_parse_fixed.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1898184e3Ssthenuse strict;
2*256a93a4Safresh1use warnings;
3898184e3Ssthenuse Test::More tests => 4;
4898184e3Ssthen
5898184e3Ssthenuse JSON::PP;
6898184e3Ssthen
7f3efcd01Safresh1my $json = JSON::PP->new->allow_nonref(1);
8898184e3Ssthen
9898184e3Ssthenmy @vs = $json->incr_parse('"a\"bc');
10898184e3Ssthen
11898184e3Ssthenok( not scalar(@vs) );
12898184e3Ssthen
13898184e3Ssthen@vs = $json->incr_parse('"');
14898184e3Ssthen
15898184e3Ssthenis( $vs[0], "a\"bc" );
16898184e3Ssthen
17898184e3Ssthen
18f3efcd01Safresh1$json = JSON::PP->new->allow_nonref(0);
19898184e3Ssthen
20898184e3Ssthen@vs = $json->incr_parse('"a\"bc');
21898184e3Ssthenok( not scalar(@vs) );
22898184e3Ssthen@vs = eval { $json->incr_parse('"') };
23898184e3Ssthenok($@ =~ qr/JSON text must be an object or array/);
24898184e3Ssthen
25