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
|
#!/usr/bin/perl
use strict ;
use warnings ;
use Test::More;
use URPM::Resolve;
my $testcases = [
{
property => 'mageia-release[>= 1]',
name => 'mageia-release',
op => '>=',
version => '1',
}, {
property => 'mageia-release >= 1',
name => 'mageia-release',
op => '>=',
version => '1',
}, {
property => 'python3.10dist(fonttools[unicode])[>= 4.10]',
name => 'python3.10dist(fonttools[unicode])',
op => '>=',
version => '4.10',
}, {
property => 'python3.10dist(fonttools[unicode])',
name => 'python3.10dist(fonttools[unicode])',
op => '',
version => '',
}, {
property => 'openssl[*][>= 0.9.7]',
name => 'openssl',
op => '>=',
version => '0.9.7',
}, {
property => 'openssl[*]',
name => 'openssl',
op => '',
version => '',
}];
foreach my $tc (@$testcases) {
is(URPM::property2name($tc->{property}), $tc->{name}, "property2name(\"$tc->{property}\")");
my $expected = [$tc->{name}, $tc->{op} ? "$tc->{op} $tc->{version}" : ""];
my @got = URPM::property2name_range($tc->{property});
is_deeply(\@got, $expected, "property2name_range(\"$tc->{property}\")");
$expected = [$tc->{name}, $tc->{op}, $tc->{version}];
@got = URPM::property2name_op_version($tc->{property});
is_deeply(\@got, $expected, "property2name_op_version(\"$tc->{property}\")");
}
done_testing();
|