#!/usr/bin/perl -w
ok(
my
$stdout
=
tie
*STDOUT
,
'TieOut'
);
my
$mm
=
bless
{},
"MM"
;
$mm
->{PERL_SRC} = 0;
$mm
->{UNINSTALLED_PERL} = 0;
my
$rel2abs
=
sub
{
$mm
->rel2abs(
$mm
->catfile(
@_
)) };
ok
$mm
->arch_check(
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch1 Config.pm)
),
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch1 Config.pm)
),
);
{
ok !
$mm
->arch_check(
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch1 Config.pm)
),
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch2 Config.pm)
),
);
like
$stdout
->
read
,
qr{\Q
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [arch1]
Config says: [$Config{archname}
]
This may or may not cause problems. Please check your installation of perl
if
you have problems building this extension.
};
}
SKIP: {
skip
"Win32 test"
, 1
unless
File::Spec->isa(
"File::Spec::Win32"
);
ok
$mm
->arch_check(
"/_64/perl1004/lib/Config.pm"
,
'\\_64\\perl1004\\lib\\Config.pm'
,
);
}
{
$stdout
->
read
;
local
$mm
->{PERL_SRC} = 1;
ok
$mm
->arch_check(
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch1 Config.pm)
),
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch2 Config.pm)
),
);
is
$stdout
->
read
,
''
;
}
{
local
$mm
->{UNINSTALLED_PERL} = 1;
ok !
$mm
->arch_check(
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch1 Config.pm)
),
$rel2abs
->(
qw(. t testdata reallylongdirectoryname arch2 Config.pm)
),
);
like
$stdout
->
read
,
qr{^Have .*\nWant .*$}
;
}