Blame t/107_allow_singlequote.t
|
Packit Service |
185204 |
|
|
Packit Service |
185204 |
use Test::More;
|
|
Packit Service |
185204 |
use strict;
|
|
Packit Service |
185204 |
BEGIN { plan tests => 4 };
|
|
Packit Service |
185204 |
BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
|
|
Packit Service |
185204 |
use JSON -support_by_pp;
|
|
Packit Service |
185204 |
#########################
|
|
Packit Service |
185204 |
|
|
Packit Service |
185204 |
my $json = JSON->new->allow_nonref;
|
|
Packit Service |
185204 |
|
|
Packit Service |
185204 |
eval q| $json->decode("{'foo':'bar'}") |;
|
|
Packit Service |
185204 |
|
|
Packit Service |
185204 |
ok($@); # in XS and PP, the error message differs.
|
|
Packit Service |
185204 |
|
|
Packit Service |
185204 |
$json->allow_singlequote;
|
|
Packit Service |
185204 |
|
|
Packit Service |
185204 |
is($json->decode(q|{'foo':"bar"}|)->{foo}, 'bar');
|
|
Packit Service |
185204 |
is($json->decode(q|{'foo':'bar'}|)->{foo}, 'bar');
|
|
Packit Service |
185204 |
is($json->allow_barekey->decode(q|{foo:'bar'}|)->{foo}, 'bar');
|
|
Packit Service |
185204 |
|