| 1 |
|
| 2 |
use Test::More; |
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
BEGIN { plan tests => 4 }; |
| 6 |
BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; } |
| 7 |
use JSON -support_by_pp; |
| 8 |
######################### |
| 9 |
|
| 10 |
my $json = JSON->new->allow_nonref; |
| 11 |
|
| 12 |
eval q| $json->decode("{'foo':'bar'}") |; |
| 13 |
|
| 14 |
ok($@); # in XS and PP, the error message differs. |
| 15 |
|
| 16 |
$json->allow_singlequote; |
| 17 |
|
| 18 |
is($json->decode(q|{'foo':"bar"}|)->{foo}, 'bar'); |
| 19 |
is($json->decode(q|{'foo':'bar'}|)->{foo}, 'bar'); |
| 20 |
is($json->allow_barekey->decode(q|{foo:'bar'}|)->{foo}, 'bar'); |
| 21 |
|