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