Skip to content

Commit d4353b6

Browse files
committed
[io grant] Rewrite .l on broken symlinks test
- de-confuse $target/$name nomenclature - make work with IO grant changes to symlink - Catch exceptions on Windows and skip test, as symlink creation on Windows cries for admin privs. This addresses the failures in this test file reported in #197 and #232
1 parent 8841383 commit d4353b6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

S16-filehandles/filetest.t

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,20 @@ unlink "empty_file";
125125

126126
# RT #129162
127127
{
128-
my $name = "symlink-test-source";
129-
my $target = "symlink-test-target";
130-
my $src = open($name, :w);
131-
$src.close;
132-
symlink($target, $name);
133-
unlink $name;
134-
135-
ok $target.IO.l, "Broken symlink exists";
136-
unlink $target;
128+
my $target = make-temp-file;
129+
my $link = make-temp-file;
130+
$target.open(:w).close; # `touch` the target
131+
132+
try $target.symlink: $link;
133+
if $! {
134+
$*DISTRO.is-win # XXX TODO can we make some "sudo tests" roast category?
135+
?? skip ".symlink on Windows needs escalated privileges: $!.message()"
136+
!! flunk "received exception when trying to .symlink: $!"
137+
}
138+
else {
139+
unlink $target; # break symlink by deleting the target
140+
is-deeply $link.IO.l, True, '.l on broken symlinks gives True';
141+
}
137142
}
138143

139144
#?rakudo.jvm skip '[io grant] NoSuchFileException for open(:create)'

0 commit comments

Comments
 (0)