summaryrefslogtreecommitdiff
path: root/t/112_upgrade.t
diff options
context:
space:
mode:
Diffstat (limited to 't/112_upgrade.t')
-rw-r--r--t/112_upgrade.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/112_upgrade.t b/t/112_upgrade.t
new file mode 100644
index 0000000..94b6d1f
--- /dev/null
+++ b/t/112_upgrade.t
@@ -0,0 +1,24 @@
+use strict;
+use Test::More;
+
+BEGIN { plan tests => 3 };
+
+BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
+
+use JSON;
+
+my $json = JSON->new->allow_nonref->utf8;
+my $str = '\\u00c8';
+
+my $value = $json->decode( '"\\u00c8"' );
+
+#use Devel::Peek;
+#Dump( $value );
+
+is( $value, chr 0xc8 );
+
+ok( utf8::is_utf8( $value ) );
+
+eval { $json->decode( '"' . chr(0xc8) . '"' ) };
+ok( $@ =~ /malformed UTF-8 character in JSON string/ );
+