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

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

Powered by Google App Engine
This is Rietveld 408576698