diff options
Diffstat (limited to 'gnu/usr.bin/perl/t/win32/symlink.t')
-rw-r--r-- | gnu/usr.bin/perl/t/win32/symlink.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gnu/usr.bin/perl/t/win32/symlink.t b/gnu/usr.bin/perl/t/win32/symlink.t index 96ed7a1b11e..71a6e833f7e 100644 --- a/gnu/usr.bin/perl/t/win32/symlink.t +++ b/gnu/usr.bin/perl/t/win32/symlink.t @@ -7,6 +7,7 @@ BEGIN { } use Errno; +use Cwd qw(getcwd); Win32::FsType() eq 'NTFS' or skip_all("need NTFS"); @@ -74,10 +75,17 @@ close $fh if $fh; ok(symlink($tmpfile1, $tmpfile2), "link to it"); ok(-l $tmpfile2, "-l sees a link"); ok(!-f _, "-f on the lstat result is false"); -ok(-f $tmpfile2, "normal -d sees it as a file"); +ok(-f $tmpfile2, "normal -f sees it as a file"); is(readlink($tmpfile2), $tmpfile1, "readlink works"); check_stat($tmpfile1, $tmpfile2, "check file and link stat are the same"); ok(unlink($tmpfile2), "unlink the symlink"); + +# make a relative link +unlike($tmpfile1, qr([\\/]), "temp filename has no path"); +ok(symlink("./$tmpfile1", $tmpfile2), "UNIX (/) relative link to the file"); +ok(-f $tmpfile2, "we can see it through the link"); +ok(unlink($tmpfile2), "unlink the symlink"); + ok(unlink($tmpfile1), "and the file"); # test we don't treat directory junctions like symlinks @@ -94,6 +102,16 @@ if (system("mklink /j $tmpfile2 $tmpfile1") == 0) { } rmdir($tmpfile1); +{ + # link to an absolute path to a directory + # 20533 + my $cwd = getcwd(); + ok(symlink($cwd, $tmpfile1), + "symlink to an absolute path to cwd"); + ok(-d $tmpfile1, "the link looks like a directory"); + unlink $tmpfile1; +} + done_testing(); sub check_stat { |