summaryrefslogtreecommitdiff
path: root/scripts/t/Dpkg_BuildOptions.t
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2017-01-26 00:06:35 +0100
committerGuillem Jover <guillem@debian.org>2017-01-26 23:26:33 +0100
commitdad593660d922abce634542b43e9d56b03228a8c (patch)
treecac271260a548b16f62d916a487dce555a7a3936 /scripts/t/Dpkg_BuildOptions.t
parent8ae966ae7d3635b8359829085db4262923ceae96 (diff)
downloaddpkg-dad593660d922abce634542b43e9d56b03228a8c.tar.gz
Dpkg::BuildOptions: Add new parse_features() method
This has been refactored from Dpkg::Vendor::Debian, to have a generic option parser.
Diffstat (limited to 'scripts/t/Dpkg_BuildOptions.t')
-rw-r--r--scripts/t/Dpkg_BuildOptions.t38
1 files changed, 37 insertions, 1 deletions
diff --git a/scripts/t/Dpkg_BuildOptions.t b/scripts/t/Dpkg_BuildOptions.t
index 6960235ac..a5a9996ae 100644
--- a/scripts/t/Dpkg_BuildOptions.t
+++ b/scripts/t/Dpkg_BuildOptions.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 24;
+use Test::More tests => 28;
use Dpkg::ErrorHandling;
@@ -71,3 +71,39 @@ is($dbo->output(), 'foobar noopt', 'output');
$dbo = Dpkg::BuildOptions->new(envvar => 'OTHER_VARIABLE');
is($dbo->get('parallel'), 5, 'import from other variable, check parallel');
ok($dbo->has('noopt'), 'import from other variable, check noopt');
+
+my %theme = (
+ metal => undef,
+ pink => undef,
+ rusty => undef,
+ sky => undef,
+);
+my %theme_ref;
+
+$dbo = Dpkg::BuildOptions->new();
+
+$theme_ref{$_} = 1 foreach keys %theme;
+$dbo->set('theme', '+all');
+$dbo->parse_option('theme', \%theme);
+is_deeply(\%theme, \%theme_ref, 'features set with +all');
+
+$theme{$_} = undef foreach keys %theme;
+$theme_ref{$_} = 1 foreach keys %theme;
+$theme_ref{rusty} = 0;
+$dbo->set('theme', '+all,-rusty');
+$dbo->parse_option('theme', \%theme);
+is_deeply(\%theme, \%theme_ref, 'features set with +all,-rusty');
+
+$theme{$_} = undef foreach keys %theme;
+$theme_ref{$_} = 0 foreach keys %theme;
+$theme_ref{metal} = 1;
+$dbo->set('theme', '-all,+metal');
+$dbo->parse_option('theme', \%theme);
+is_deeply(\%theme, \%theme_ref, 'features set with +all,-rusty');
+
+$theme{$_} = $theme_ref{$_} = undef foreach keys %theme;
+$theme_ref{pink} = 1;
+$theme_ref{sky} = 0;
+$dbo->set('theme', '+pink,-sky');
+$dbo->parse_option('theme', \%theme);
+is_deeply(\%theme, \%theme_ref, 'features set with +pink,-sky');