This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix core dump on IO::Seekable::setpos($fh, undef)
[perl5.git] / t / lib / io_xs.t
... / ...
CommitLineData
1#!./perl
2
3BEGIN {
4 unless(grep /blib/, @INC) {
5 chdir 't' if -d 't';
6 @INC = '../lib' if -d '../lib';
7 }
8}
9
10use Config;
11
12BEGIN {
13 if(-d "lib" && -f "TEST") {
14 if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') {
15 print "1..0\n";
16 exit 0;
17 }
18 }
19}
20
21use IO::File;
22use IO::Seekable;
23
24print "1..4\n";
25
26$x = new_tmpfile IO::File or print "not ";
27print "ok 1\n";
28print $x "ok 2\n";
29$x->seek(0,SEEK_SET);
30print <$x>;
31
32$x->seek(0,SEEK_SET);
33print $x "not ok 3\n";
34$p = $x->getpos;
35print $x "ok 3\n";
36$x->flush;
37$x->setpos($p);
38print scalar <$x>;
39
40$! = 0;
41$x->setpos(undef);
42print $! ? "ok 4 # $!\n" : "not ok 4\n";