This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix the syswrite downgrade bug of
[perl5.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 use Errno;
13
14 plan tests => 2;
15
16 open(A,"+>a");
17 print A "_";
18 seek(A,0,0);
19
20 my $b = "abcd"; 
21 $b = "";
22
23 read(A,$b,1,4);
24
25 close(A);
26
27 unlink("a");
28
29 is($b,"\000\000\000\000_"); # otherwise probably "\000bcd_"
30
31 unlink 'a';
32
33 SKIP: {
34     skip "no EBADF", 1 if (!exists &Errno::EBADF);
35
36     $! = 0;
37     read(B,$b,1);
38     ok($! == &Errno::EBADF);
39 }