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