|
Packit Service |
639957 |
# copied over from JSON::XS and modified to use JSON
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
use Test::More;
|
|
Packit Service |
639957 |
use strict;
|
|
Packit Service |
639957 |
BEGIN { plan tests => 4 };
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; }
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
BEGIN {
|
|
Packit Service |
639957 |
use lib qw(t);
|
|
Packit Service |
639957 |
use _unicode_handling;
|
|
Packit Service |
639957 |
}
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
use JSON;
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
SKIP: {
|
|
Packit Service |
639957 |
skip "UNICODE handling is disabale.", 4 unless $JSON::can_handle_UTF16_and_utf8;
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
my $xs = JSON->new->latin1->allow_nonref;
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
ok $xs->encode ("\x{12}\x{89} ") eq "\"\\u0012\x{89} \"";
|
|
Packit Service |
639957 |
ok $xs->encode ("\x{12}\x{89}\x{abc}") eq "\"\\u0012\x{89}\\u0abc\"";
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
ok $xs->decode ("\"\\u0012\x{89}\"" ) eq "\x{12}\x{89}";
|
|
Packit Service |
639957 |
ok $xs->decode ("\"\\u0012\x{89}\\u0abc\"") eq "\x{12}\x{89}\x{abc}";
|
|
Packit Service |
639957 |
|
|
Packit Service |
639957 |
}
|