Subject: | [PATCH] Use Cygwin path built-in functions in tests |
The newly added tests in t/MM_Cygwin.t for testing /cygdrive/c/ stuff
fails if the path prefix (cygdrive) is changed by the user (like I do
:). The proper way to get Unix paths from Windows paths is through the
use of the Cygwin::win_to_posix_path() built-in function. The attached
patch corrects the test file. Thanks.
Subject: | cygwin.patch |
--- ExtUtils-MakeMaker-6.52/t/MM_Cygwin.t.orig 2009-06-01 10:51:51.057360300 -0400
+++ ExtUtils-MakeMaker-6.52/t/MM_Cygwin.t 2009-06-01 10:59:04.438438300 -0400
@@ -104,30 +104,29 @@
SKIP: {
my $comspec = $ENV{COMSPEC};
- skip("\$ENV{COMSPEC} does not exist", 3) unless $comspec;
+ skip("\$ENV{COMSPEC} does not exist", 1) unless $comspec;
- # Convert into cygwin-flavoured '/cygdrive/c/...' path.
- # Is there a better way than direct munging? A File::*
- # module perhaps?
+ $comspec = Cygwin::win_to_posix_path($comspec);
- $comspec =~ s{^(\w):} {/cygdrive/\l$1}x;
- $comspec =~ s{\\ } {/}gx;
+ ok(MM->maybe_command($comspec),
+ qq{'$comspec' should be executable"}
+ );
+}
- ok(MM->maybe_command($comspec),"$comspec should be executable");
+# 'C:/' should *never* be executable, it's a directory.
- # /cygdrive/c should *never* be executable, it's a directory.
+my $cdrive = Cygwin::win_to_posix_path("C:/");
- ok(! MM->maybe_command(q{/cygdrive/c}),
- qq{/cygdrive/c should never be executable}
- );
+ok(! MM->maybe_command($cdrive),
+ qq{'$cdrive' should never be executable}
+);
- # Our copy of Perl (with a unix-path) should always be executable.
+# Our copy of Perl (with a unix-path) should always be executable.
- ok(MM->maybe_command($Config{perlpath}),
- qq{$Config{perlpath} should be executable}
- );
+ok(MM->maybe_command($Config{perlpath}),
+ qq{'$Config{perlpath}' should be executable}
+);
-}
package FakeOut;