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

Comparing JSON-XS/t/19_incr.t (file contents):
Revision 1.2 by root, Wed Mar 26 02:35:45 2008 UTC vs.
Revision 1.3 by root, Sat Apr 5 18:15:47 2008 UTC

1#! perl 1#! perl
2 2
3use strict; 3use strict;
4no warnings; 4no warnings;
5use Test::More; 5use Test::More;
6BEGIN { plan tests => 689 }; 6BEGIN { plan tests => 693 };
7 7
8use JSON::XS; 8use JSON::XS;
9 9
10sub splitter { 10sub splitter {
11 my ($coder, $text) = @_; 11 my ($coder, $text) = @_;
61 ok (!eval { $coder->incr_parse }, "sparse2"); 61 ok (!eval { $coder->incr_parse }, "sparse2");
62 $coder->incr_skip; 62 $coder->incr_skip;
63 ok ('[5]' eq $coder->encode (scalar $coder->incr_parse), "sparse3"); 63 ok ('[5]' eq $coder->encode (scalar $coder->incr_parse), "sparse3");
64} 64}
65 65
66{
67 my $coder = JSON::XS->new->max_size (5);
68 ok (!$coder->incr_parse ("[ "), "incsize1");
69 eval { !$coder->incr_parse ("] ") }; ok ($@ =~ /6 bytes/, "incsize2 $@");
70}
71
72{
73 my $coder = JSON::XS->new->max_depth (3);
74 ok (!$coder->incr_parse ("[[["), "incdepth1");
75 eval { !$coder->incr_parse (" [] ") }; ok ($@ =~ /maximum nesting/, "incdepth2 $@");
76}
77
78

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines