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

Side by Side Diff: trunk/src/third_party/JSON/JSON-2.59/t/e11_conv_blessed_univ.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 => 3 };
5
6 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; }
7
8 use JSON -convert_blessed_universally;
9
10
11 my $obj = Test->new( [ 1, 2, {foo => 'bar'} ] );
12
13 $obj->[3] = Test2->new( { a => 'b' } );
14
15 my $json = JSON->new->allow_blessed->convert_blessed;
16
17 is( $json->encode( $obj ), '[1,2,{"foo":"bar"},"hoge"]' );
18
19 $json->convert_blessed(0);
20
21 is( $json->encode( $obj ), 'null' );
22
23 $json->allow_blessed(0)->convert_blessed(1);
24
25 is( $json->encode( $obj ), '[1,2,{"foo":"bar"},"hoge"]' );
26
27
28 package Test;
29
30 sub new {
31 bless $_[1], $_[0];
32 }
33
34
35
36 package Test2;
37
38 sub new {
39 bless $_[1], $_[0];
40 }
41
42 sub TO_JSON {
43 "hoge";
44 }
45
OLDNEW
« no previous file with comments | « trunk/src/third_party/JSON/JSON-2.59/t/e10_bignum.t ('k') | trunk/src/third_party/JSON/JSON-2.59/t/e12_upgrade.t » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698