#!/usr/bin/perl
BEGIN {
$| = 1;
$^W = 1;
}
my
$perl
= Probe::Perl->find_perl_interpreter;
@Perl::Dist::Util::Toolchain::DELEGATE
= (
$perl
,
'-Mblib'
,
);
sub
check_simple_object {
my
$toolchain
=
shift
;
is(
$toolchain
->errstr,
undef
,
'->errstr returns false'
);
is(
$toolchain
->perl_version,
'5.008008'
,
'->perl_version ok'
);
my
@modules
=
$toolchain
->modules;
is_deeply( \
@modules
, [
'File::Spec'
],
'List ->modules ok'
);
is(
scalar
(
$toolchain
->modules), 1,
'Scalar ->modules ok'
);
my
@dists
=
$toolchain
->dists;
is(
scalar
(
$toolchain
->dists), 1,
'Scalar ->dists ok'
);
is(
scalar
(
@dists
), 1,
'Got one distribution'
);
like(
$dists
[0],
qr/PathTools/
,
'Got expected dist filename'
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.008008'
,
modules
=> [
'File::Spec'
],
] );
my
$p
=
$toolchain
->prepare;
if
( !
$p
and $@ =~ /Permission denied/ ) {
foreach
( 2 .. 43 ) {
ok( 1,
'No permissions to test, skipping'
);
}
exit
(0);
}
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->run,
'->run ok'
);
check_simple_object(
$toolchain
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.008008'
,
modules
=> [
'File::Spec'
],
force
=> {
'File::Spec'
=>
'PathTools-forced'
,
},
] );
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->run,
'->run ok'
);
check_simple_object(
$toolchain
);
is( (
$toolchain
->dists)[0],
'PathTools-forced'
,
'Force option works'
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.008008'
,
modules
=> [
'File::Spec'
],
] );
isa_ok(
$toolchain
,
'Perl::Dist::Util::Toolchain'
);
ok(
$toolchain
->delegate,
'->prepare ok'
);
check_simple_object(
$toolchain
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.008008'
,
] );
is(
$toolchain
->perl_version,
'5.008008'
,
'->perl_version ok'
);
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->run,
'->run ok'
);
is(
$toolchain
->errstr,
undef
,
'->errstr is undef'
);
my
@dists
=
$toolchain
->dists;
ok(
scalar
(
@dists
) > 5,
'Got at least 5 distributions'
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.008009'
,
] );
is(
$toolchain
->perl_version,
'5.008009'
,
'->perl_version ok'
);
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->run,
'->run ok'
);
is(
$toolchain
->errstr,
undef
,
'->errstr is undef'
);
my
@dists
=
$toolchain
->dists;
ok(
scalar
(
@dists
) > 5,
'Got at least 5 distributions'
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.010000'
,
] );
is(
$toolchain
->perl_version,
'5.010000'
,
'->perl_version ok'
);
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->run,
'->run ok'
);
is(
$toolchain
->errstr,
undef
,
'->errstr is undef'
);
my
@dists
=
$toolchain
->dists;
ok(
scalar
(
@dists
) > 5,
'Got at least 3 distributions'
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.008008'
,
] );
is(
$toolchain
->perl_version,
'5.008008'
,
'->perl_version ok'
);
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->delegate,
'->run ok'
);
is(
$toolchain
->errstr,
undef
,
'->errstr is undef'
);
my
@dists
=
$toolchain
->dists;
ok(
scalar
(
@dists
) > 5,
'Got at least 5 distributions'
);
}
SCOPE: {
my
$toolchain
= new_ok(
'Perl::Dist::Util::Toolchain'
, [
perl_version
=>
'5.010000'
,
] );
is(
$toolchain
->perl_version,
'5.010000'
,
'->perl_version ok'
);
ok(
$toolchain
->prepare,
'->prepare ok'
);
ok(
$toolchain
->delegate,
'->run ok'
);
is(
$toolchain
->errstr,
undef
,
'->errstr is undef'
);
my
@dists
=
$toolchain
->dists;
ok(
scalar
(
@dists
) > 5,
'Got at least 3 distributions'
);
}