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