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