summaryrefslogtreecommitdiff
path: root/scripts/t/400_Dpkg_Deps.t
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/t/400_Dpkg_Deps.t')
-rw-r--r--scripts/t/400_Dpkg_Deps.t22
1 files changed, 21 insertions, 1 deletions
diff --git a/scripts/t/400_Dpkg_Deps.t b/scripts/t/400_Dpkg_Deps.t
index b37a1c607..e4ea16971 100644
--- a/scripts/t/400_Dpkg_Deps.t
+++ b/scripts/t/400_Dpkg_Deps.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More tests => 25;
use Dpkg::Arch qw(get_host_arch);
use_ok('Dpkg::Deps');
@@ -58,6 +58,26 @@ is($dep_i386->output(), 'libc6 (>= 2.5)', 'Arch reduce 1/3');
is($dep_alpha->output(), 'libc6.1', 'Arch reduce 2/3');
is($dep_hurd->output(), 'libc0.1', 'Arch reduce 3/3');
+my $field_profile = 'dep1 <!profile.stage1 !profile.notest>, ' .
+'dep2 <profile.stage1 !profile.notest>, ' .
+'dep3 <profile.notest !profile.stage1>, ' .
+'dep4 <profile.stage1 profile.notest>, ' .
+'dep5 <profile.stage1>, dep6 <!profile.stage1>';
+my $dep_noprof = deps_parse($field_profile, reduce_profiles => 1, build_profiles => []);
+my $dep_stage1 = deps_parse($field_profile, reduce_profiles => 1, build_profiles => ['stage1']);
+my $dep_notest = deps_parse($field_profile, reduce_profiles => 1, build_profiles => ['notest']);
+my $dep_stage1notest = deps_parse($field_profile, reduce_profiles => 1, build_profiles => ['stage1', 'notest']);
+is($dep_noprof->output(), 'dep1, dep2, dep3, dep6', 'Profile reduce 1/4');
+is($dep_stage1->output(), 'dep2, dep4, dep5', 'Profile reduce 2/4');
+is($dep_notest->output(), 'dep3, dep4, dep6', 'Profile reduce 3/4');
+is($dep_stage1notest->output(), 'dep2, dep3, dep4, dep5', 'Profile reduce 4/4');
+
+my $field_restrict = 'dep1 <!profile.bootstrap !other.restrict>, ' .
+'dep2 <profile.bootstrap other.restrict>, ' .
+'dep3 <!other.restrict>, ' .
+'dep4 <other.restrict>';
+my $dep_restrict = deps_parse($field_restrict, reduce_restrictions => 1, build_profiles => []);
+is($dep_restrict->output(), 'dep1', 'Unknown restrictions reduce');
my $facts = Dpkg::Deps::KnownFacts->new();
$facts->add_installed_package('mypackage', '1.3.4-1', get_host_arch(), 'no');