Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for copy(:createonly)
  • Loading branch information
hoelzro committed Aug 28, 2015
1 parent 5e66cf2 commit 5a81fde
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 35;
plan 41;

my $existing-file = "tempfile-copy";
my $non-existent-file = "non-existent-copy";
Expand Down Expand Up @@ -46,6 +46,10 @@ nok $non-existent-file.IO.e, "It doesn't";
ok $existing-file-mtgt.IO.e, 'It exists';
nok $existing-file-mtgt.IO.s, 'It has no size';

dies-ok { $existing-file.IO.copy( $existing-file-mtgt, :createonly ) }, '.IO.copy normal file with :createonly';
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 Down Expand Up @@ -74,6 +78,10 @@ nok $non-existent-file.IO.e, "It doesn't";
ok $existing-file-stgt.IO.e, 'It exists';
nok $existing-file-stgt.IO.s, 'It has no size';

dies-ok { copy( $existing-file, $existing-file-stgt, :createonly ) }, '.copy() normal file with :createonly';
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 5a81fde

Please sign in to comment.