Commit | Line | Data |
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 | |
7 | use strict; |
8 | require './test.pl'; |
9 | |
10 | plan( tests => 16 ); |
11 | |
12 | my $test_prog = 'while(<>){print}; print $!'; |
fcac5cf1 |
13 | my $saved_perlio; |
14 | |
15 | BEGIN { |
16 | $saved_perlio = $ENV{PERLIO}; |
17 | } |
18 | END { |
19 | delete $ENV{PERLIO}; |
20 | $ENV{PERLIO} = $saved_perlio if defined $saved_perlio; |
21 | } |
d7dfc388 |
22 | |
23 | for my $perlio ('perlio', 'stdio') { |
24 | $ENV{PERLIO} = $perlio; |
fcac5cf1 |
25 | SKIP: |
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 | } |