File: 015_prefix.t

package info (click to toggle)
perl 5.20.2-3%2Bdeb8u11
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 102,964 kB
  • sloc: perl: 555,553; ansic: 214,041; sh: 38,121; pascal: 8,783; cpp: 3,895; makefile: 2,393; xml: 2,325; yacc: 1,741
file content (16 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# copied over from JSON::PP::XS and modified to use JSON::PP

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

use JSON::PP;

my $xs = JSON::PP->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";