ExtUtils::MakeMaker 6.55_02
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / MM_Win32.t
index 69e4afb..c779da2 100644 (file)
@@ -16,7 +16,7 @@ use Test::More;
 
 BEGIN {
        if ($^O =~ /MSWin32/i) {
-               plan tests => 42;
+               plan tests => 49;
        } else {
                plan skip_all => 'This is not Win32';
        }
@@ -37,6 +37,7 @@ my $MM = bless {
                 MAKEFILE => 'Makefile',
                 RM_RF   => 'rm -rf',
                 MV      => 'mv',
+                MAKE    => $Config{make}
                }, 'MM';
 
 
@@ -84,7 +85,7 @@ delete $ENV{PATHEXT} unless $had_pathext;
 {
     my $my_perl = $1 if $^X  =~ /(.*)/; # are we in -T or -t?
     my( $perl, $path ) = fileparse( $my_perl );
-    like( $MM->find_perl( $], [ $perl ], [ $path ], 0 ), \r
+    like( $MM->find_perl( $], [ $perl ], [ $path ], 0 ),
           qr/^\Q$my_perl\E$/i, 'find_perl() finds this perl' );
 }
 
@@ -112,7 +113,7 @@ delete $ENV{PATHEXT} unless $had_pathext;
 # init_others(): check if all keys are created and set?
 # qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NUL )
 {
-    my $mm_w32 = bless( {}, 'MM' );
+    my $mm_w32 = bless( { BASEEXT => 'Foo' }, 'MM' );
     $mm_w32->init_others();
     my @keys = qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP 
                    TEST_F LD AR LDLOADLIBS DEV_NULL );
@@ -163,27 +164,15 @@ delete $ENV{PATHEXT} unless $had_pathext;
 }
 
 # path()
-my $had_path = exists $ENV{PATH};
 {
-    my @path_eg = ( qw( . .. ), 'C:\\Program Files' );
-    local $ENV{PATH} = join ';', @path_eg;
-    ok( eq_array( [ $MM->path() ], [ @path_eg ] ),
+    ok( eq_array( [ $MM->path() ], [ File::Spec->path ] ),
         'path() [preset]' );
 }
-# Bug in Perl.  local $ENV{FOO} will not delete key afterwards.
-delete $ENV{PATH} unless $had_path;
 
 # static_lib() should look into that
 # dynamic_bs() should look into that
 # dynamic_lib() should look into that
 
-# clean()
-{
-    my $clean = $Config{cc} =~ /^gcc/i ? 'dll.base dll.exp' : '*.pdb';
-    like( $MM->clean(), qr/^clean ::\s+\Q-$(RM_F) $clean\E\s+$/m,
-          'clean() Makefile target' );
-}
-
 # init_linker
 {
     my $libperl = File::Spec->catfile('$(PERL_INC)', 
@@ -245,6 +234,37 @@ EOSCRIPT
 }
 unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
 
+# is_make_type()
+{
+    # Check for literal nmake
+    SKIP: {
+        skip("Not using 'nmake'", 2) unless $Config{make} eq 'nmake';
+        ok(   $MM->is_make_type('nmake'), '->is_make_type(nmake) true'  );
+       ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+    }
+
+    # Check for literal nmake
+    SKIP: {
+        skip("Not using /nmake/", 2) unless $Config{make} =~ /nmake/;
+        ok(   $MM->is_make_type('nmake'), '->is_make_type(nmake) true'  );
+       ok( ! $MM->is_make_type('dmake'), '->is_make_type(dmake) false' );
+    }
+
+    # Check for literal dmake
+    SKIP: {
+        skip("Not using 'dmake'", 2) unless $Config{make} eq 'dmake';
+        ok(   $MM->is_make_type('dmake'), '->is_make_type(dmake) true'  );
+       ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+    }
+
+    # Check for literal dmake
+    SKIP: {
+        skip("Not using /dmake/", 2) unless $Config{make} =~ /dmake/;
+        ok(   $MM->is_make_type('dmake'), '->is_make_type(dmake) true'  );
+       ok( ! $MM->is_make_type('nmake'), '->is_make_type(nmake) false' );
+    }
+
+}
 
 # xs_o() should look into that
 # top_targets() should look into that
@@ -254,8 +274,8 @@ unlink "${script_name}$script_ext" if -f "${script_name}$script_ext";
 
 # pasthru()
 {
-    my $pasthru = ($Config{make} =~ /^nmake/i ? "/-nologo/" : "");
-    like( $MM->pasthru(), $pasthru, 'pasthru()' );
+    my $pastru = "PASTHRU = " . ($Config{make} =~ /^nmake/i ? "-nologo" : "");
+    is( $MM->pasthru(), $pastru, 'pasthru()' );
 }
 
 package FakeOut;