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

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/e14_decode_prefix.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 #!/usr/bin/perl
2
3 use strict;
4 use Test::More tests => 8;
5
6 BEGIN {
7 $ENV{ PERL_JSON_BACKEND } = "JSON::backportPP";
8 }
9
10 use JSON;
11
12 my $json = JSON->new;
13
14 my $complete_text = qq/{"foo":"bar"}/;
15 my $garbaged_text = qq/{"foo":"bar"}\n/;
16 my $garbaged_text2 = qq/{"foo":"bar"}\n\n/;
17 my $garbaged_text3 = qq/{"foo":"bar"}\n----/;
18
19 is( ( $json->decode_prefix( $complete_text ) ) [1], 13 );
20 is( ( $json->decode_prefix( $garbaged_text ) ) [1], 13 );
21 is( ( $json->decode_prefix( $garbaged_text2 ) ) [1], 13 );
22 is( ( $json->decode_prefix( $garbaged_text3 ) ) [1], 13 );
23
24 eval { $json->decode( "\n" ) }; ok( $@ =~ /malformed JSON/ );
25 eval { $json->decode('null') }; ok $@ =~ /allow_nonref/;
26
27 eval { $json->decode_prefix( "\n" ) }; ok( $@ =~ /malformed JSON/ );
28 eval { $json->decode_prefix('null') }; ok $@ =~ /allow_nonref/;
29
OLDNEW
« no previous file with comments | « trunk/src/third_party/JSON/JSON-2.59/t/e13_overloaded_eq.t ('k') | trunk/src/third_party/JSON/JSON-2.59/t/e15_tie_ixhash.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698