This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
UTF8f
[perl5.git] / t / win32 / fs.t
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 plan tests => 4;
12
13 my $tmpfile1 = tempfile();
14 my $tmpfile2 = tempfile();
15
16 # RT #112272
17 ok(!link($tmpfile1, $tmpfile2),
18    "Cannot link to unknown file");
19 is(0+$!, &Errno::ENOENT, "check errno is ENOENT");
20 open my $fh, ">", $tmpfile1
21     or skip("Cannot create test link src", 2);
22 close $fh;
23 open my $fh, ">", $tmpfile2
24     or skip("Cannot create test link target", 2);
25 close $fh;
26 ok(!link($tmpfile1, $tmpfile2),
27    "Cannot link to existing file");
28 is(0+$!, &Errno::EEXIST, "check for EEXIST");