[perl #32717] BeOS specific Updates
[p5sagit/p5-mst-13.2.git] / t / io / read.t
1 #!./perl
2
3 # $RCSfile$
4
5 BEGIN {
6     chdir 't' if -d 't';
7     @INC = '../lib';
8     require './test.pl';
9 }
10
11 use strict;
12 eval 'use Errno';
13 die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
14
15 plan tests => 2;
16
17 open(A,"+>a");
18 print A "_";
19 seek(A,0,0);
20
21 my $b = "abcd"; 
22 $b = "";
23
24 read(A,$b,1,4);
25
26 close(A);
27
28 unlink("a");
29
30 is($b,"\000\000\000\000_"); # otherwise probably "\000bcd_"
31
32 unlink 'a';
33
34 SKIP: {
35     skip "no EBADF", 1 if (!exists &Errno::EBADF);
36
37     $! = 0;
38     read(B,$b,1);
39     ok($! == &Errno::EBADF);
40 }