--- t/fs.t 2007/07/09 13:33:13 15 +++ t/fs.t 2007/07/09 15:41:01 18 @@ -4,7 +4,7 @@ my $debug = shift @ARGV; -use Test::More tests => 710; +use Test::More tests => 727; use File::Slurp; use IO::File; @@ -67,9 +67,8 @@ } } else { ok( -e "$from/$path", "on disk $from/$path" ); - my $curr_size = -s "$from/$path"; - diag "$op curr_size: $curr_size size: $size"; - $size += $curr_size if ( $op eq '>>' ); + diag "$op curr_size: $orig_size size: $size"; + $size += $orig_size if ( $op eq '>>' ); cmp_ok( -s "$from/$path", '==', $size, "$from/$path = $size bytes" ); } @@ -78,6 +77,14 @@ return $content; } +sub md5sum { + my $path = shift; + my $md5sum = `md5sum $path`; + $md5sum =~ s/\s+.*$//s; + warn "## md5sum($path) = $md5sum\n" if $debug; + return $md5sum; +} + my $buff = '<<--just a chunk of data-->>'; for my $i ( 1 .. 3 ) { @@ -146,6 +153,16 @@ cmp_ok( -s "$to/m", '==', $expected_size, "appended upto $expected_size" ); } + ok( $size = -s "$to/m", 'size' ); + ok( my $md5sum = md5sum("$to/m"), 'md5sum m' ); + ok( rename("$to/m", "$to/n"), 'rename' ); + ok( -e "$to/n", "$to/n exists" ); + ok( ! -e "$to/m", "$to/m gone" ); + cmp_ok( -s "$to/n", '==', $size, 'size' ); + cmp_ok( $md5sum, 'eq', md5sum("$to/n"), 'md5sums same' ); + + ok( unlink("$to/n"), "$to/n unlink" ); + ok( ! -e "$to/n", "$to/n gone" ); }