From 8d2a41273a56a33a291d292c1fbee03cce290694 Mon Sep 17 00:00:00 2001 From: Hyunjee Kim Date: Tue, 17 Mar 2020 09:38:42 +0900 Subject: Imported Upstream version 4.02 Change-Id: I549bbbd41e3db39e6fd6f2b1f2c4c94b94071018 Signed-off-by: Hyunjee Kim --- t/15_prefix.t | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 t/15_prefix.t (limited to 't/15_prefix.t') 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]); + -- cgit v1.2.3