--- JSON-XS/t/19_incr.t 2008/03/26 02:35:45 1.2 +++ JSON-XS/t/19_incr.t 2008/04/05 18:15:47 1.3 @@ -3,7 +3,7 @@ use strict; no warnings; use Test::More; -BEGIN { plan tests => 689 }; +BEGIN { plan tests => 693 }; use JSON::XS; @@ -63,3 +63,16 @@ ok ('[5]' eq $coder->encode (scalar $coder->incr_parse), "sparse3"); } +{ + my $coder = JSON::XS->new->max_size (5); + ok (!$coder->incr_parse ("[ "), "incsize1"); + eval { !$coder->incr_parse ("] ") }; ok ($@ =~ /6 bytes/, "incsize2 $@"); +} + +{ + my $coder = JSON::XS->new->max_depth (3); + ok (!$coder->incr_parse ("[[["), "incdepth1"); + eval { !$coder->incr_parse (" [] ") }; ok ($@ =~ /maximum nesting/, "incdepth2 $@"); +} + +