/[fuse.before_github]/perl/trunk/test/write.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /perl/trunk/test/write.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations)
Thu Nov 11 14:44:15 2004 UTC (19 years, 4 months ago) by mszeredi
File MIME type: application/x-troff
File size: 1014 byte(s)
Initial revision

1 #!/usr/bin/perl
2 use test::helper qw($_real $_point);
3 use Test::More;
4 plan tests => 15;
5 my ($data);
6 chdir($_point);
7 undef $/; # slurp it all
8 # create file
9 system("echo frogbing >writefile");
10
11 # fetch contents of file
12 ok(open(FILE,"writefile"),"open");
13 $data = <FILE>;
14 close(FILE);
15 is(length($data),9,"right amount read");
16 is($data,"frogbing\n","right data read");
17
18 # overwrite part
19 ok(open(FILE,'+<',"writefile"),"open");
20 ok(seek(FILE,2,0),"seek");
21 ok(print(FILE "ib"),"print");
22 close(FILE);
23
24 # fetch contents of file
25 ok(open(FILE,"writefile"),"open");
26 $data = <FILE>;
27 close(FILE);
28 is(length($data),9,"right amount read");
29 is($data,"fribbing\n","right data read");
30
31 # overwrite part, append some
32 ok(open(FILE,'+<',"writefile"),"open");
33 ok(seek(FILE,7,0),"seek");
34 ok(print(FILE "gle"),"print");
35 close(FILE);
36
37 # fetch contents of file
38 ok(open(FILE,"writefile"),"open");
39 $data = <FILE>;
40 close(FILE);
41 is(length($data),10,"right amount read");
42 is($data,"fribbingle","right data read");
43
44 # kill file
45 unlink("writefile");

  ViewVC Help
Powered by ViewVC 1.1.26