Upgrade to ExtUtils::MakeMaker 6.52
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / arch_check.t
CommitLineData
5bdf71cc 1#!/usr/bin/perl -w
2
3use strict;
4use lib 't/lib';
5
6use TieOut;
7use Test::More 'no_plan';
8
9use Config;
10use ExtUtils::MakeMaker;
11
12ok( my $stdout = tie *STDOUT, 'TieOut' );
13
14# Create a normalized MM object to test with
15my $mm = bless {}, "MM";
16$mm->{PERL_SRC} = 0;
17$mm->{UNINSTALLED_PERL} = 0;
18
19my $rel2abs = sub { $mm->rel2abs($mm->catfile(@_)) };
20
21ok $mm->arch_check(
22 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
23 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
24);
25
26
27# Different architecures.
28{
29 ok !$mm->arch_check(
30 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
31 $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
32 );
33
34 like $stdout->read, qr{\Q
35Your perl and your Config.pm seem to have different ideas about the
36architecture they are running on.
37Perl thinks: [arch1]
38Config says: [$Config{archname}]
39This may or may not cause problems. Please check your installation of perl
40if you have problems building this extension.
41};
42
43}
44
45
46# Different file path separators [rt.cpan.org 46416]
47SKIP: {
48 skip "Can't load File::Spec::Win32" unless eval "require File::Spec::Win32";
49 local @File::Spec::ISA = qw(File::Spec::Win32);
50 ok $mm->arch_check(
51 "/_64/perl1004/lib/Config.pm",
52 '\\_64\\perl1004\\lib\\Config.pm',
53 );
54}
55
56
57# PERL_SRC is set, no check is done
58{
59 local $mm->{PERL_SRC} = 1;
60 ok $mm->arch_check(
61 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
62 $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
63 );
64
65 is $stdout->read, '';
66}
67
68
69# UNINSTALLED_PERL is set, no message is sent
70{
71 local $mm->{UNINSTALLED_PERL} = 1;
72 ok !$mm->arch_check(
73 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
74 $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
75 );
76
77 like $stdout->read, qr{^Have .*\nWant .*$};
78}