#!../miniperl -w
BEGIN {
@INC
=
qw(../win32 ../lib)
;
require
'./test.pl'
;
skip_all(
'FindExt not portable'
)
if
$^O eq
'VMS'
;
}
if
($^O eq
"MSWin32"
&& !
defined
$ENV
{PERL_STATIC_EXT}) {
skip_all
"PERL_STATIC_EXT must be set to the list of static extensions"
;
}
if
(
$Config
{usecrosscompile} ) {
skip_all(
"Not all files are available during cross-compilation"
);
}
FindExt::apply_config(\
%Config
);
FindExt::scan_ext(
"../$_"
)
foreach
qw(cpan dist ext)
;
FindExt::set_static_extensions(
split
' '
, $^O eq
'MSWin32'
?
$ENV
{PERL_STATIC_EXT} :
$Config
{static_ext});
sub
compare {
my
(
$desc
,
$want
,
@have
) =
@_
;
$want
= [
sort
split
' '
,
$want
]
unless
ref
$want
eq
'ARRAY'
;
local
$::Level = $::Level + 1;
is(
scalar
@have
,
scalar
@$want
,
"We find the same number of $desc"
);
is(
"@have"
,
"@$want"
,
"We find the same list of $desc"
);
}
unless
(
join
(
' '
,
sort
split
' '
,
$Config
{extensions})
eq
join
(
' '
, FindExt::extensions())) {
plan(
tests
=> 2);
note(
"configured extension list doesn't match, so only minimal testing is possible"
);
compare(
'known_extensions'
,
$Config
{known_extensions},
FindExt::known_extensions());
}
else
{
plan(
tests
=> 12);
compare(
'known_extensions'
,
$Config
{known_extensions},
FindExt::known_extensions());
my
@config_built
;
my
@found_built
;
foreach
my
$type
(
qw(static dynamic nonxs)
) {
my
@this_found
=
eval
"FindExt::${type}_ext()"
;
push
@found_built
,
@this_found
;
push
@config_built
,
split
' '
,
$Config
{
"${type}_ext"
};
compare(
"${type}_ext"
,
$Config
{
"${type}_ext"
},
@this_found
);
}
compare(
'"config" dynamic + static + nonxs'
,
$Config
{extensions},
sort
@config_built
);
compare(
'"found" dynamic + static + nonxs'
, [FindExt::extensions()],
sort
@found_built
);
}