Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test copy() when destination exists
  • Loading branch information
hoelzro committed Aug 28, 2015
1 parent cf775d3 commit 5e66cf2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion S32-io/copy.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 29;
plan 35;

my $existing-file = "tempfile-copy";
my $non-existent-file = "non-existent-copy";
Expand Down Expand Up @@ -42,6 +42,10 @@ nok $non-existent-file.IO.e, "It doesn't";
nok $zero-length-file-mtgt.IO.s, 'It has no size';
is $zero-length-file-mtgt.IO.s, $zero-length-file.IO.s, 'The size is equal to source file';

ok $zero-length-file.IO.copy( $existing-file-mtgt ), '.IO.copy empty file (dest exists)';
ok $existing-file-mtgt.IO.e, 'It exists';
nok $existing-file-mtgt.IO.s, 'It has no size';

ok unlink($existing-file-mtgt), 'file has been removed';
ok unlink($zero-length-file-mtgt), 'file has been removed';
}
Expand All @@ -66,6 +70,10 @@ nok $non-existent-file.IO.e, "It doesn't";
nok $zero-length-file-stgt.IO.s, 'It has no size';
is $zero-length-file-stgt.IO.s, $zero-length-file.IO.s, 'The size is equal to source file';

ok copy( $zero-length-file, $existing-file-stgt ), 'copy() empty file (dest exists)';
ok $existing-file-stgt.IO.e, 'It exists';
nok $existing-file-stgt.IO.s, 'It has no size';

ok unlink($existing-file-stgt), 'file has been removed';
ok unlink($zero-length-file-stgt), 'file has been removed';
}
Expand Down

0 comments on commit 5e66cf2

Please sign in to comment.