summaryrefslogtreecommitdiffstats
path: root/t/scripts/Lintian/Relation/04-multiarch.t
blob: 7f18b6ccf242b420ec4163ab8cd326a824b552cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/perl

use strict;
use warnings;
use Test::More tests => 12;

use Lintian::Relation;

my $orig = 'pkgA:any, pkgB, pkgC:i386';
my $relation = Lintian::Relation->new->load($orig);

ok($relation->satisfies('pkgA:any'),   'pkgA:any satisfies pkgA:any');

ok($relation->satisfies('pkgB'),       'pkgB satisfies pkgB');

ok(!$relation->satisfies('pkgC'),      'pkgC:i386 does not satisfy pkgC');
ok($relation->satisfies('pkgC:i386'),  'pkgC:i386 satisfies pkgC:i386');

ok($relation->satisfies('pkgB:any'),   'pkgB satisfies pkgB:any');

ok(!$relation->satisfies('pkgA'),      'pkgA:any does not satisfy pkgA');

ok(!$relation->satisfies('pkgC:any'),  'pkgC:i386 does not satisfy pkgC:any');

is($relation->to_string, $orig,      'reconstituted eq original');

my @redundancies1
  = Lintian::Relation->new->load('pkgD, pkgD:any')->redundancies;
is_deeply(
    \@redundancies1,
    [['pkgD', 'pkgD:any']],
    'pkgD and pkgD:any are redundant'
);

TODO: {
    local $TODO = ':X => :Y cases are not implemented (in general)';

    my @redundancies2
      = Lintian::Relation->new->load('pkgD:i386, pkgD:any')->redundancies;
    is_deeply(
        \@redundancies2,
        [['pkgD:i386', 'pkgD:any']],
        'pkgD:i386 and pkgD:any are redundant'
    );
}

my @redundancies3
  = Lintian::Relation->new->load('pkgD:i386, pkgD')->redundancies;
is_deeply(\@redundancies3, [],'pkgD:i386 and pkgD are not redundant');

my @redundancies4
  = Lintian::Relation->new->load('pkgD:i386, pkgD:i386 (>= 1.0)')
  ->redundancies;
is_deeply(
    \@redundancies4,
    [['pkgD:i386', 'pkgD:i386 (>= 1.0)']],
    'Can detect pkgD:i386 redundancies'
);

# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et