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

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/01_utf8.t

Issue 16539003: Revert 205057 "Add JSON.pm to third_party" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
OLDNEW
(Empty)
1 # copied over from JSON::XS and modified to use JSON
2
3 use strict;
4 use Test::More;
5 BEGIN { plan tests => 9 };
6
7 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
8
9 BEGIN {
10 use lib qw(t);
11 use _unicode_handling;
12 }
13
14
15 use utf8;
16 use JSON;
17
18
19 ok (JSON->new->allow_nonref (1)->utf8 (1)->encode ("ü") eq "\"\xc3\xbc\"");
20 ok (JSON->new->allow_nonref (1)->encode ("ü") eq "\"ü\"");
21
22 SKIP: {
23 skip "UNICODE handling is disabale.", 7 unless $JSON::can_handle_UTF16_and_u tf8;
24
25 ok (JSON->new->allow_nonref (1)->ascii (1)->utf8 (1)->encode (chr 0x8000) eq '"\ u8000"');
26 ok (JSON->new->allow_nonref (1)->ascii (1)->utf8 (1)->pretty (1)->encode (chr 0x 10402) eq "\"\\ud801\\udc02\"\n");
27
28 eval { JSON->new->allow_nonref (1)->utf8 (1)->decode ('"ü"') };
29 ok $@ =~ /malformed UTF-8/;
30
31 ok (JSON->new->allow_nonref (1)->decode ('"ü"') eq "ü");
32 ok (JSON->new->allow_nonref (1)->decode ('"\u00fc"') eq "ü");
33 ok (JSON->new->allow_nonref (1)->decode ('"\ud801\udc02' . "\x{10204}\"") eq "\x {10402}\x{10204}");
34 ok (JSON->new->allow_nonref (1)->decode ('"\"\n\\\\\r\t\f\b"') eq "\"\012\\\015\ 011\014\010");
35
36 }
OLDNEW
« no previous file with comments | « trunk/src/third_party/JSON/JSON-2.59/t/00_pod.t ('k') | trunk/src/third_party/JSON/JSON-2.59/t/02_error.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698