diff options
author | Michael G. Schwern <schwern@pobox.com> | 2008-01-02 09:08:36 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-01-06 16:03:13 +0000 |
commit | 3a28f3fb1bfd44e4e3dfe6842af867c8c1c9de28 (patch) | |
tree | c9a77da0789972574a11b9da07bc9d124e969ec3 /t | |
parent | e1f17637d1ade6d468d3aebe31c7b7a17f6fc053 (diff) | |
download | perl-3a28f3fb1bfd44e4e3dfe6842af867c8c1c9de28.tar.gz |
Re: [perl #49264] say behaves as just print on tied filehandle
Message-ID: <477C3594.9080302@pobox.com>
p4raw-id: //depot/perl@32873
Diffstat (limited to 't')
-rwxr-xr-x | t/op/tiehandle.t | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/t/op/tiehandle.t b/t/op/tiehandle.t index c679c580e6..735a25c071 100755 --- a/t/op/tiehandle.t +++ b/t/op/tiehandle.t @@ -10,9 +10,11 @@ my $data = ""; my @data = (); require './test.pl'; -plan(tests => 41); +plan(tests => 50); sub compare { + local $Level = $Level + 1; + return unless @expect; return ::fail() unless(@_ == @expect); @@ -163,6 +165,32 @@ is($r, 1); } { + package Bar::Say; + use feature 'say'; + use base qw(Implement); + + my $ors; + sub PRINT { + $ors = $\; + my $self = shift; + return $self->SUPER::PRINT(@_); + } + + my $fh = Symbol::gensym; + @expect = (TIEHANDLE => 'Bar::Say'); + ::ok( my $obj = tie *$fh, 'Bar::Say' ); + + local $\ = 'something'; + @expect = (PRINT => $obj, "stuff", "and", "things"); + ::ok( print $fh @expect[2..4] ); + ::is( $ors, 'something' ); + + ::ok( say $fh @expect[2..4] ); + ::is( $ors, "\n", 'say sets $\ to \n in PRINT' ); + ::is( $\, "something", " and it's localized" ); +} + +{ # Test for change #11536 package Foo; use strict; @@ -245,4 +273,3 @@ is($r, 1); sub READLINE { "foobar\n" } } - |