Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 07b47fc13b
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (27 sloc) 0.703 kB
#copied over from JSON::XS and ported to JSON::SL
use Test::More;
use JSON::SL qw(decode_json);
use Data::Dumper;
my $def = 512;
my $sl;
ok (!eval { decode_json (("[" x ($def + 1)) . ("]" x ($def + 1))) });
ok (ref decode_json (("[" x $def) . ("]" x $def)));
ok (ref decode_json (("{\"\":" x ($def - 1)) . "[]" . ("}" x ($def - 1))));
ok (!eval { decode_json (("{\"\":" x $def) . "[]" . ("}" x $def)) });
{
$sl = JSON::SL->new(32);
ok (ref $sl->feed(("[" x 32) . ("]" x 32)));
}
{
$sl = JSON::SL->new(32);
$sl->max_size(8);
ok (
eval { ref $sl->feed("[ ]") }
);
$sl->reset();
eval {
$sl->feed("[ ]");
};
ok ($@ =~ /max_size/);
}
done_testing();
Jump to Line
Something went wrong with that request. Please try again.