summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAudrey Tang <cpan@audreyt.org>2002-02-18 03:46:47 +0800
committerArtur Bergman <sky@nanisky.com>2002-02-17 11:36:52 +0000
commit87582a92947b14e9eada0c156f266b59de2f8406 (patch)
tree144e2052c87bf49b887b0e6c224edf6317698fbc /t
parentf5cee1512fcf6895e1f72eb692b5716509ecd392 (diff)
downloadperl-87582a92947b14e9eada0c156f266b59de2f8406.tar.gz
Tied STDERR should catch messages from warn() and die()
Message-ID: <20020217194647.A1410@not.autrijus.org> p4raw-id: //depot/perl@14727
Diffstat (limited to 't')
-rwxr-xr-xt/op/tiehandle.t17
1 files changed, 15 insertions, 2 deletions
diff --git a/t/op/tiehandle.t b/t/op/tiehandle.t
index 7ae33514c9..257a613958 100755
--- a/t/op/tiehandle.t
+++ b/t/op/tiehandle.t
@@ -77,7 +77,7 @@ package main;
use Symbol;
-print "1..38\n";
+print "1..39\n";
my $fh = gensym;
@@ -160,7 +160,7 @@ ok($r == 1);
use warnings;
# Special case of aliasing STDERR, which used
# to dump core when warnings were enabled
- *STDERR = *$fh;
+ local *STDERR = *$fh;
@expect = (PRINT => $ob,"some","text");
$r = print STDERR @expect[2,3];
ok($r == 1);
@@ -217,3 +217,16 @@ ok($r == 1);
sub TIEARRAY {bless {}}
}
+{
+ # warnings should pass to the PRINT method of tied STDERR
+ my @received;
+
+ local *STDERR = *$fh;
+ local *Implement::PRINT = sub { @received = @_ };
+
+ $r = warn("some", "text", "\n");
+ @expect = (PRINT => $ob,"sometext\n");
+
+ Implement::compare(PRINT => @received);
+}
+