Skip to content

Commit

Permalink
Storable: add testcase for #257
Browse files Browse the repository at this point in the history
detected by CPAN,
wrong recursion warning with CPAN write_metadata_cache.
There's no recursion involved, just nesting a hash into a big
array will fail.
  • Loading branch information
rurban committed Mar 5, 2017
1 parent d002edb commit 2804828
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dist/Storable/t/recurse.t
Expand Up @@ -20,7 +20,7 @@ use Storable qw(freeze thaw dclone);

$Storable::flags = Storable::FLAGS_COMPAT;

use Test::More tests => 37;
use Test::More tests => 38;

package OBJ_REAL;

Expand Down Expand Up @@ -328,10 +328,18 @@ is($refcount_ok, 1);
dclone $t;
pass "can nest 550 hash refs";
}
{
my (@t);
push @t, [{}] for 1..5000;
#diag 'trying simple array[5000] stack overflow, no recursion';
dclone \@t;
is $@, '', 'No simple array[5000] stack overflow #257';
}
{
eval {
my $t;
$t = [$t] for 1..10000;
diag 'trying catching recursive aref stack overflow';
dclone $t;
};
like $@, qr/Max\. recursion depth with nested structures exceeded/,
Expand All @@ -347,6 +355,7 @@ else {
my $t;
# 5.000 will cause appveyor 64bit windows to fail earlier
$t = {1=>$t} for 1..5000;
diag 'trying catching recursive href stack overflow';
dclone $t;
};
like $@, qr/Max\. recursion depth with nested structures exceeded/,
Expand Down

0 comments on commit 2804828

Please sign in to comment.