Skip to content

Commit

Permalink
be less paranoid about the actual return value of unlink, just evalua…
Browse files Browse the repository at this point in the history
…te it in boolean context
  • Loading branch information
moritz committed Feb 26, 2011
1 parent 9100295 commit 76534ab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion S16-filehandles/io.t
Expand Up @@ -157,7 +157,7 @@ is(@lines10[2], "The End", 'lines($filename,3) worked in list context');
}

#now be sure to delete the file as well
is(unlink($filename), 1, 'file has been removed');
ok(unlink($filename), 'file has been removed');

# new file for testing other types of open() calls

Expand Down
2 changes: 1 addition & 1 deletion S16-filehandles/io_in_for_loops.t
Expand Up @@ -99,6 +99,6 @@ my $filename = 'tempfile_io_in_for_loop';
# old: L<S16/"Filehandles, files, and directories"/"unlink">
# L<S29/IO/unlink>

is(unlink($filename), 1, 'file has been removed');
ok(unlink($filename), 'file has been removed');

# vim: ft=perl6
2 changes: 1 addition & 1 deletion S16-filehandles/io_in_while_loops.t
Expand Up @@ -44,6 +44,6 @@ my $filename = 'tempfile_io_in_while_loop';
$fh.close();
}

is(unlink($filename), 1, 'file has been removed');
ok(unlink($filename), 'file has been removed');

# vim: ft=perl6
4 changes: 2 additions & 2 deletions S16-filehandles/unlink.t
Expand Up @@ -22,7 +22,7 @@ my $iswin32 = ?($*OS eq any <MSWin32 mingw msys cygwin>) ?? "Timely closing of f
close $fh;

ok $fn.IO ~~ :e, "open() created a tempfile";
is(unlink($fn), 1, "unlink() returned true");
ok(unlink($fn), "unlink() returned true");
ok $fn.IO !~~ :e, "unlink() actually deleted the tempfile";
}

Expand All @@ -31,7 +31,7 @@ my $iswin32 = ?($*OS eq any <MSWin32 mingw msys cygwin>) ?? "Timely closing of f
{ my $fh = open($fn, :w) }

ok $fn.IO ~~ :e, "open() created a tempfile";
is(unlink($fn), 1, "unlink() returned true");
ok(unlink($fn), "unlink() returned true");
#?rakudo skip 'implicit closure of file handle at scope exit not implemented (FAILS ON WINDOWS)'
ok $fn.IO !~~ :e, "unlink() actually deleted the tempfile";
}
Expand Down

0 comments on commit 76534ab

Please sign in to comment.