82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / cd.t
CommitLineData
277189c8 1#!/usr/bin/perl -w
2
3BEGIN {
b78fd716 4 unshift @INC, 't/lib/';
277189c8 5}
6chdir 't';
7
8my $Is_VMS = $^O eq 'VMS';
9
10use File::Spec;
11
12use Test::More tests => 4;
13
bf87a6a1 14my $dir = File::Spec->catdir("some", "dir");
15my @cd_args = ($dir, "command1", "command2");
277189c8 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),
bf87a6a1 31qq{cd $dir
277189c8 32 command1
33 command2
34 cd $expected_updir};
35 }
36
37 {
38 local *make = sub { "dmake" };
39
40 ::is $mm->cd(@cd_args),
bf87a6a1 41qq{cd $dir && command1
42 cd $dir && command2};
277189c8 43 }
44}
45
46{
47 is +ExtUtils::MM_Unix->cd(@cd_args),
bf87a6a1 48qq{cd $dir && command1
49 cd $dir && command2};
277189c8 50}
51
52SKIP: {
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),
57q{startdir = F$Environment("Default")
21fa6956 58 Set Default [.some.dir]
277189c8 59 command1
60 command2
61 Set Default 'startdir'};
21fa6956 62}