ExtUtils::MakeMaker 6.55_02
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / MM_Cygwin.t
index bc4165e..d952188 100644 (file)
@@ -16,7 +16,7 @@ use Test::More;
 
 BEGIN {
        if ($^O =~ /cygwin/i) {
-               plan tests => 13;
+               plan tests => 14;
        } else {
                plan skip_all => "This is not cygwin";
        }
@@ -25,6 +25,7 @@ BEGIN {
 use Config;
 use File::Spec;
 use ExtUtils::MM;
+use Config;
 
 use_ok( 'ExtUtils::MM_Cygwin' );
 
@@ -82,22 +83,10 @@ my $res = $MM->manifypods();
 like( $res, qr/pure_all.*foo.*foo.1/s, '... should add MAN3PODS targets' );
 
 
-SKIP: {
-    skip "Only relevent in the core", 2 unless $ENV{PERL_CORE};
-    $MM->{PERL_SRC} = File::Spec->updir;
-    $MM->{MAN1PODS} = { bar => 1 };
-    my $out = tie *STDOUT, 'FakeOut';
-    $res = $MM->manifypods();
-    is( $$out, '', '... should not warn if PERL_SRC provided' );
-    like( $res, qr/bar \\\n\t1 \\\n\tfoo/,
-          '... should join MAN1PODS and MAN3PODS');
-}
-
-
 # init_linker
 {
     my $libperl = $Config{libperl} || 'libperl.a';
-    $libperl =~ s/\.a/.dll.a/ if $] >= 5.007;
+    $libperl =~ s/\.a/.dll.a/ if $] >= 5.006002;
     $libperl = "\$(PERL_INC)/$libperl";
 
     my $export  = '';
@@ -109,6 +98,30 @@ SKIP: {
     is( $MM->{EXPORT_LIST},         $export,    'EXPORT_LIST' );
 }
 
+# Tests for correct handling of maybe_command in /cygdrive/*
+# and c:/*.  $ENV{COMSPEC}, if it exists, should always be executable.
+SKIP: {
+    skip "Needs Cygwin::win_to_posix_path()", 2 unless defined &Cygwin::win_to_posix_path;
+
+    SKIP: {
+        my $comspec = $ENV{COMSPEC};
+        skip(q[$ENV{COMSPEC} does not exist], 1) unless $comspec;
+
+        $comspec = Cygwin::win_to_posix_path($comspec);
+
+        ok(MM->maybe_command($comspec), qq{'$comspec' should be executable"});
+    }
+
+    # 'C:/' should *never* be executable, it's a directory.
+    {
+        my $cdrive = Cygwin::win_to_posix_path("C:/");
+
+        ok(!MM->maybe_command($cdrive), qq{'$cdrive' should never 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});
 
 
 package FakeOut;