Move the require './test.pl' to the end of t/comp/hints.t
[p5sagit/p5-mst-13.2.git] / t / io / errno.t
CommitLineData
d7dfc388 1#!./perl
2# vim: ts=4 sts=4 sw=4:
3
4# $! may not be set if EOF was reached without any error.
5# http://rt.perl.org/rt3/Ticket/Display.html?id=39060
6
7use strict;
8require './test.pl';
9
10plan( tests => 16 );
11
12my $test_prog = 'while(<>){print}; print $!';
fcac5cf1 13my $saved_perlio;
14
15BEGIN {
16 $saved_perlio = $ENV{PERLIO};
17}
18END {
19 delete $ENV{PERLIO};
20 $ENV{PERLIO} = $saved_perlio if defined $saved_perlio;
21}
d7dfc388 22
23for my $perlio ('perlio', 'stdio') {
24 $ENV{PERLIO} = $perlio;
fcac5cf1 25SKIP:
d7dfc388 26 for my $test_in ("test\n", "test") {
fcac5cf1 27 skip("Guaranteed newline at EOF on VMS", 4) if $^O eq 'VMS' && $test_in eq 'test';
d7dfc388 28 my $test_in_esc = $test_in;
29 $test_in_esc =~ s/\n/\\n/g;
30 for my $rs_code ('', '$/=undef', '$/=\2', '$/=\1024') {
31 is( runperl( prog => "$rs_code; $test_prog",
32 stdin => $test_in, stderr => 1),
33 $test_in,
fcac5cf1 34 "Wrong errno, PERLIO=$ENV{PERLIO} stdin='$test_in_esc', $rs_code");
d7dfc388 35 }
fcac5cf1 36 }
d7dfc388 37}