1# copied over from JSON::XS and modified to use JSON 2 3use Test::More; 4use strict; 5 6BEGIN { plan tests => 8 }; 7 8BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; } 9 10BEGIN { 11 use lib qw(t); 12 use _unicode_handling; 13} 14 15use utf8; 16use JSON; 17 18 19my $json = JSON->new->relaxed; 20 21ok ('[1,2,3]' eq encode_json $json->decode (' [1,2, 3]')); 22ok ('[1,2,4]' eq encode_json $json->decode ('[1,2, 4 , ]')); 23ok (!eval { $json->decode ('[1,2, 3,4,,]') }); 24ok (!eval { $json->decode ('[,1]') }); 25 26ok ('{"1":2}' eq encode_json $json->decode (' {"1":2}')); 27ok ('{"1":2}' eq encode_json $json->decode ('{"1":2,}')); 28ok (!eval { $json->decode ('{,}') }); 29 30ok ('[1,2]' eq encode_json $json->decode ("[1#,2\n ,2,# ] \n\t]")); 31