Commit | Line | Data |
72e93046 |
1 | #!./perl |
2 | |
72e93046 |
3 | BEGIN { |
4 | chdir 't' if -d 't'; |
5 | @INC = '../lib'; |
3484683b |
6 | if ($ENV{PERL_CORE_MINITEST}) { |
7 | print "1..0 # Skip: no Fcntl under miniperl\n"; |
8 | exit 0; |
9 | } |
72e93046 |
10 | unless (find PerlIO::Layer 'perlio') { |
11 | print "1..0 # Skip: not perlio\n"; |
12 | exit 0; |
13 | } |
14 | use Config; |
15 | unless (" $Config{extensions} " =~ / Fcntl /) { |
16 | print "1..0 # Skip: no Fcntl (how did you get this far?)\n"; |
17 | exit 0; |
18 | } |
19 | } |
20 | |
3484683b |
21 | use strict; |
22 | use warnings; |
23 | |
72e93046 |
24 | use Test::More tests => 6; |
25 | |
26 | use Fcntl qw(:seek); |
27 | |
28 | { |
29 | ok((open my $fh, "+>", undef), "open my \$fh, '+>', undef"); |
30 | print $fh "the right write stuff"; |
31 | ok(seek($fh, 0, SEEK_SET), "seek to zero"); |
32 | my $data = <$fh>; |
33 | is($data, "the right write stuff", "found the right stuff"); |
34 | } |
35 | |
36 | { |
37 | ok((open my $fh, "+<", undef), "open my \$fh, '+<', undef"); |
38 | print $fh "the right read stuff"; |
39 | ok(seek($fh, 0, SEEK_SET), "seek to zero"); |
40 | my $data = <$fh>; |
41 | is($data, "the right read stuff", "found the right stuff"); |
42 | } |
43 | |
44 | |
45 | |
46 | |