1# copied over from JSON::XS and modified to use JSON
2
3BEGIN { $| = 1; print "1..4\n"; }
4BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
5
6use JSON;
7
8my $xs = JSON->new->allow_nonref;
9
10eval { $xs->decode ("[] ") };
11print $@ ? "not " : "", "ok 1\n";
12eval { $xs->decode ("[] x") };
13print $@ ? "" : "not ", "ok 2\n";
14print 2 == ($xs->decode_prefix ("[][]"))[1] ? "" : "not ", "ok 3\n";
15print 3 == ($xs->decode_prefix ("[1] t"))[1] ? "" : "not ", "ok 4\n";
16
17