summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
authorStepan Kasal <skasal@redhat.com>2009-06-03 12:03:55 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-06-08 14:06:10 +0200
commitd7dfc388e04f41b8a0f5d8ef6e15ab3b79f483c8 (patch)
treef47e9a43533facce67be0f722e2e561d3129cbeb /t/io
parente39d780342f3e91579069fdc80eda72bfe639ae7 (diff)
downloadperl-d7dfc388e04f41b8a0f5d8ef6e15ab3b79f483c8.tar.gz
fix RT 39060, errno incorrectly set in perlio
Diffstat (limited to 't/io')
-rw-r--r--t/io/errno.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/io/errno.t b/t/io/errno.t
new file mode 100644
index 0000000000..b55e3db6bb
--- /dev/null
+++ b/t/io/errno.t
@@ -0,0 +1,26 @@
+#!./perl
+# vim: ts=4 sts=4 sw=4:
+
+# $! may not be set if EOF was reached without any error.
+# http://rt.perl.org/rt3/Ticket/Display.html?id=39060
+
+use strict;
+require './test.pl';
+
+plan( tests => 16 );
+
+my $test_prog = 'while(<>){print}; print $!';
+
+for my $perlio ('perlio', 'stdio') {
+ $ENV{PERLIO} = $perlio;
+ for my $test_in ("test\n", "test") {
+ my $test_in_esc = $test_in;
+ $test_in_esc =~ s/\n/\\n/g;
+ for my $rs_code ('', '$/=undef', '$/=\2', '$/=\1024') {
+ is( runperl( prog => "$rs_code; $test_prog",
+ stdin => $test_in, stderr => 1),
+ $test_in,
+ "Wrong errno, PERLIO=$ENV{PERLIO} stdin='$test_in_esc'");
+ }
+ }
+}