1 | #!./perl -w
|
---|
2 |
|
---|
3 | BEGIN {
|
---|
4 | chdir 't' if -d 't';
|
---|
5 | @INC = qw(. ../lib);
|
---|
6 | require './test.pl';
|
---|
7 | }
|
---|
8 |
|
---|
9 | use Config;
|
---|
10 | BEGIN {
|
---|
11 | eval {require Errno; Errno->import;};
|
---|
12 | }
|
---|
13 | plan(tests => 9);
|
---|
14 |
|
---|
15 | ok( binmode(STDERR), 'STDERR made binary' );
|
---|
16 | if (find PerlIO::Layer 'perlio') {
|
---|
17 | ok( binmode(STDERR, ":unix"), ' with unix discipline' );
|
---|
18 | } else {
|
---|
19 | ok(1, ' skip unix discipline without PerlIO layers' );
|
---|
20 | }
|
---|
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);
|
---|
26 | if (find PerlIO::Layer 'perlio') {
|
---|
27 | ok( binmode(STDOUT, ":unix"), ' with unix discipline' );
|
---|
28 | } else {
|
---|
29 | ok(1, ' skip unix discipline without PerlIO layers' );
|
---|
30 | }
|
---|
31 | ok( binmode(STDOUT, ":raw"), ' raw' );
|
---|
32 | ok( binmode(STDOUT, ":crlf"), ' and crlf' );
|
---|
33 |
|
---|
34 | SKIP: {
|
---|
35 | skip "minitest", 1 if $ENV{PERL_CORE_MINITEST};
|
---|
36 | skip "no EBADF", 1 if (!exists &Errno::EBADF);
|
---|
37 |
|
---|
38 | no warnings 'io', 'once';
|
---|
39 | $! = 0;
|
---|
40 | binmode(B);
|
---|
41 | ok($! == &Errno::EBADF);
|
---|
42 | }
|
---|