summaryrefslogtreecommitdiffstats
path: root/t/scripts/Lintian/Relation/04-multiarch.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:42:30 +0000
commit75808db17caf8b960b351e3408e74142f4c85aac (patch)
tree7989e9c09a4240248bf4658a22208a0a52d991c4 /t/scripts/Lintian/Relation/04-multiarch.t
parentInitial commit. (diff)
downloadlintian-75808db17caf8b960b351e3408e74142f4c85aac.tar.xz
lintian-75808db17caf8b960b351e3408e74142f4c85aac.zip
Adding upstream version 2.117.0.upstream/2.117.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/scripts/Lintian/Relation/04-multiarch.t')
-rwxr-xr-xt/scripts/Lintian/Relation/04-multiarch.t64
1 files changed, 64 insertions, 0 deletions
diff --git a/t/scripts/Lintian/Relation/04-multiarch.t b/t/scripts/Lintian/Relation/04-multiarch.t
new file mode 100755
index 0000000..7f18b6c
--- /dev/null
+++ b/t/scripts/Lintian/Relation/04-multiarch.t
@@ -0,0 +1,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