mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
Use set_up_inc when require.pl is loaded move plan outside of BEGIN block when no tests are run at BEGIN time. Using set_up_inc allow to run these tests under minitest but also compile them using B::C. This also has the advantage to use a single control point for @INC setup. Note: some tests cannot use 'require test.pl', unshfit is then used for them.
41 lines
1.0 KiB
Perl
41 lines
1.0 KiB
Perl
#!./perl -w
|
|
|
|
BEGIN {
|
|
chdir 't' if -d 't';
|
|
require './test.pl';
|
|
set_up_inc(qw(. ../lib));
|
|
eval 'use Errno';
|
|
die $@ if $@ and !is_miniperl();
|
|
}
|
|
|
|
|
|
plan(tests => 9);
|
|
|
|
ok( binmode(STDERR), 'STDERR made binary' );
|
|
SKIP: {
|
|
skip('skip unix discipline without PerlIO layers', 1)
|
|
unless find PerlIO::Layer 'perlio';
|
|
ok( binmode(STDERR, ":unix"), ' with unix discipline' );
|
|
}
|
|
ok( binmode(STDERR, ":raw"), ' raw' );
|
|
ok( binmode(STDERR, ":crlf"), ' and crlf' );
|
|
|
|
# If this one fails, we're in trouble. So we just bail out.
|
|
ok( binmode(STDOUT), 'STDOUT made binary' ) || exit(1);
|
|
SKIP: {
|
|
skip('skip unix discipline without PerlIO layers', 1)
|
|
unless find PerlIO::Layer 'perlio';
|
|
ok( binmode(STDOUT, ":unix"), ' with unix discipline' );
|
|
}
|
|
ok( binmode(STDOUT, ":raw"), ' raw' );
|
|
ok( binmode(STDOUT, ":crlf"), ' and crlf' );
|
|
|
|
SKIP: {
|
|
skip "no EBADF", 1 unless exists &Errno::EBADF;
|
|
|
|
no warnings 'io', 'once';
|
|
$! = 0;
|
|
binmode(B);
|
|
cmp_ok($!, '==', Errno::EBADF());
|
|
}
|