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

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