From: rkinyon Date: Mon, 20 Feb 2006 18:03:31 +0000 (+0000) Subject: Failing test for scalar refs X-Git-Tag: 0-97~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8026397490b26a23cb8790c2495b71d7338fa85;p=dbsrgits%2FDBM-Deep.git Failing test for scalar refs --- diff --git a/MANIFEST b/MANIFEST index 64212fb..4c5a94a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -32,3 +32,4 @@ t/22_internal_copy.t t/23_misc.t t/24_autobless.t t/25_tie_return_value.t +t/26_scalar_ref.t diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index b36f78a..d241003 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -264,6 +264,7 @@ sub _open { my $tag = $self->_load_tag($self->base_offset); #XXX We probably also want to store the hash algorithm name and not assume anything +#XXX The cool thing would be to allow a different hashing algorithm at every level if (!$tag) { return $self->_throw_error("Corrupted file, no master index record"); diff --git a/t/26_scalar_ref.t b/t/26_scalar_ref.t new file mode 100644 index 0000000..0de6cde --- /dev/null +++ b/t/26_scalar_ref.t @@ -0,0 +1,42 @@ +use strict; + +use Test::More tests => 7; + +use_ok( 'DBM::Deep' ); + +unlink "t/test.db"; +{ + my $db = DBM::Deep->new( "t/test.db" ); + if ($db->error()) { + die "ERROR: " . $db->error(); + } + + my $x = 25; + my $y = 30; + $db->{scalar} = $x; + $db->{scalarref} = \$y; + $db->{selfref} = \$x; + + is( $db->{scalar}, $x, "Scalar retrieved ok" ); + TODO: { + todo_skip "Scalar refs aren't implemented yet", 2; + is( ${$db->{scalarref}}, 30, "Scalarref retrieved ok" ); + is( ${$db->{selfref}}, 25, "Scalarref to stored scalar retrieved ok" ); + } +} + +{ + my $db = DBM::Deep->new( "t/test.db" ); + if ($db->error()) { + die "ERROR: " . $db->error(); + } + + my $x = 25; + my $y = 30; + is( $db->{scalar}, $x, "Scalar retrieved ok" ); + TODO: { + todo_skip "Scalar refs aren't implemented yet", 2; + is( ${$db->{scalarref}}, 30, "Scalarref retrieved ok" ); + is( ${$db->{selfref}}, 25, "Scalarref to stored scalar retrieved ok" ); + } +}