Upgrade to ExtUtils::MakeMaker 6.52
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / cd.t
CommitLineData
277189c8 1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't';
6 @INC = ('../lib', 'lib/');
7 }
8 else {
9 unshift @INC, 't/lib/';
10 }
11}
12chdir 't';
13
14my $Is_VMS = $^O eq 'VMS';
15
16use File::Spec;
17
18use Test::More tests => 4;
19
bf87a6a1 20my $dir = File::Spec->catdir("some", "dir");
21my @cd_args = ($dir, "command1", "command2");
277189c8 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),
bf87a6a1 37qq{cd $dir
277189c8 38 command1
39 command2
40 cd $expected_updir};
41 }
42
43 {
44 local *make = sub { "dmake" };
45
46 ::is $mm->cd(@cd_args),
bf87a6a1 47qq{cd $dir && command1
48 cd $dir && command2};
277189c8 49 }
50}
51
52{
53 is +ExtUtils::MM_Unix->cd(@cd_args),
bf87a6a1 54qq{cd $dir && command1
55 cd $dir && command2};
277189c8 56}
57
58SKIP: {
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),
63q{startdir = F$Environment("Default")
21fa6956 64 Set Default [.some.dir]
277189c8 65 command1
66 command2
67 Set Default 'startdir'};
21fa6956 68}