summaryrefslogtreecommitdiff
path: root/cpan/JSON-PP/t/015_prefix.t
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/JSON-PP/t/015_prefix.t')
-rw-r--r--cpan/JSON-PP/t/015_prefix.t16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpan/JSON-PP/t/015_prefix.t b/cpan/JSON-PP/t/015_prefix.t
new file mode 100644
index 0000000000..74c96a7ac2
--- /dev/null
+++ b/cpan/JSON-PP/t/015_prefix.t
@@ -0,0 +1,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";
+