50ae38dff1b1415b4ab17172cf2d95a8af44118e
[p5sagit/p5-mst-13.2.git] / t / io / open.t
1 #!./perl
2
3 # $RCSfile$    
4 $|  = 1;
5 $^W = 1;
6
7 print "1..9\n";   
8
9 # my $file tests
10
11 unlink("afile.new") if -f "afile";     
12 print "$!\nnot " unless open(my $f,"+>afile");
13 print "ok 1\n";
14 print "not " unless -f "afile";     
15 print "ok 2\n";
16 print "not " unless print $f "SomeData\n";
17 print "ok 3\n";
18 print "not " unless tell($f) == 9;
19 print "ok 4\n";
20 print "not " unless seek($f,0,0);
21 print "ok 5\n";
22 $b = <$f>;
23 print "not " unless $b eq "SomeData\n";
24 print "ok 6\n";
25 print "not " unless -f $f;     
26 print "ok 7\n";
27 eval  { die "Message" };   
28 # warn $@;
29 print "not " unless $@ =~ /<\$f> line 1/;
30 print "ok 8\n";
31 print "not " unless close($f);
32 print "ok 9\n";
33 unlink("afile");     
34