From: rkinyon Date: Fri, 17 Feb 2006 03:00:59 +0000 (+0000) Subject: Added a test for export() + autobless => 1 X-Git-Tag: 0-97~57 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9cb06093d83d721f635e97f29a21d4aefd78b6c7;p=dbsrgits%2FDBM-Deep.git Added a test for export() + autobless => 1 --- diff --git a/t/24_autobless.t b/t/24_autobless.t index ecd1935..93fe857 100644 --- a/t/24_autobless.t +++ b/t/24_autobless.t @@ -7,7 +7,7 @@ use strict; sub foo { 'foo' }; } -use Test::More tests => 24; +use Test::More tests => 26; use_ok( 'DBM::Deep' ); @@ -86,3 +86,39 @@ is( $db3->{unblessed}{a}, 1 ); is( $db3->{unblessed}{b}[0], 1 ); is( $db3->{unblessed}{b}[1], 2 ); is( $db3->{unblessed}{b}[2], 3 ); + +undef $db; +undef $db2; +undef $db3; + +{ + unlink 't/test.db'; + my $db = DBM::Deep->new( + file => "t/test.db", + autobless => 1, + ); + if ($db->error()) { + die "ERROR: " . $db->error(); + } + + my $obj = bless { + a => 1, + b => [ 1 .. 3 ], + }, 'Foo'; + + $db->import( { blessed => $obj } ); + + undef $db; + + $db = DBM::Deep->new( + file => "t/test.db", + autobless => 1, + ); + if ($db->error()) { + die "ERROR: " . $db->error(); + } + + my $blessed = $db->{blessed}; + isa_ok( $blessed, 'Foo' ); + is( $blessed->{a}, 1 ); +}