This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bug in t/io/layers.t spotted by Ignasi Roca CarriĆ³
[perl5.git] / t / io / read.t
CommitLineData
93c1eb4f 1#!./perl
2
3# $RCSfile$
4
b5fe5ca2
SR
5BEGIN {
6 chdir 't' if -d 't';
7 @INC = '../lib';
8 require './test.pl';
9}
10
11use strict;
43651d81
NC
12eval 'use Errno';
13die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
b5fe5ca2
SR
14
15plan tests => 2;
93c1eb4f 16
17open(A,"+>a");
18print A "_";
19seek(A,0,0);
20
b5fe5ca2 21my $b = "abcd";
93c1eb4f 22$b = "";
23
24read(A,$b,1,4);
25
26close(A);
27
55497cff 28unlink("a");
29
b5fe5ca2 30is($b,"\000\000\000\000_"); # otherwise probably "\000bcd_"
55497cff 31
32unlink 'a';
b5fe5ca2
SR
33
34SKIP: {
35 skip "no EBADF", 1 if (!exists &Errno::EBADF);
36
37 $! = 0;
38 read(B,$b,1);
39 ok($! == &Errno::EBADF);
40}