summaryrefslogtreecommitdiff
path: root/cpan/Tie-RefHash/t
diff options
context:
space:
mode:
authorFlorian Ragwitz <rafl@debian.org>2011-02-25 18:30:18 +0100
committerFlorian Ragwitz <rafl@debian.org>2011-02-25 18:30:18 +0100
commitc34a735eb8190cd7cf9d4956d849b2f0d91d397d (patch)
treec3a0d80a9ceb611dd2e16da95197f8eb08470dba /cpan/Tie-RefHash/t
parentee999586fe75fe0bba44247626493f792df9697a (diff)
downloadperl-c34a735eb8190cd7cf9d4956d849b2f0d91d397d.tar.gz
Upgrade Tie::RefHash from version 1.38 to 1.39
Diffstat (limited to 'cpan/Tie-RefHash/t')
-rw-r--r--cpan/Tie-RefHash/t/storable.t21
-rw-r--r--cpan/Tie-RefHash/t/threaded.t2
2 files changed, 20 insertions, 3 deletions
diff --git a/cpan/Tie-RefHash/t/storable.t b/cpan/Tie-RefHash/t/storable.t
index 6c28b77a54..260622bd6f 100644
--- a/cpan/Tie-RefHash/t/storable.t
+++ b/cpan/Tie-RefHash/t/storable.t
@@ -21,7 +21,7 @@ use Tie::RefHash;
use Storable qw/dclone nfreeze thaw/;
$\ = "\n";
-print "1..24";
+print "1..42";
sub ok ($$) {
print ( ( $_[0] ? "" : "not " ), "ok - $_[1]" );
@@ -47,7 +47,7 @@ foreach my $clone ( \%hash, dclone(\%hash), thaw(nfreeze(\%hash)) ){
isa_ok( tied(%$clone), "Tie::RefHash" );
my @keys = keys %$clone;
- is( scalar(@keys), 2, "one key in clone");
+ is( scalar(@keys), 2, "two keys in clone");
my $key = ref($keys[0]) ? shift @keys : pop @keys;
my $reg = $keys[0];
@@ -60,4 +60,21 @@ foreach my $clone ( \%hash, dclone(\%hash), thaw(nfreeze(\%hash)) ){
is( $clone->{$reg}, "other", "and is also a valid key" );
}
+tie my %only_refs, "Tie::RefHash";
+$only_refs{$key} = "value";
+
+foreach my $clone ( \%only_refs, dclone(\%only_refs), thaw(nfreeze(\%only_refs)) ){
+
+ ok( tied(%$clone), "copy is tied");
+ isa_ok( tied(%$clone), "Tie::RefHash" );
+
+ my @keys = keys %$clone;
+ is( scalar(@keys), 1, "one key in clone");
+ my $key = $keys[0];
+
+ ok( ref($key), "key is a ref after clone" );
+ is( $key->{foo}, 1, "key serialized ok");
+
+ is( $clone->{$key}, "value", "and is still pointing at the same value" );
+}
diff --git a/cpan/Tie-RefHash/t/threaded.t b/cpan/Tie-RefHash/t/threaded.t
index 7e4fa1a7f0..8767f97980 100644
--- a/cpan/Tie-RefHash/t/threaded.t
+++ b/cpan/Tie-RefHash/t/threaded.t
@@ -21,7 +21,7 @@ BEGIN {
}
if ( $Config{usethreads} and !$Config{use5005threads}
and defined(&Scalar::Util::weaken)
- and eval { require threads; "threads"->import }
+ and eval { require threads; threads->import; 1 }
) {
print "1..14\n";
} else {