/[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

Diff of /t/fs.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 10 by dpavlin, Sun Jul 8 21:03:26 2007 UTC revision 11 by dpavlin, Mon Jul 9 08:39:58 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = shift @ARGV;  my $debug = shift @ARGV;
6    
7  use Test::More tests => 135;  use Test::More tests => 115;
8  use File::Slurp;  use File::Slurp;
9    
10  my ( $from, $to, $tmp ) = ( '/tmp/comp', '/tmp/no-comp', '/dev/shm/comp' );  my ( $from, $to, $tmp ) = ( '/tmp/comp', '/tmp/no-comp', '/dev/shm/comp' );
# Line 19  sub file { Line 19  sub file {
19          if ( $op =~ m/>/ ) {          if ( $op =~ m/>/ ) {
20                  print $fh $content;                  print $fh $content;
21          } else {          } else {
22                    my $orig_content = $content;
23                  local $/;                  local $/;
24                  $content = <$fh>;                  $content = <$fh>;
25                  ok( $content, 'has content' );                  if ( defined( $content ) ) {
26                            cmp_ok( $content, 'eq', $orig_content, 'content' );
27                    } else {
28                            ok( $content, 'has content' );
29                    }
30          }          }
31          ok( close($fh), 'close' );          ok( close($fh), 'close' );
32    
33          ok ( -e "$to/$path", 'exists' );          ok ( -e "$to/$path", 'exists' );
34    
35          ok( -e "$from/$path" || -e "$from/${path}.gz", 'on disk' );          my $pack = "$from/${path}.gz";
36    
37          ok( -e "$tmp/$path" , 'in tmp' ) if ( $op =~ m/</ );          if ( -e $pack ) {
38                    ok( -s $pack, 'on disk packed' );
39                    ok( -e "$tmp/$path" , 'in tmp unpacked' ) if ( $op =~ m/</ );
40            } else {
41                    ok( -e "$from/$path", 'on disk unpacked' );
42            }
43    
44          return $content;          return $content;
45  }  }
# Line 43  for my $i ( 1 .. 3 ) { Line 53  for my $i ( 1 .. 3 ) {
53          my $file = "test.$i";          my $file = "test.$i";
54    
55          file( '>', $file, $content );          file( '>', $file, $content );
56          cmp_ok( file( '<', $file ), 'eq', $content, "$file content" );          file( '<', $file, $content );
57    
58          file( '>>', $file, '+append' );          file( '>>', $file, '+append' );
59          cmp_ok( file( '<', $file ), 'eq', $content . '+append', "$file append" );          file( '<', $file, $content . '+append' );
60    
61          file( '>', $file, '' );          file( '>', $file, '' );
62          cmp_ok( file( '<', $file ), 'eq', '', "$file empty" );          file( '<', $file, '' );
63    
64          file( '>', $file, $content );          file( '>', $file, $content );
65          cmp_ok( file( '<', $file ), 'eq', $content, "$file content" );          file( '<', $file, $content );
66    
67  }  }

Legend:
Removed from v.10  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26