This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor podcheck.t to slurp files into scalars, instead of an array of lines.
[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';
e05e9c3d 7 skip_all_without_perlio();
273be65c 8 skip_all_without_dynamic_extension('Fcntl'); # how did you get this far?
72e93046
JH
9}
10
3484683b
RGS
11use strict;
12use warnings;
13
0214bff6 14plan tests => 6;
72e93046
JH
15
16use Fcntl qw(:seek);
17
18{
19 ok((open my $fh, "+>", undef), "open my \$fh, '+>', undef");
20 print $fh "the right write stuff";
21 ok(seek($fh, 0, SEEK_SET), "seek to zero");
22 my $data = <$fh>;
23 is($data, "the right write stuff", "found the right stuff");
24}
25
26{
27 ok((open my $fh, "+<", undef), "open my \$fh, '+<', undef");
28 print $fh "the right read stuff";
29 ok(seek($fh, 0, SEEK_SET), "seek to zero");
30 my $data = <$fh>;
31 is($data, "the right read stuff", "found the right stuff");
32}
33
34
35
36