Debian Codegraph @

t/15_prefix.t

raw
1 # copied over from JSON::XS and modified to use JSON
2
3 use strict;
4 use warnings;
5 use Test::More;
6 BEGIN { plan tests => 4 };
7
8 BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
9
10 use JSON;
11
12 my $pp = JSON->new->latin1->allow_nonref;
13
14 eval { $pp->decode ("[] ") };
15 ok (!$@);
16 eval { $pp->decode ("[] x") };
17 ok ($@);
18 ok (2 == ($pp->decode_prefix ("[][]"))[1]);
19 ok (3 == ($pp->decode_prefix ("[1] t"))[1]);
20