Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: third_party/JSON/JSON-2.59/t/e09_encode.t

Issue 15736030: Add JSON.pm to third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix permissions and shebangs Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/JSON/JSON-2.59/t/e08_decode.t ('k') | third_party/JSON/JSON-2.59/t/e10_bignum.t » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #
2 # decode on Perl 5.005, 5.6, 5.8 or later
3 #
4 use strict;
5 use Test::More;
6
7 BEGIN { plan tests => 7 };
8
9 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
10
11 use JSON;
12
13 BEGIN {
14 use lib qw(t);
15 use _unicode_handling;
16 }
17
18 no utf8;
19
20 my $json = JSON->new->allow_nonref;
21
22 is($json->encode("ü"), q|"ü"|); # as is
23
24 $json->ascii;
25
26 is($json->encode("\xfc"), q|"\u00fc"|); # latin1
27 is($json->encode("\xc3\xbc"), q|"\u00c3\u00bc"|); # utf8
28 is($json->encode("ü"), q|"\u00c3\u00bc"|); # utf8
29 is($json->encode('あ'), q|"\u00e3\u0081\u0082"|);
30
31 if ($] >= 5.006) {
32 is($json->encode(chr hex 3042 ), q|"\u3042"|);
33 is($json->encode(chr hex 12345 ), q|"\ud808\udf45"|);
34 }
35 else {
36 is($json->encode(chr hex 3042 ), $json->encode(chr 66));
37 is($json->encode(chr hex 12345 ), $json->encode(chr 69));
38 }
39
OLDNEW
« no previous file with comments | « third_party/JSON/JSON-2.59/t/e08_decode.t ('k') | third_party/JSON/JSON-2.59/t/e10_bignum.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698