From: rkinyon Date: Mon, 20 Feb 2006 19:53:16 +0000 (+0000) Subject: Renamed to remove from auto-running X-Git-Tag: 0-97~34 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=76a2eb580ab1c50be8ddadfceaf4f2f7dc8a6d78;p=dbsrgits%2FDBM-Deep.git Renamed to remove from auto-running --- diff --git a/t/autobless_2.t_fail b/t/autobless_2.t_fail new file mode 100644 index 0000000..d46589f --- /dev/null +++ b/t/autobless_2.t_fail @@ -0,0 +1,67 @@ +use strict; +$|++; + +{ + package Foo; + + sub export { 'export' }; + sub foo { 'foo' }; +} + +use Test::More no_plan => 1; + +use_ok( 'DBM::Deep' ); + +unlink 't/test.db'; +my $db = DBM::Deep->new( + file => "t/test.db", + autobless => 0, +); +if ($db->error()) { + die "ERROR: " . $db->error(); +} + +$db->{unblessed} = {}; +$db->{unblessed}{a} = 1; +$db->{unblessed}{b} = []; +$db->{unblessed}{b}[0] = 1; +$db->{unblessed}{b}[1] = 2; +$db->{unblessed}{b}[2] = 3; + +undef $db; + +my $db2 = DBM::Deep->new( + file => 't/test.db', + autobless => 1, +); +if ($db2->error()) { + die "ERROR: " . $db2->error(); +} + +is( $db2->{unblessed}{a}, 1 ); +is( $db2->{unblessed}{b}[0], 1 ); +is( $db2->{unblessed}{b}[1], 2 ); +is( $db2->{unblessed}{b}[2], 3 ); + +$db2->{unblessed}{a} = 2; + +is( $db2->{unblessed}{a}, 2 ); +is( $db2->{unblessed}{b}[0], 1 ); +is( $db2->{unblessed}{b}[1], 2 ); +is( $db2->{unblessed}{b}[2], 3 ); + +undef $db2; + +my $db3 = DBM::Deep->new( + file => "t/test.db", + autobless => 0, +); +if ($db3->error()) { + die "ERROR: " . $db->error(); +} + +is( $db3->{unblessed}{a}, 2 ); +is( $db3->{unblessed}{b}[0], 1 ); +__END__ +is( $db3->{unblessed}{b}[1], 2 ); +is( $db3->{unblessed}{b}[2], 3 );