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

Unified Diff: third_party/JSON/JSON-2.59/t/15_prefix.t

Issue 15736030: Add JSON.pm to third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to v2.59, proper override 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/15_prefix.t
diff --git a/third_party/JSON/JSON-2.59/t/15_prefix.t b/third_party/JSON/JSON-2.59/t/15_prefix.t
new file mode 100644
index 0000000000000000000000000000000000000000..3071be277f8f6b4a0860c742a9be5da3e772cc53
--- /dev/null
+++ b/third_party/JSON/JSON-2.59/t/15_prefix.t
@@ -0,0 +1,16 @@
+# copied over from JSON::XS and modified to use JSON
+
+BEGIN { $| = 1; print "1..4\n"; }
+BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
+
+use JSON;
+
+my $xs = JSON->new->allow_nonref;
+
+eval { $xs->decode ("[] ") };
+print $@ ? "not " : "", "ok 1\n";
+eval { $xs->decode ("[] x") };
+print $@ ? "" : "not ", "ok 2\n";
+print 2 == ($xs->decode_prefix ("[][]"))[1] ? "" : "not ", "ok 3\n";
+print 3 == ($xs->decode_prefix ("[1] t"))[1] ? "" : "not ", "ok 4\n";
+

Powered by Google App Engine
This is Rietveld 408576698