File: 15_prefix.t

package info (click to toggle)
libjson-perl 2.07-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 408 kB
  • ctags: 134
  • sloc: perl: 1,815; makefile: 44
file content (16 lines) | stat: -rw-r--r-- 443 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# copied over from JSON::XS and modified to use JSON

BEGIN { $| = 1; print "1..4\n"; }
BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }

use JSON;

my $xs = JSON->new->allow_nonref;

eval { $xs->decode ("[] ") };
print $@ ? "not " : "", "ok 1\n";
eval { $xs->decode ("[] x") };
print $@ ? "" : "not ", "ok 2\n";
print 2 == ($xs->decode_prefix ("[][]"))[1] ? "" : "not ", "ok 3\n";
print 3 == ($xs->decode_prefix ("[1] t"))[1] ? "" : "not ", "ok 4\n";