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' ); |
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 |
} |
} |
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 |
} |
} |