xref: /openbsd/gnu/usr.bin/perl/t/win32/fs.t (revision 09467b48)
1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    @INC = '../lib';
6    require "./test.pl";
7    eval 'use Errno';
8    die $@ if $@ and !is_miniperl();
9}
10
11my $has_link = Win32::FsType() eq 'NTFS';
12
13$has_link
14  or skip_all("link() only works on NTFS");
15
16plan tests => 4;
17
18my $tmpfile1 = tempfile();
19my $tmpfile2 = tempfile();
20
21# RT #112272
22ok(!link($tmpfile1, $tmpfile2),
23   "Cannot link to unknown file");
24is(0+$!, &Errno::ENOENT, "check errno is ENOENT");
25open my $fh, ">", $tmpfile1
26    or skip("Cannot create test link src", 2);
27close $fh;
28open my $fh, ">", $tmpfile2
29    or skip("Cannot create test link target", 2);
30close $fh;
31ok(!link($tmpfile1, $tmpfile2),
32   "Cannot link to existing file");
33is(0+$!, &Errno::EEXIST, "check for EEXIST");
34