Commit | Line | Data |
---|---|---|
7942a65c CBW |
1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use Test::More tests => 4; | |
5 | ||
6 | use JSON::PP; | |
7 | ||
8 | my $json = JSON::PP->new->allow_nonref(); | |
9 | ||
10 | my @vs = $json->incr_parse('"a\"bc'); | |
11 | ||
12 | ok( not scalar(@vs) ); | |
13 | ||
14 | @vs = $json->incr_parse('"'); | |
15 | ||
16 | is( $vs[0], "a\"bc" ); | |
17 | ||
18 | ||
19 | $json = JSON::PP->new; | |
20 | ||
21 | @vs = $json->incr_parse('"a\"bc'); | |
22 | ok( not scalar(@vs) ); | |
23 | @vs = eval { $json->incr_parse('"') }; | |
24 | ok($@ =~ qr/JSON text must be an object or array/); | |
25 |