summaryrefslogtreecommitdiff
path: root/t/15_prefix.t
diff options
context:
space:
mode:
authorHyunjee Kim <hj0426.kim@samsung.com>2020-03-17 09:38:42 +0900
committerHyunjee Kim <hj0426.kim@samsung.com>2020-03-17 10:32:30 +0900
commit8d2a41273a56a33a291d292c1fbee03cce290694 (patch)
treed2e93626e62e86e0be5696b4ce240d0af7376a6a /t/15_prefix.t
parentc5bbcb68877d7b8bdb968a69aa62b3b90853cb3f (diff)
downloadperl-json-8d2a41273a56a33a291d292c1fbee03cce290694.tar.gz
perl-json-8d2a41273a56a33a291d292c1fbee03cce290694.tar.bz2
perl-json-8d2a41273a56a33a291d292c1fbee03cce290694.zip
Imported Upstream version 4.02upstream/4.02
Change-Id: I549bbbd41e3db39e6fd6f2b1f2c4c94b94071018 Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
Diffstat (limited to 't/15_prefix.t')
-rw-r--r--t/15_prefix.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/15_prefix.t b/t/15_prefix.t
new file mode 100644
index 0000000..a9c5b2e
--- /dev/null
+++ b/t/15_prefix.t
@@ -0,0 +1,19 @@
+# copied over from JSON::XS and modified to use JSON
+
+use strict;
+use Test::More;
+BEGIN { plan tests => 4 };
+
+BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
+
+use JSON;
+
+my $pp = JSON->new->latin1->allow_nonref;
+
+eval { $pp->decode ("[] ") };
+ok (!$@);
+eval { $pp->decode ("[] x") };
+ok ($@);
+ok (2 == ($pp->decode_prefix ("[][]"))[1]);
+ok (3 == ($pp->decode_prefix ("[1] t"))[1]);
+