This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tidy perlio_open.t, by using test.pl skip_all* functions where appropriate.
[perl5.git] / t / io / perlio_open.t
CommitLineData
72e93046
JH
1#!./perl
2
72e93046
JH
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
0214bff6 6 require './test.pl';
bad1036f
NC
7 skip_all('not perlio') unless (find PerlIO::Layer 'perlio');
8 skip_all_if_miniperl("no dynamic loading on miniperl, no Fcntl");
9 skip_all_without_extension('Fcntl'); # how did you get this far?
72e93046
JH
10}
11
3484683b
RGS
12use strict;
13use warnings;
14
0214bff6 15plan tests => 6;
72e93046
JH
16
17use Fcntl qw(:seek);
18
19{
20 ok((open my $fh, "+>", undef), "open my \$fh, '+>', undef");
21 print $fh "the right write stuff";
22 ok(seek($fh, 0, SEEK_SET), "seek to zero");
23 my $data = <$fh>;
24 is($data, "the right write stuff", "found the right stuff");
25}
26
27{
28 ok((open my $fh, "+<", undef), "open my \$fh, '+<', undef");
29 print $fh "the right read stuff";
30 ok(seek($fh, 0, SEEK_SET), "seek to zero");
31 my $data = <$fh>;
32 is($data, "the right read stuff", "found the right stuff");
33}
34
35
36
37