Commit | Line | Data |
---|---|---|
23629bd3 TC |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
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 | ||
3420f3f5 TC |
11 | my $has_link = Win32::FsType() eq 'NTFS'; |
12 | ||
13 | $has_link | |
14 | or skip_all("link() only works on NTFS"); | |
15 | ||
23629bd3 TC |
16 | plan tests => 4; |
17 | ||
18 | my $tmpfile1 = tempfile(); | |
19 | my $tmpfile2 = tempfile(); | |
20 | ||
476e237d BG |
21 | # RT #112272 |
22 | ok(!link($tmpfile1, $tmpfile2), | |
23 | "Cannot link to unknown file"); | |
24 | is(0+$!, &Errno::ENOENT, "check errno is ENOENT"); | |
25 | open my $fh, ">", $tmpfile1 | |
26 | or skip("Cannot create test link src", 2); | |
27 | close $fh; | |
28 | open my $fh, ">", $tmpfile2 | |
29 | or skip("Cannot create test link target", 2); | |
30 | close $fh; | |
31 | ok(!link($tmpfile1, $tmpfile2), | |
32 | "Cannot link to existing file"); | |
33 | is(0+$!, &Errno::EEXIST, "check for EEXIST"); |