Commit | Line | Data |
93c1eb4f |
1 | #!./perl |
2 | |
b5fe5ca2 |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
6 | require './test.pl'; |
7 | } |
8 | |
9 | use strict; |
43651d81 |
10 | eval 'use Errno'; |
11 | die $@ if $@ and !$ENV{PERL_CORE_MINITEST}; |
b5fe5ca2 |
12 | |
13 | plan tests => 2; |
93c1eb4f |
14 | |
15 | open(A,"+>a"); |
16 | print A "_"; |
17 | seek(A,0,0); |
18 | |
b5fe5ca2 |
19 | my $b = "abcd"; |
93c1eb4f |
20 | $b = ""; |
21 | |
22 | read(A,$b,1,4); |
23 | |
24 | close(A); |
25 | |
55497cff |
26 | unlink("a"); |
27 | |
b5fe5ca2 |
28 | is($b,"\000\000\000\000_"); # otherwise probably "\000bcd_" |
55497cff |
29 | |
30 | unlink 'a'; |
b5fe5ca2 |
31 | |
32 | SKIP: { |
33 | skip "no EBADF", 1 if (!exists &Errno::EBADF); |
34 | |
35 | $! = 0; |
3fb41248 |
36 | no warnings 'unopened'; |
b5fe5ca2 |
37 | read(B,$b,1); |
38 | ok($! == &Errno::EBADF); |
39 | } |