Commit | Line | Data |
5bdf71cc |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use lib 't/lib'; |
5 | |
6 | use TieOut; |
7 | use Test::More 'no_plan'; |
8 | |
9 | use Config; |
10 | use ExtUtils::MakeMaker; |
11 | |
12 | ok( my $stdout = tie *STDOUT, 'TieOut' ); |
13 | |
14 | # Create a normalized MM object to test with |
15 | my $mm = bless {}, "MM"; |
16 | $mm->{PERL_SRC} = 0; |
17 | $mm->{UNINSTALLED_PERL} = 0; |
18 | |
19 | my $rel2abs = sub { $mm->rel2abs($mm->catfile(@_)) }; |
20 | |
21 | ok $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 |
35 | Your perl and your Config.pm seem to have different ideas about the |
36 | architecture they are running on. |
37 | Perl thinks: [arch1] |
38 | Config says: [$Config{archname}] |
39 | This may or may not cause problems. Please check your installation of perl |
40 | if you have problems building this extension. |
41 | }; |
42 | |
43 | } |
44 | |
45 | |
46 | # Different file path separators [rt.cpan.org 46416] |
47 | SKIP: { |
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 | } |