#!perl
my
$source
= Pinto::Tester->new;
$source
->populate(
'JOHN/Baz-1.2 = Baz~1.2 & Nuts~2.3'
);
$source
->populate(
'PAUL/Nuts-2.3 = Nuts~2.3'
);
subtest
'add archive with deep dependencies'
=>
sub
{
my
$archive
= make_dist_archive(
"ME/Foo-Bar-0.01 = Foo~0.01; Bar~0.01 & Baz~1.2"
);
my
$local
= Pinto::Tester->new(
init_args
=> {
sources
=>
$source
->stack_url } );
$local
->run_ok(
'Add'
, {
archives
=>
$archive
,
author
=>
'ME'
} );
$local
->registration_ok(
'ME/Foo-Bar-0.01/Foo~0.01'
);
$local
->registration_ok(
'ME/Foo-Bar-0.01/Bar~0.01'
);
$local
->registration_ok(
'JOHN/Baz-1.2/Baz~1.2'
);
$local
->registration_ok(
'PAUL/Nuts-2.3/Nuts~2.3'
);
};
subtest
'add archive with deep unsatisfiable dependencies'
=>
sub
{
my
$archive
= make_dist_archive(
"ME/Foo-Bar-0.01 = Foo~0.01; Bar~0.01 & Baz~2.4"
);
my
$local
= Pinto::Tester->new(
init_args
=> {
sources
=>
$source
->stack_url } );
$local
->run_throws_ok(
'Add'
, {
archives
=>
$archive
,
author
=>
'ME'
},
qr/Cannot find Baz~2.4 anywhere/
);
};
subtest
'add archive that depends on a perl'
=>
sub
{
my
$archive
= make_dist_archive(
"ME/Foo-0.01 = Foo~0.01 & perl~5.10.1"
);
my
$local
= Pinto::Tester->new(
init_args
=> {
sources
=>
$source
->stack_url } );
$local
->run_ok(
'Add'
, {
archives
=>
$archive
,
author
=>
'ME'
} );
$local
->registration_ok(
'ME/Foo-0.01/Foo~0.01'
);
};
subtest
'add archive that depends on a core module'
=>
sub
{
my
$archive
= make_dist_archive(
"ME/Foo-0.01 = Foo~0.01 & Scalar::Util~1.13"
);
my
$local
= Pinto::Tester->new(
init_args
=> {
sources
=>
$source
->stack_url } );
$local
->run_ok(
'Add'
, {
archives
=>
$archive
,
author
=>
'ME'
} );
$local
->registration_ok(
'ME/Foo-0.01/Foo~0.01'
);
};
subtest
'add archive that causes downgrade'
=>
sub
{
my
$local
= Pinto::Tester->new;
my
$foo2
= make_dist_archive(
'Foo-2 = Foo~2'
);
my
$foo1
= make_dist_archive(
'Foo-1 = Foo~1'
);
$local
->run_ok(
Add
=> {
author
=>
'ME'
,
archives
=>
$foo2
} );
$local
->run_ok(
Add
=> {
author
=>
'ME'
,
archives
=>
$foo1
} );
$local
->stderr_like(
qr{Downgrading package ME/Foo-2/Foo~2 to ME/Foo-1/Foo~1}
);
$local
->registration_ok(
'ME/Foo-1.tar.gz/Foo~1'
);
$local
->registration_not_ok(
'ME/Foo-2.tar.gz/Foo~2'
);
my
$bar1
= make_dist_archive(
'Bar-1 = Bar~1 & Foo~1'
);
$local
->run_ok(
Add
=> {
author
=>
'ME'
,
archives
=>
$bar1
} );
$local
->registration_ok(
'ME/Foo-1.tar.gz/Foo~1'
);
$local
->registration_ok(
'ME/Bar-1.tar.gz/Bar~1'
);
my
$bar2
= make_dist_archive(
'Bar-2 = Bar~2 & Foo~2'
);
$local
->run_ok(
Add
=> {
author
=>
'ME'
,
archives
=>
$bar2
} );
$local
->registration_ok(
'ME/Foo-2.tar.gz/Foo~2'
);
$local
->registration_ok(
'ME/Bar-2.tar.gz/Bar~2'
);
$local
->registration_not_ok(
'ME/Foo-1.tar.gz/Foo~1'
);
$local
->registration_not_ok(
'ME/Bar-1.tar.gz/Bar~1'
);
};
done_testing;