This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add Perl_current_re_engine() function
[perl5.git] / t / io / binmode.t
CommitLineData
e940ddbb
NC
1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
69026470 5 @INC = qw(. ../lib);
b5fe5ca2 6 require './test.pl';
3d273761
NC
7 eval 'use Errno';
8 die $@ if $@ and !is_miniperl();
e940ddbb
NC
9}
10
3d273761 11
b5fe5ca2 12plan(tests => 9);
69026470 13
e940ddbb 14ok( binmode(STDERR), 'STDERR made binary' );
3d273761
NC
15SKIP: {
16 skip('skip unix discipline without PerlIO layers', 1)
17 unless find PerlIO::Layer 'perlio';
18 ok( binmode(STDERR, ":unix"), ' with unix discipline' );
444e39b5 19}
e940ddbb
NC
20ok( binmode(STDERR, ":raw"), ' raw' );
21ok( binmode(STDERR, ":crlf"), ' and crlf' );
22
23# If this one fails, we're in trouble. So we just bail out.
24ok( binmode(STDOUT), 'STDOUT made binary' ) || exit(1);
3d273761
NC
25SKIP: {
26 skip('skip unix discipline without PerlIO layers', 1)
27 unless find PerlIO::Layer 'perlio';
28 ok( binmode(STDOUT, ":unix"), ' with unix discipline' );
444e39b5
NC
29}
30ok( binmode(STDOUT, ":raw"), ' raw' );
31ok( binmode(STDOUT, ":crlf"), ' and crlf' );
b5fe5ca2
SR
32
33SKIP: {
3d273761 34 skip "no EBADF", 1 unless exists &Errno::EBADF;
b5fe5ca2 35
013b78e8 36 no warnings 'io', 'once';
b5fe5ca2
SR
37 $! = 0;
38 binmode(B);
3d273761 39 cmp_ok($!, '==', Errno::EBADF());
b5fe5ca2 40}