File: 14_latin1.t

package info (click to toggle)
libjson-xs-perl 4.040-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 444 kB
  • sloc: perl: 525; makefile: 8
file content (12 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
BEGIN { $| = 1; print "1..4\n"; }

use JSON::XS;

my $xs = JSON::XS->new->latin1->allow_nonref;

print $xs->encode ("\x{12}\x{89}       ") eq "\"\\u0012\x{89}       \"" ? "" : "not ", "ok 1\n";
print $xs->encode ("\x{12}\x{89}\x{abc}") eq "\"\\u0012\x{89}\\u0abc\"" ? "" : "not ", "ok 2\n";

print $xs->decode ("\"\\u0012\x{89}\""       ) eq "\x{12}\x{89}"        ? "" : "not ", "ok 3\n";
print $xs->decode ("\"\\u0012\x{89}\\u0abc\"") eq "\x{12}\x{89}\x{abc}" ? "" : "not ", "ok 4\n";