#!/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();