xref: /openbsd-src/gnu/usr.bin/perl/t/op/filehandle.t (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
1b39c5158Smillert#!./perl
2b39c5158Smillert
3b39c5158SmillertBEGIN {
4b39c5158Smillert    chdir 't' if -d 't';
5b39c5158Smillert    require './test.pl';
6*5759b3d2Safresh1    set_up_inc('../lib');
7898184e3Ssthen    skip_all_if_miniperl("no dynamic loading on miniperl, no IO, hence no FileHandle");
8b39c5158Smillert}
9b39c5158Smillert
10b39c5158Smillertplan 4;
11b39c5158Smillertuse FileHandle;
12b39c5158Smillert
13b39c5158Smillertmy $str = "foo";
14b39c5158Smillertopen my $fh, "<", \$str;
1591f110e0Safresh1is <$fh>, "foo", "open fh to reference to string: got expected content";
16b39c5158Smillert
17b39c5158Smillerteval {
18b39c5158Smillert   $fh->seek(0, 0);
1991f110e0Safresh1   is $fh->tell, 0, "after 'seek' and 'tell', got expected current fh position in bytes";
2091f110e0Safresh1   is <$fh>, "foo", "after 'seek' and 'tell', still got expected content";
21b39c5158Smillert};
22b39c5158Smillert
2391f110e0Safresh1is $@, '', "no errors after 'seek' or 'tell'";
24