xref: /openbsd-src/gnu/usr.bin/perl/cpan/JSON-PP/t/015_prefix.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1# copied over from JSON::XS and modified to use JSON::PP
2
3use strict;
4use warnings;
5use Test::More;
6BEGIN { plan tests => 4 };
7
8BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
9
10use JSON::PP;
11
12my $pp = JSON::PP->new->latin1->allow_nonref;
13
14eval { $pp->decode ("[] ") };
15ok (!$@);
16eval { $pp->decode ("[] x") };
17ok ($@);
18ok (2 == ($pp->decode_prefix ("[][]"))[1]);
19ok (3 == ($pp->decode_prefix ("[1] t"))[1]);
20
21