| 1 | #!./perl |
| 2 | |
| 3 | BEGIN { |
| 4 | chdir 't' if -d 't'; |
| 5 | @INC = '../lib'; |
| 6 | require './test.pl'; |
| 7 | skip_all_without_perlio(); |
| 8 | skip_all_without_dynamic_extension('Fcntl'); # how did you get this far? |
| 9 | } |
| 10 | |
| 11 | use strict; |
| 12 | use warnings; |
| 13 | |
| 14 | plan tests => 6; |
| 15 | |
| 16 | use 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 | |