1BEGIN { $| = 1; print "1..4\n"; } 2 3use JSON::XS; 4 5my $xs = JSON::XS->new->latin1->allow_nonref; 6 7eval { $xs->decode ("[] ") }; 8print $@ ? "not " : "", "ok 1\n"; 9eval { $xs->decode ("[] x") }; 10print $@ ? "" : "not ", "ok 2\n"; 11print 2 == ($xs->decode_prefix ("[][]"))[1] ? "" : "not ", "ok 3\n"; 12print 3 == ($xs->decode_prefix ("[1] t"))[1] ? "" : "not ", "ok 4\n"; 13 14