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