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