/[fuse-comp]/t/fs.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 /t/fs.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (show annotations)
Sun Jul 8 17:03:12 2007 UTC (16 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 893 byte(s)
move tests to perl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 my $debug = shift @ARGV;
6
7 use Test::More tests => 23;
8
9 my ( $from, $to, $tmp ) = ( '/tmp/comp', '/tmp/no-comp', '/dev/shm' );
10
11 ok( -e $from, 'from' );
12 ok( -e $to, 'to' );
13 ok( -e $tmp, 'tmp' );
14
15 sub file {
16 my ( $op, $path, $content ) = @_;
17 ok( open( my $fh, $op, "$to/$path" ), "open( $op $path )");
18 if ( $content ) {
19 print $fh $content;
20 } else {
21 local $/;
22 $content = <$fh>;
23 ok( $content, 'has content' );
24 }
25 ok( close($fh), 'close' );
26
27 ok ( -e "$to/$path", 'exists' );
28
29 ok( -e "$from/$path" || -e "$from/${path}.gz", 'on disk' );
30
31 return $content;
32 }
33
34 file( '>', 'foo', 'content' );
35 cmp_ok( file( '<', 'foo' ), 'eq', 'content', 'check content' );
36
37 file( '>>', 'foo', '+more' );
38 cmp_ok( file( '<', 'foo' ), 'eq', 'content+more', 'check content' );
39
40 file( '>', 'foo', 'new' );
41 cmp_ok( file( '<', 'foo' ), 'eq', 'new', 'check content' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26