Noninstallable test case
[Fedora-Rebuild.git] / t / 03is_installable.t
blobc14144864096b412b969b3acd2c298cb7392b614
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 use Test::Simple tests => 3;
7 use Fedora::Rebuild::Solver;
8 use Fedora::Rebuild::Set::Package;
9 use Fedora::Rebuild::Package;
10 use Fedora::Rebuild::RPM;
12 my %common = (
13 workdir => 't/tmp',
14 dist => 'foo',
15 target => 'foo',
16 message => 'foo',
18 my $a = Fedora::Rebuild::Package->new('name'=>'a', %common,
19 provides => { 'a' => [[Fedora::Rebuild::RPM::ANY, '']] }
21 my $b = Fedora::Rebuild::Package->new('name'=>'b', %common,
22 provides => { 'b' => [[Fedora::Rebuild::RPM::ANY, '']] },
23 runrequires => { 'a' => [[Fedora::Rebuild::RPM::ANY, '']] }
25 my $c = Fedora::Rebuild::Package->new('name'=>'c', %common,
26 provides => { 'c' => [[Fedora::Rebuild::RPM::ANY, '']] },
27 runrequires => { 'nonexistent' => [[Fedora::Rebuild::RPM::ANY, '']] }
30 my $packages = Fedora::Rebuild::Set::Package->new();
31 $packages->insert($a);
32 $packages->insert($b);
33 $packages->insert($c);
35 my $solver = Fedora::Rebuild::Solver->new(packages => $packages);
37 ok($solver->is_installable($a), 'a does not require nothing');
38 ok($solver->is_installable($b), 'b requires a');
39 ok(! $solver->is_installable($c), 'c requires nonexistent');