Uncomment and fix up tests at the end of Storable's blessed.t
authorNicholas Clark <nick@ccl4.org>
Tue, 7 Dec 2010 14:44:27 +0000 (14:44 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 7 Dec 2010 14:44:27 +0000 (14:44 +0000)
These tests have never been "live", having been added, commented out, in 2004
as part of 754c00caaffe2ec6. The trick to make them work is to delete from the
symbol table, rather than merely attempting to undefine the subroutine.

dist/Storable/t/blessed.t

index 7c0494c..657d23f 100644 (file)
@@ -27,7 +27,7 @@ use Storable qw(freeze thaw);
 );
 
 my $test = 12;
-my $tests = $test + 6 + 2 * 6 * keys %::immortals;
+my $tests = $test + 10 + 2 * 6 * keys %::immortals;
 print "1..$tests\n";
 
 package SHORT_NAME;
@@ -183,13 +183,11 @@ ok ++$test, $HAS_HOOK::thawed_count == 1;
 ok ++$test, $t;
 ok ++$test, ref $t eq 'HAS_HOOK';
 
-# Can't do this because the method is still cached by UNIVERSAL::can
-# delete $INC{"HAS_HOOK.pm"};
-# undef &HAS_HOOK::STORABLE_thaw;
-# 
-# warn HAS_HOOK->can('STORABLE_thaw');
-# $t = thaw $f;
-# ok ++$test, $HAS_HOOK::loaded_count == 2;
-# ok ++$test, $HAS_HOOK::thawed_count == 2;
-# ok ++$test, $t;
-# ok ++$test, ref $t eq 'HAS_HOOK';
+delete $INC{"HAS_HOOK.pm"};
+delete $HAS_HOOK::{STORABLE_thaw};
+
+$t = thaw $f;
+ok ++$test, $HAS_HOOK::loaded_count == 2;
+ok ++$test, $HAS_HOOK::thawed_count == 2;
+ok ++$test, $t;
+ok ++$test, ref $t eq 'HAS_HOOK';