summaryrefslogtreecommitdiff
path: root/t/win32
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2012-05-07 22:23:42 +1000
committerTony Cook <tony@develop-help.com>2012-05-28 19:45:52 +1000
commit23629bd37b27c6af15ae899eccd83273eb1353bb (patch)
tree5f1ee934042a447965f96810e5214d7497e4d8be /t/win32
parente8b06a558cb4e9db72f38629a92677b712e38708 (diff)
downloadperl-23629bd37b27c6af15ae899eccd83273eb1353bb.tar.gz
[perl #112272] test link()'s error returns (TODO)
Diffstat (limited to 't/win32')
-rw-r--r--t/win32/fs.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/win32/fs.t b/t/win32/fs.t
new file mode 100644
index 0000000000..0369f4153b
--- /dev/null
+++ b/t/win32/fs.t
@@ -0,0 +1,41 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require "./test.pl";
+ eval 'use Errno';
+ die $@ if $@ and !is_miniperl();
+}
+
+use Config;
+
+plan tests => 4;
+
+my $tmpfile1 = tempfile();
+my $tmpfile2 = tempfile();
+
+SKIP: {
+ # RT #112272
+ -e $tmpfile1 || -e $tmpfile2
+ and skip("somehow, the files exist", 4);
+ ok(!link($tmpfile1, $tmpfile2),
+ "Cannot link to unknown file");
+ warn $!;
+ is(0+$!, &Errno::ENOENT, "check errno is ENOENT");
+ open my $fh, ">", $tmpfile1
+ or skip("Cannot create test link src", 2);
+ close $fh;
+ open my $fh, ">", $tmpfile2
+ or skip("Cannot create test link target", 2);
+ close $fh;
+ ok(!link($tmpfile1, $tmpfile2),
+ "Cannot link to existing file");
+ warn $!;
+ local $TODO = "not yet implemented";
+ is(0+$!, &Errno::EEXIST, "check for EEXIST");
+}
+
+END {
+ unlink($tmpfile1, $tmpfile2);
+}