Update spec before building SRPM
[Fedora-Rebuild.git] / t / 01adddeps.t
blob88762ad34fa7285715394c04c630807f9f75349f
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Test::Simple tests => 5;
5 use Data::Compare;
7 use Fedora::Rebuild::RPM;
9 sub test {
10 my ($name, $stash, $needles, $result) = @_;
11 Fedora::Rebuild::RPM::adddeps($stash, $needles);
12 ok(Compare($stash, $result), $name);
15 test(
16 'Disjunct',
18 n1 => [ ['f1', 'v1'] ]
21 n2 => [ ['f2', 'v2'] ]
24 n1 => [ ['f1', 'v1'] ],
25 n2 => [ ['f2', 'v2'] ]
29 test(
30 'Identic',
32 n1 => [ ['f1', 'v1'] ]
35 n1 => [ ['f1', 'v1'] ]
38 n1 => [ ['f1', 'v1'] ]
42 test(
43 'Identic name, different flags',
45 n1 => [ ['f1', 'v1'] ]
48 n1 => [ ['f2', 'v1'] ]
51 n1 => [ ['f1', 'v1'], ['f2', 'v1'] ]
55 test(
56 'Identic name, different versions',
58 n1 => [ ['f1', 'v1'] ]
61 n1 => [ ['f1', 'v2'] ]
64 n1 => [ ['f1', 'v1'], ['f1', 'v2'] ]
68 test(
69 'Identic name, some versions differ',
71 n1 => [ ['f1', 'v1'], ['f1', 'v2'], ['f1', 'v3'] ]
74 n1 => [ ['f1', 'v1'], ['f1', 'v4'], ['f1', 'v3'] ]
77 n1 => [ ['f1', 'v1'], ['f1', 'v2'], ['f1', 'v3'], ['f1', 'v4'] ]