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 | ||
11 | use Config; | |
12 | ||
13 | plan tests => 4; | |
14 | ||
15 | my $tmpfile1 = tempfile(); | |
16 | my $tmpfile2 = tempfile(); | |
17 | ||
18 | SKIP: { | |
19 | # RT #112272 | |
20 | -e $tmpfile1 || -e $tmpfile2 | |
21 | and skip("somehow, the files exist", 4); | |
22 | ok(!link($tmpfile1, $tmpfile2), | |
23 | "Cannot link to unknown file"); | |
23629bd3 TC |
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"); | |
23629bd3 TC |
33 | is(0+$!, &Errno::EEXIST, "check for EEXIST"); |
34 | } | |
35 | ||
36 | END { | |
37 | unlink($tmpfile1, $tmpfile2); | |
38 | } |