xref: /openbsd/gnu/usr.bin/perl/t/op/filehandle.t (revision 5759b3d2)
1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    require './test.pl';
6    set_up_inc('../lib');
7    skip_all_if_miniperl("no dynamic loading on miniperl, no IO, hence no FileHandle");
8}
9
10plan 4;
11use FileHandle;
12
13my $str = "foo";
14open my $fh, "<", \$str;
15is <$fh>, "foo", "open fh to reference to string: got expected content";
16
17eval {
18   $fh->seek(0, 0);
19   is $fh->tell, 0, "after 'seek' and 'tell', got expected current fh position in bytes";
20   is <$fh>, "foo", "after 'seek' and 'tell', still got expected content";
21};
22
23is $@, '', "no errors after 'seek' or 'tell'";
24