4 |
|
|
5 |
my $debug = shift @ARGV; |
my $debug = shift @ARGV; |
6 |
|
|
7 |
use Test::More tests => 710; |
use Test::More tests => 727; |
8 |
use File::Slurp; |
use File::Slurp; |
9 |
use IO::File; |
use IO::File; |
10 |
|
|
67 |
} |
} |
68 |
} else { |
} else { |
69 |
ok( -e "$from/$path", "on disk $from/$path" ); |
ok( -e "$from/$path", "on disk $from/$path" ); |
70 |
my $curr_size = -s "$from/$path"; |
diag "$op curr_size: $orig_size size: $size"; |
71 |
diag "$op curr_size: $curr_size size: $size"; |
$size += $orig_size if ( $op eq '>>' ); |
|
$size += $curr_size if ( $op eq '>>' ); |
|
72 |
cmp_ok( -s "$from/$path", '==', $size, "$from/$path = $size bytes" ); |
cmp_ok( -s "$from/$path", '==', $size, "$from/$path = $size bytes" ); |
73 |
} |
} |
74 |
|
|
77 |
return $content; |
return $content; |
78 |
} |
} |
79 |
|
|
80 |
|
sub md5sum { |
81 |
|
my $path = shift; |
82 |
|
my $md5sum = `md5sum $path`; |
83 |
|
$md5sum =~ s/\s+.*$//s; |
84 |
|
warn "## md5sum($path) = $md5sum\n" if $debug; |
85 |
|
return $md5sum; |
86 |
|
} |
87 |
|
|
88 |
my $buff = '<<--just a chunk of data-->>'; |
my $buff = '<<--just a chunk of data-->>'; |
89 |
|
|
90 |
for my $i ( 1 .. 3 ) { |
for my $i ( 1 .. 3 ) { |
153 |
cmp_ok( -s "$to/m", '==', $expected_size, "appended upto $expected_size" ); |
cmp_ok( -s "$to/m", '==', $expected_size, "appended upto $expected_size" ); |
154 |
} |
} |
155 |
|
|
156 |
|
ok( $size = -s "$to/m", 'size' ); |
157 |
|
ok( my $md5sum = md5sum("$to/m"), 'md5sum m' ); |
158 |
|
ok( rename("$to/m", "$to/n"), 'rename' ); |
159 |
|
ok( -e "$to/n", "$to/n exists" ); |
160 |
|
ok( ! -e "$to/m", "$to/m gone" ); |
161 |
|
cmp_ok( -s "$to/n", '==', $size, 'size' ); |
162 |
|
cmp_ok( $md5sum, 'eq', md5sum("$to/n"), 'md5sums same' ); |
163 |
|
|
164 |
|
ok( unlink("$to/n"), "$to/n unlink" ); |
165 |
|
ok( ! -e "$to/n", "$to/n gone" ); |
166 |
|
|
167 |
} |
} |
168 |
|
|