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

Unified Diff: third_party/JSON/JSON-2.59/t/e15_tie_ixhash.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 side-by-side diff with in-line comments
Download patch
Index: third_party/JSON/JSON-2.59/t/e15_tie_ixhash.t
diff --git a/third_party/JSON/JSON-2.59/t/e15_tie_ixhash.t b/third_party/JSON/JSON-2.59/t/e15_tie_ixhash.t
new file mode 100644
index 0000000000000000000000000000000000000000..9e8991d2f36969329f96f435857acf9723a55788
--- /dev/null
+++ b/third_party/JSON/JSON-2.59/t/e15_tie_ixhash.t
@@ -0,0 +1,44 @@
+
+use strict;
+use Test::More;
+BEGIN { plan tests => 2 };
+
+BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
+
+use JSON;
+
+# from https://rt.cpan.org/Ticket/Display.html?id=25162
+
+SKIP: {
+ eval {require Tie::IxHash};
+ skip "Can't load Tie::IxHash.", 2 if ($@);
+
+ my %columns;
+ tie %columns, 'Tie::IxHash';
+
+ %columns = (
+ id => 'int',
+ 1 => 'a',
+ 2 => 'b',
+ 3 => 'c',
+ 4 => 'd',
+ 5 => 'e',
+ );
+
+ my $js = to_json(\%columns);
+ is( $js, q/{"id":"int","1":"a","2":"b","3":"c","4":"d","5":"e"}/ );
+
+ $js = to_json(\%columns, {pretty => 1});
+ is( $js, <<'STR' );
+{
+ "id" : "int",
+ "1" : "a",
+ "2" : "b",
+ "3" : "c",
+ "4" : "d",
+ "5" : "e"
+}
+STR
+
+}
+
« no previous file with comments | « third_party/JSON/JSON-2.59/t/e14_decode_prefix.t ('k') | third_party/JSON/JSON-2.59/t/e16_incr_parse_fixed.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698