ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/t/13_limit.t
Revision: 1.3
Committed: Tue Apr 3 23:59:04 2007 UTC (17 years, 2 months ago) by root
Content type: application/x-troff
Branch: MAIN
Changes since 1.2: +2 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 BEGIN { $| = 1; print "1..7\n"; }
2
3 use JSON::XS;
4
5 our $test;
6 sub ok($;$) {
7 print $_[0] ? "" : "not ", "ok ", ++$test, "\n";
8 }
9
10 my $js = JSON::XS->new;
11
12 ok (ref $js->decode (("[" x 512) . ("]" x 512)));
13 ok (ref $js->decode (("{\"\":" x 511) . "[]" . ("}" x 511)));
14 ok (ref $js->max_depth (32)->decode (("[" x 32) . ("]" x 32)));
15
16 ok ($js->max_depth(1)->encode ([]));
17 ok (!eval { $js->encode ([[]]), 1 });
18
19 ok ($js->max_depth(2)->encode ([{}]));
20 ok (!eval { $js->encode ([[{}]]), 1 });
21