develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35890 - trunk/t/pmc

From:
rurban
Date:
January 22, 2009 08:00
Subject:
[svn:parrot] r35890 - trunk/t/pmc
Message ID:
20090122160021.DF1A3CB9AE@x12.develooper.com
Author: rurban
Date: Thu Jan 22 08:00:20 2009
New Revision: 35890

Modified:
   trunk/t/pmc/os.t

Log:
[test] Fix cygwin os hardlink test.
  - add cygwin to list of unsupported platforms for hardlink-to-file test
  - add a hardlink-to-directory test which requires root permissions.


Modified: trunk/t/pmc/os.t
==============================================================================
--- trunk/t/pmc/os.t	(original)
+++ trunk/t/pmc/os.t	Thu Jan 22 08:00:20 2009
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 15;
+use Parrot::Test tests => 17;
 use Parrot::Config;
 use Cwd;
 use File::Spec;
@@ -288,9 +288,9 @@
     unlink "xpto" if -f "xpto";
 }
 
-# Test link
+# Test link to file. May require root permissions
 SKIP: {
-    skip "Parrot link not implemented for Windows, yet", 2 if $MSWin32;
+    skip "Hardlinks to files not possible on Windows", 2 if $MSWin32 or $cygwin;
 
     pir_output_is( <<'CODE', <<"OUT", "Test link" );
 .sub main :main
@@ -309,10 +309,35 @@
 OUT
 
     my $nl = [ stat("MANIFEST") ]->[3];
-    ok( $nl > 1, "hard link was really created" );
+    ok( $nl > 1, "hard link to file was really created" );
     unlink "xpto" if -f "xpto";
 }
 
+# Test link to dir.
+TODO: {
+    local $TODO = "Hardlinks to a directory may require root permissions";
+
+    pir_output_is( <<'CODE', <<"OUT", "Test dirlink" );
+.sub main :main
+        $P1 = new ['OS']
+
+        $S1 = "xpto"
+        $S2 = "tools"
+        $P1."link"($S2, $S1)
+
+        print "ok\n"
+
+        end
+.end
+CODE
+ok
+OUT
+
+    my $nl = [ stat("tools") ]->[3];
+    ok( $nl > 1, "hard link to dir was really created" );
+    unlink "xpto" if -d "xpto";
+}
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About