This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert t/op/anonsub.t to test.pl, strict and warnings.
[perl5.git] / t / io / read.t
CommitLineData
93c1eb4f 1#!./perl
2
b5fe5ca2
SR
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
bcf53fae
NC
7 eval 'use Errno';
8 die $@ if $@ and !is_miniperl();
b5fe5ca2
SR
9}
10
11use strict;
b5fe5ca2
SR
12
13plan tests => 2;
93c1eb4f 14
62a28c97
NC
15my $tmpfile = tempfile();
16
17open(A,"+>$tmpfile");
93c1eb4f 18print A "_";
19seek(A,0,0);
20
b5fe5ca2 21my $b = "abcd";
93c1eb4f 22$b = "";
23
24read(A,$b,1,4);
25
26close(A);
27
b5fe5ca2 28is($b,"\000\000\000\000_"); # otherwise probably "\000bcd_"
55497cff 29
b5fe5ca2
SR
30SKIP: {
31 skip "no EBADF", 1 if (!exists &Errno::EBADF);
32
33 $! = 0;
3fb41248 34 no warnings 'unopened';
b5fe5ca2
SR
35 read(B,$b,1);
36 ok($! == &Errno::EBADF);
37}