edec0d9310e86c908cf8dfda853bb52971bed90e
[dbsrgits/DBM-Deep.git] / t / 55_recursion.t
1 use strict;
2 use warnings FATAL => 'all';
3
4 use Test::More;
5 use Test::Exception;
6 use t::common qw( new_dbm );
7
8 use_ok( 'DBM::Deep' );
9
10 my $dbm_factory = new_dbm();
11 while ( my $dbm_maker = $dbm_factory->() ) {
12     my $db = $dbm_maker->();
13
14     my $h = {};
15     my $tmp = $h;
16     for (1..4) { # 98 is ok, 99 is bad.
17         %$tmp = ("" => {});
18         $tmp = $tmp->{""};
19     }
20     lives_ok {
21         $db->{""} = $h;
22     } 'deep recursion causes no errors';
23 }
24
25 done_testing;