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