1b39c5158Smillert#!/usr/bin/perl -w 2b39c5158Smillert 3b39c5158SmillertBEGIN { 4b39c5158Smillert unshift @INC, 't/lib/'; 5b39c5158Smillert} 66fb12b70Safresh1 7*eac174f2Safresh1use strict; 8*eac174f2Safresh1use warnings; 96fb12b70Safresh1use File::Temp qw[tempdir]; 106fb12b70Safresh1my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 ); 119f11ffb7Safresh1use Cwd; my $cwd = getcwd; END { chdir $cwd } # so File::Temp can cleanup 126fb12b70Safresh1chdir $tmpdir; 13b39c5158Smillert 14b39c5158Smillertmy $Is_VMS = $^O eq 'VMS'; 15b39c5158Smillert 16b39c5158Smillertuse File::Spec; 17b39c5158Smillert 18b39c5158Smillertuse Test::More tests => 4; 19b39c5158Smillert 20b39c5158Smillertmy $dir = File::Spec->catdir("some", "dir"); 21b39c5158Smillertmy @cd_args = ($dir, "command1", "command2"); 22b39c5158Smillert 23b39c5158Smillert{ 24b39c5158Smillert package Test::MM_Win32; 25b39c5158Smillert use ExtUtils::MM_Win32; 26*eac174f2Safresh1 our @ISA = qw(ExtUtils::MM_Win32); 27b39c5158Smillert 28b39c5158Smillert my $mm = bless {}, 'Test::MM_Win32'; 29b39c5158Smillert 30b39c5158Smillert { 31b39c5158Smillert local *make = sub { "nmake" }; 32b8851fccSafresh1 $mm->_clear_maketype_cache; 33b39c5158Smillert 34b39c5158Smillert my @dirs = (File::Spec->updir) x 2; 35b39c5158Smillert my $expected_updir = File::Spec->catdir(@dirs); 36b39c5158Smillert 37b39c5158Smillert ::is $mm->cd(@cd_args), 38b39c5158Smillertqq{cd $dir 39b39c5158Smillert command1 40b39c5158Smillert command2 41b8851fccSafresh1 cd $expected_updir}, 'nmake'; 42b39c5158Smillert } 43b39c5158Smillert 44b39c5158Smillert { 45b39c5158Smillert local *make = sub { "dmake" }; 46b8851fccSafresh1 $mm->_clear_maketype_cache; 47b39c5158Smillert 48b39c5158Smillert ::is $mm->cd(@cd_args), 49b39c5158Smillertqq{cd $dir && command1 50b8851fccSafresh1 cd $dir && command2}, 'dmake'; 51b39c5158Smillert } 52b39c5158Smillert} 53b39c5158Smillert 54b39c5158Smillert{ 55b39c5158Smillert is +ExtUtils::MM_Unix->cd(@cd_args), 56b39c5158Smillertqq{cd $dir && command1 57b8851fccSafresh1 cd $dir && command2}, 'Unix'; 58b39c5158Smillert} 59b39c5158Smillert 60b39c5158SmillertSKIP: { 61b39c5158Smillert skip("VMS' cd requires vmspath which is only on VMS", 1) unless $Is_VMS; 62b39c5158Smillert 63b39c5158Smillert use ExtUtils::MM_VMS; 64b39c5158Smillert is +ExtUtils::MM_VMS->cd(@cd_args), 65b39c5158Smillertq{startdir = F$Environment("Default") 66b39c5158Smillert Set Default [.some.dir] 67b39c5158Smillert command1 68b39c5158Smillert command2 69b8851fccSafresh1 Set Default 'startdir'}, 'VMS'; 70b39c5158Smillert} 71