test that $\ is localized and restored even if it was undef
authorRicardo Signes <rjbs@cpan.org>
Sat, 21 Sep 2013 05:51:36 +0000 (14:51 +0900)
committerRicardo Signes <rjbs@cpan.org>
Sat, 21 Sep 2013 05:52:39 +0000 (14:52 +0900)
This was broken before 4bac9ae47b5ad7845a24e26b0e95609805de688a
but there is no test, and it is not clear that we knew about
the bug or the fix.

t/op/tiehandle.t

index dbd0846..08a20eb 100644 (file)
@@ -10,7 +10,7 @@ my $data = "";
 my @data = ();
 
 require './test.pl';
-plan(tests => 63);
+plan(tests => 67);
 
 sub compare {
     local $Level = $Level + 1;
@@ -199,6 +199,11 @@ is($r, 1);
     ::ok( say $fh @expect[2..4] );
     ::is( $ors, "\n",        'say sets $\ to \n in PRINT' );
     ::is( $\,   "something", "  and it's localized" );
+
+    local $\;
+    ::ok( say $fh @expect[2..4] );
+    ::is( $ors, "\n",        'say sets $\ to \n in PRINT' );
+    ::is( $\,   undef, "  and it's localized, even for undef \$\\" );
 }
 
 {