X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fio%2Fread.t;h=2665ecb9210d6745dabc142314de77c914716ad5;hb=ac27d13b824657b726428f3a6a1d5b3a01df569e;hp=16d32b189c84b5e9dae3a3b1cc84b44a68be1de8;hpb=93c1eb4fb43cf276851ff0a3e758384d1a1d5850;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/io/read.t b/t/io/read.t old mode 100644 new mode 100755 index 16d32b1..2665ecb --- a/t/io/read.t +++ b/t/io/read.t @@ -1,22 +1,39 @@ #!./perl -# $RCSfile$ +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; +} + +use strict; +eval 'use Errno'; +die $@ if $@ and !$ENV{PERL_CORE_MINITEST}; -print "1..1\n"; +plan tests => 2; open(A,"+>a"); print A "_"; seek(A,0,0); -$b = "abcd"; +my $b = "abcd"; $b = ""; read(A,$b,1,4); close(A); -if ($b eq "\000\000\000\000_") { - print "ok 1\n"; -} else { # Probably "\000bcd_" - print "not ok 1\n"; +unlink("a"); + +is($b,"\000\000\000\000_"); # otherwise probably "\000bcd_" + +unlink 'a'; + +SKIP: { + skip "no EBADF", 1 if (!exists &Errno::EBADF); + + $! = 0; + no warnings 'unopened'; + read(B,$b,1); + ok($! == &Errno::EBADF); }