Commit | Line | Data |
---|---|---|
3eb568f1 NIS |
1 | #!./perl |
2 | ||
3 | # $RCSfile$ | |
853846ea NIS |
4 | $| = 1; |
5 | $^W = 1; | |
3eb568f1 | 6 | |
1d8d4d2a | 7 | print "1..9\n"; |
3eb568f1 | 8 | |
853846ea NIS |
9 | # my $file tests |
10 | ||
a6c40364 | 11 | unlink("afile") if -f "afile"; |
853846ea | 12 | print "$!\nnot " unless open(my $f,"+>afile"); |
3eb568f1 | 13 | print "ok 1\n"; |
a6c40364 | 14 | binmode $f; |
853846ea | 15 | print "not " unless -f "afile"; |
3eb568f1 | 16 | print "ok 2\n"; |
853846ea | 17 | print "not " unless print $f "SomeData\n"; |
3eb568f1 | 18 | print "ok 3\n"; |
853846ea | 19 | print "not " unless tell($f) == 9; |
3eb568f1 | 20 | print "ok 4\n"; |
853846ea | 21 | print "not " unless seek($f,0,0); |
3eb568f1 | 22 | print "ok 5\n"; |
853846ea NIS |
23 | $b = <$f>; |
24 | print "not " unless $b eq "SomeData\n"; | |
3eb568f1 | 25 | print "ok 6\n"; |
853846ea NIS |
26 | print "not " unless -f $f; |
27 | print "ok 7\n"; | |
28 | eval { die "Message" }; | |
29 | # warn $@; | |
30 | print "not " unless $@ =~ /<\$f> line 1/; | |
31 | print "ok 8\n"; | |
32 | print "not " unless close($f); | |
33 | print "ok 9\n"; | |
34 | unlink("afile"); | |
3eb568f1 | 35 |