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