Upgrade to ExtUtils::MakeMaker 6.52
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / cd.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = ('../lib', 'lib/');
7     }
8     else {
9         unshift @INC, 't/lib/';
10     }
11 }
12 chdir 't';
13
14 my $Is_VMS = $^O eq 'VMS';
15
16 use File::Spec;
17
18 use Test::More tests => 4;
19
20 my $dir = File::Spec->catdir("some", "dir");
21 my @cd_args = ($dir, "command1", "command2");
22
23 {
24     package Test::MM_Win32;
25     use ExtUtils::MM_Win32;
26     @ISA = qw(ExtUtils::MM_Win32);
27
28     my $mm = bless {}, 'Test::MM_Win32';
29
30     {
31         local *make = sub { "nmake" };
32
33         my @dirs = (File::Spec->updir) x 2;
34         my $expected_updir = File::Spec->catdir(@dirs);
35         
36         ::is $mm->cd(@cd_args),
37 qq{cd $dir
38         command1
39         command2
40         cd $expected_updir};
41     }
42     
43     {
44         local *make = sub { "dmake" };
45
46         ::is $mm->cd(@cd_args),
47 qq{cd $dir && command1
48         cd $dir && command2};
49     }
50 }
51
52 {
53     is +ExtUtils::MM_Unix->cd(@cd_args),
54 qq{cd $dir && command1
55         cd $dir && command2};
56 }
57
58 SKIP: {
59     skip("VMS' cd requires vmspath which is only on VMS", 1) unless $Is_VMS;
60     
61     use ExtUtils::MM_VMS;
62     is +ExtUtils::MM_VMS->cd(@cd_args),
63 q{startdir = F$Environment("Default")
64         Set Default [.some.dir]
65         command1
66         command2
67         Set Default 'startdir'};
68 }