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

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/e15_tie_ixhash.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
2 use strict;
3 use Test::More;
4 BEGIN { plan tests => 2 };
5
6 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
7
8 use JSON;
9
10 # from https://rt.cpan.org/Ticket/Display.html?id=25162
11
12 SKIP: {
13 eval {require Tie::IxHash};
14 skip "Can't load Tie::IxHash.", 2 if ($@);
15
16 my %columns;
17 tie %columns, 'Tie::IxHash';
18
19 %columns = (
20 id => 'int',
21 1 => 'a',
22 2 => 'b',
23 3 => 'c',
24 4 => 'd',
25 5 => 'e',
26 );
27
28 my $js = to_json(\%columns);
29 is( $js, q/{"id":"int","1":"a","2":"b","3":"c","4":"d","5":"e"}/ );
30
31 $js = to_json(\%columns, {pretty => 1});
32 is( $js, <<'STR' );
33 {
34 "id" : "int",
35 "1" : "a",
36 "2" : "b",
37 "3" : "c",
38 "4" : "d",
39 "5" : "e"
40 }
41 STR
42
43 }
44
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698