Blame t/107_allow_singlequote.t

Packit a557cb

Packit a557cb
use Test::More;
Packit a557cb
use strict;
Packit a557cb
BEGIN { plan tests => 4 };
Packit a557cb
BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
Packit a557cb
use JSON -support_by_pp;
Packit a557cb
#########################
Packit a557cb

Packit a557cb
my $json = JSON->new->allow_nonref;
Packit a557cb

Packit a557cb
eval q| $json->decode("{'foo':'bar'}") |;
Packit a557cb

Packit a557cb
ok($@); # in XS and PP, the error message differs.
Packit a557cb

Packit a557cb
$json->allow_singlequote;
Packit a557cb

Packit a557cb
is($json->decode(q|{'foo':"bar"}|)->{foo}, 'bar');
Packit a557cb
is($json->decode(q|{'foo':'bar'}|)->{foo}, 'bar');
Packit a557cb
is($json->allow_barekey->decode(q|{foo:'bar'}|)->{foo}, 'bar');
Packit a557cb