Fix up tests to work around tie $handle
authorFather Chrysostomos <sprout@cpan.org>
Thu, 2 Dec 2010 17:38:02 +0000 (09:38 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 3 Dec 2010 01:45:06 +0000 (17:45 -0800)
t/op/gmagic.t
t/op/gv.t

index bc8a926..850f50d 100644 (file)
@@ -10,10 +10,11 @@ print "1..24\n";
 
 my $t = 1;
 tie my $c => 'Tie::Monitor';
+my $tied_to;
 
 sub ok {
     my($ok, $got, $exp, $rexp, $wexp) = @_;
-    my($rgot, $wgot) = (tied $c)->init(0);
+    my($rgot, $wgot) = ($tied_to || tied $c)->init(0);
     print $ok ? "ok $t\n" : "# expected $exp, got $got\nnot ok $t\n";
     ++$t;
     if ($rexp == $rgot && $wexp == $wgot) {
@@ -56,9 +57,11 @@ ok_string($s, '0', 1, 1);
 
 # Assignment should not ignore magic when the last thing assigned
 # was a glob
+$tied_to = tied $c;
 $c = *strat;
 $s = $c;
 ok_string $s, *strat, 1, 1;
+$tied_to = undef;
 
 # A plain *foo should not call get-magic on *foo.
 # This method of scalar-tying an immutable glob relies on details of the
index 862a0cf..e9fde9d 100644 (file)
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -825,6 +825,7 @@ pass('Can assign strings to typeglobs');
   tie my $a, "thrext";
   () = "$a"; # do a fetch; now $a holds a glob
   eval { *$a = sub{} };
+  eval { $a = undef }; # workaround for untie($handle) bug
   untie $a;
   eval { $a = "bar" };
   ::is $a, "bar",