Commit | Line | Data |
---|---|---|
d7dfc388 SK |
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 | ||
7 | use strict; | |
9a43387b SP |
8 | use Config; |
9 | ||
b5efbd1f | 10 | chdir 't' if -d 't'; |
d7dfc388 SK |
11 | require './test.pl'; |
12 | ||
13 | plan( tests => 16 ); | |
14 | ||
958e6d4b | 15 | my $test_prog = 'undef $!;while(<>){print}; print $!'; |
fcac5cf1 CB |
16 | my $saved_perlio; |
17 | ||
18 | BEGIN { | |
19 | $saved_perlio = $ENV{PERLIO}; | |
20 | } | |
21 | END { | |
22 | delete $ENV{PERLIO}; | |
23 | $ENV{PERLIO} = $saved_perlio if defined $saved_perlio; | |
24 | } | |
d7dfc388 SK |
25 | |
26 | for my $perlio ('perlio', 'stdio') { | |
27 | $ENV{PERLIO} = $perlio; | |
fcac5cf1 | 28 | SKIP: |
d7dfc388 | 29 | for my $test_in ("test\n", "test") { |
fcac5cf1 | 30 | skip("Guaranteed newline at EOF on VMS", 4) if $^O eq 'VMS' && $test_in eq 'test'; |
8e7f1f72 JH |
31 | # perl #71504 added skip in openbsd+threads+stdio; |
32 | # then commit 23705063 made -lpthread the default. | |
33 | skip("[perl #71504] OpenBSD test failures in errno.t with ithreads and perlio]; [perl #126306: openbsd t/io/errno.t tests fail randomly]", 8) | |
34 | if $^O eq 'openbsd' && $perlio eq 'stdio'; | |
d7dfc388 SK |
35 | my $test_in_esc = $test_in; |
36 | $test_in_esc =~ s/\n/\\n/g; | |
37 | for my $rs_code ('', '$/=undef', '$/=\2', '$/=\1024') { | |
ff26e4c8 CB |
38 | TODO: |
39 | { | |
d7dfc388 SK |
40 | is( runperl( prog => "$rs_code; $test_prog", |
41 | stdin => $test_in, stderr => 1), | |
42 | $test_in, | |
fcac5cf1 | 43 | "Wrong errno, PERLIO=$ENV{PERLIO} stdin='$test_in_esc', $rs_code"); |
ff26e4c8 | 44 | } |
d7dfc388 | 45 | } |
fcac5cf1 | 46 | } |
d7dfc388 | 47 | } |