Commit | Line | Data |
---|---|---|
e940ddbb NC |
1 | #!./perl -w |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
69026470 | 5 | @INC = qw(. ../lib); |
b5fe5ca2 | 6 | require './test.pl'; |
e940ddbb NC |
7 | } |
8 | ||
444e39b5 | 9 | use Config; |
43651d81 NC |
10 | BEGIN { |
11 | eval {require Errno; Errno->import;}; | |
12 | } | |
b5fe5ca2 | 13 | plan(tests => 9); |
69026470 | 14 | |
e940ddbb | 15 | ok( binmode(STDERR), 'STDERR made binary' ); |
6b5da1a3 | 16 | if (find PerlIO::Layer 'perlio') { |
444e39b5 NC |
17 | ok( binmode(STDERR, ":unix"), ' with unix discipline' ); |
18 | } else { | |
6b5da1a3 | 19 | ok(1, ' skip unix discipline without PerlIO layers' ); |
444e39b5 | 20 | } |
e940ddbb NC |
21 | ok( binmode(STDERR, ":raw"), ' raw' ); |
22 | ok( binmode(STDERR, ":crlf"), ' and crlf' ); | |
23 | ||
24 | # If this one fails, we're in trouble. So we just bail out. | |
25 | ok( binmode(STDOUT), 'STDOUT made binary' ) || exit(1); | |
6b5da1a3 | 26 | if (find PerlIO::Layer 'perlio') { |
444e39b5 NC |
27 | ok( binmode(STDOUT, ":unix"), ' with unix discipline' ); |
28 | } else { | |
6b5da1a3 | 29 | ok(1, ' skip unix discipline without PerlIO layers' ); |
444e39b5 NC |
30 | } |
31 | ok( binmode(STDOUT, ":raw"), ' raw' ); | |
32 | ok( binmode(STDOUT, ":crlf"), ' and crlf' ); | |
b5fe5ca2 SR |
33 | |
34 | SKIP: { | |
43651d81 | 35 | skip "minitest", 1 if $ENV{PERL_CORE_MINITEST}; |
b5fe5ca2 SR |
36 | skip "no EBADF", 1 if (!exists &Errno::EBADF); |
37 | ||
013b78e8 | 38 | no warnings 'io', 'once'; |
b5fe5ca2 SR |
39 | $! = 0; |
40 | binmode(B); | |
41 | ok($! == &Errno::EBADF); | |
42 | } |