summaryrefslogtreecommitdiff
path: root/cpan/JSON-PP/t/107_allow_singlequote.t
diff options
context:
space:
mode:
authorDavid Golden <dagolden@cpan.org>2010-12-30 23:43:44 -0500
committerDavid Golden <dagolden@cpan.org>2011-01-02 22:35:00 -0500
commitd54243158c0e4ba0127eb487c5b2e2a10484e8d0 (patch)
tree2f1238fc9caaa427391abff7c62da09dc6a76f3d /cpan/JSON-PP/t/107_allow_singlequote.t
parent5e3072707906cc4cb8a364c4cf7c487df0300caa (diff)
downloadperl-d54243158c0e4ba0127eb487c5b2e2a10484e8d0.tar.gz
Add JSON::PP to the Perl core
Per discussions with Jesse Vincent, JSON::PP has been added to the Perl core to support the new CPAN meta file specification
Diffstat (limited to 'cpan/JSON-PP/t/107_allow_singlequote.t')
-rw-r--r--cpan/JSON-PP/t/107_allow_singlequote.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/cpan/JSON-PP/t/107_allow_singlequote.t b/cpan/JSON-PP/t/107_allow_singlequote.t
new file mode 100644
index 0000000000..217caba5a9
--- /dev/null
+++ b/cpan/JSON-PP/t/107_allow_singlequote.t
@@ -0,0 +1,20 @@
+
+use Test::More;
+use strict;
+BEGIN { plan tests => 4 };
+BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
+use JSON::PP;
+#########################
+
+my $json = JSON::PP->new->allow_nonref;
+
+eval q| $json->decode("{'foo':'bar'}") |;
+
+ok($@); # in XS and PP, the error message differs.
+
+$json->allow_singlequote;
+
+is($json->decode(q|{'foo':"bar"}|)->{foo}, 'bar');
+is($json->decode(q|{'foo':'bar'}|)->{foo}, 'bar');
+is($json->allow_barekey->decode(q|{foo:'bar'}|)->{foo}, 'bar');
+