Converted all ->print(...) to print( ...)
[dbsrgits/DBM-Deep.git] / t / 09_deeparray.t
CommitLineData
ffed8b01 1##
2# DBM::Deep Test
3##
4use strict;
5use Test::More;
6
7my $max_levels = 1000;
8
9plan tests => $max_levels + 3;
10
11use_ok( 'DBM::Deep' );
12
13unlink "t/test.db";
14my $db = DBM::Deep->new(
15 file => "t/test.db",
16 type => DBM::Deep->TYPE_ARRAY,
17);
18if ($db->error()) {
19 die "ERROR: " . $db->error();
20}
21
22$db->[0] = [];
23my $temp_db = $db->[0];
24for my $k ( 0 .. $max_levels ) {
25 $temp_db->[$k] = [];
26 $temp_db = $temp_db->[$k];
27}
28$temp_db->[0] = "deepvalue";
29undef $temp_db;
30
31undef $db;
32$db = DBM::Deep->new(
33 file => "t/test.db",
34 type => DBM::Deep->TYPE_ARRAY,
35);
36
37$temp_db = $db->[0];
38for my $k ( 0 .. $max_levels ) {
39 $temp_db = $temp_db->[$k];
40 isa_ok( $temp_db, 'DBM::Deep' ) || die "Whoops!";
41}
42is( $temp_db->[0], "deepvalue", "And we retrieved the value at the bottom of the ocean" );