diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-03-06 21:21:10 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-03-06 22:48:15 +0000 |
commit | 3d27376121e12fdf0629aa994dc7d07910a5606d (patch) | |
tree | a7710cb958d6d4a9d0096945637738bc28923b2a /t/io/binmode.t | |
parent | caedc70ba6260eef7c753adf315b14a90252192d (diff) | |
download | perl-3d27376121e12fdf0629aa994dc7d07910a5606d.tar.gz |
Tidy t/io/binmode.t
Remove redundant C<use Config;>
If C<find PerlIO::Layer 'perlio'> fails, use skip() rather than ok() to skip.
Make the indenting on 2 inconsistent lines consistent with the rest of the file.
Die if Errno can't be loaded, unless it's miniperl.
Diffstat (limited to 't/io/binmode.t')
-rw-r--r-- | t/io/binmode.t | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/t/io/binmode.t b/t/io/binmode.t index 41eff4a24f..473261e38a 100644 --- a/t/io/binmode.t +++ b/t/io/binmode.t @@ -4,39 +4,37 @@ BEGIN { chdir 't' if -d 't'; @INC = qw(. ../lib); require './test.pl'; + eval 'use Errno'; + die $@ if $@ and !is_miniperl(); } -use Config; -BEGIN { - eval {require Errno; Errno->import;}; -} + plan(tests => 9); ok( binmode(STDERR), 'STDERR made binary' ); -if (find PerlIO::Layer 'perlio') { - ok( binmode(STDERR, ":unix"), ' with unix discipline' ); -} else { - ok(1, ' skip unix discipline without PerlIO layers' ); +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); -if (find PerlIO::Layer 'perlio') { - ok( binmode(STDOUT, ":unix"), ' with unix discipline' ); -} else { - ok(1, ' skip unix discipline without PerlIO layers' ); +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 "minitest", 1 if $ENV{PERL_CORE_MINITEST}; - skip "no EBADF", 1 if (!exists &Errno::EBADF); + skip "no EBADF", 1 unless exists &Errno::EBADF; no warnings 'io', 'once'; $! = 0; binmode(B); - ok($! == &Errno::EBADF); + cmp_ok($!, '==', Errno::EBADF()); } |