ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/t/12_blessed.t
(Generate patch)

Comparing JSON-XS/t/12_blessed.t (file contents):
Revision 1.1 by root, Sun Jul 1 22:20:00 2007 UTC vs.
Revision 1.2 by root, Mon Jul 2 00:48:18 2007 UTC

1BEGIN { $| = 1; print "1..6\n"; } 1BEGIN { $| = 1; print "1..15\n"; }
2 2
3use JSON::XS; 3use JSON::XS;
4 4
5our $test; 5our $test;
6sub ok($;$) { 6sub ok($;$) {
23ok ($js->encode ($o2) eq "null"); 23ok ($js->encode ($o2) eq "null");
24$js->convert_blessed; 24$js->convert_blessed;
25ok ($js->encode ($o1) eq '{"__":""}'); 25ok ($js->encode ($o1) eq '{"__":""}');
26ok ($js->encode ($o2) eq "null"); 26ok ($js->encode ($o2) eq "null");
27 27
28$js->filter_json_object (sub { 5 });
29$js->filter_json_single_key_object (sub { 6 });
30
31ok ("ARRAY" eq ref $js->decode ("[]"));
32ok (5 eq join ":", @{ $js->decode ('[{}]') });
33ok (6 eq join ":", @{ $js->decode ('[{"a":4}]') });
34ok (5 eq join ":", @{ $js->decode ('[{"a":4,"b":7}]') });
35
36$js->filter_json_object;
37ok (7 == $js->decode ('[{"a":4,"b":7}]')->[0]{b});
38ok (6 eq join ":", @{ $js->decode ('[{"a":4}]') });
39
40$js->filter_json_object (sub { });
41ok (7 == $js->decode ('[{"a":4,"b":7}]')->[0]{b});
42ok (6 eq join ":", @{ $js->decode ('[{"a":4}]') });
43
44$js->filter_json_single_key_object (sub { });
45ok (4 == $js->decode ('[{"a":4}]')->[0]{a});
46

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines