This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/op/inc.t, t/op/hexfp.t, t/op/sprintf2.t: Add missing d_ prefixes for Config variabl...
[perl5.git] / t / win32 / fs.t
CommitLineData
23629bd3
TC
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
3420f3f5
TC
11my $has_link = Win32::FsType() eq 'NTFS';
12
13$has_link
14 or skip_all("link() only works on NTFS");
15
23629bd3
TC
16plan tests => 4;
17
18my $tmpfile1 = tempfile();
19my $tmpfile2 = tempfile();
20
476e237d
BG
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");