Skip to content

Commit cb3aaa8

Browse files
rurbantonycoz
authored andcommitted
Storable: add testcase for #257
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. (cherry picked from commit 2804828)
1 parent 5ddb8f4 commit cb3aaa8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dist/Storable/t/recurse.t

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use Storable qw(freeze thaw dclone);
2020

2121
$Storable::flags = Storable::FLAGS_COMPAT;
2222

23-
use Test::More tests => 37;
23+
use Test::More tests => 38;
2424

2525
package OBJ_REAL;
2626

@@ -327,10 +327,18 @@ is($refcount_ok, 1);
327327
dclone $t;
328328
pass "can nest 550 hash refs";
329329
}
330+
{
331+
my (@t);
332+
push @t, [{}] for 1..5000;
333+
#diag 'trying simple array[5000] stack overflow, no recursion';
334+
dclone \@t;
335+
is $@, '', 'No simple array[5000] stack overflow #257';
336+
}
330337
{
331338
eval {
332339
my $t;
333340
$t = [$t] for 1..10000;
341+
diag 'trying catching recursive aref stack overflow';
334342
dclone $t;
335343
};
336344
like $@, qr/Max\. recursion depth with nested structures exceeded/,
@@ -346,6 +354,7 @@ else {
346354
my $t;
347355
# 5.000 will cause appveyor 64bit windows to fail earlier
348356
$t = {1=>$t} for 1..5000;
357+
diag 'trying catching recursive href stack overflow';
349358
dclone $t;
350359
};
351360
like $@, qr/Max\. recursion depth with nested structures exceeded/,

0 commit comments

Comments
 (0)