summaryrefslogtreecommitdiff
path: root/utils/t
diff options
context:
space:
mode:
authorRaphaël Hertzog <hertzog@debian.org>2011-07-16 20:48:33 +0200
committerRaphaël Hertzog <hertzog@debian.org>2011-07-16 20:52:39 +0200
commit244ebc212261030e3da6c289108d4b5ed71aa867 (patch)
treeec5c451413af5f2c2091f767ba3387b99e3c3526 /utils/t
parent91db161013479ad03ef95e7f0ca2f413c5e57925 (diff)
downloaddpkg-244ebc212261030e3da6c289108d4b5ed71aa867.tar.gz
update-alternatives: clarify role of --force concerning removal of links
Modify update-alternatives --remove-all to remove files installed in place of links if --force is used. Add the corresponding non-regression test.
Diffstat (limited to 'utils/t')
-rw-r--r--utils/t/100_update_alternatives.t16
1 files changed, 12 insertions, 4 deletions
diff --git a/utils/t/100_update_alternatives.t b/utils/t/100_update_alternatives.t
index 713f177c2..135188d0f 100644
--- a/utils/t/100_update_alternatives.t
+++ b/utils/t/100_update_alternatives.t
@@ -81,7 +81,7 @@ my @choices = (
);
my $nb_slaves = 4;
plan tests => (4 * ($nb_slaves + 1) + 2) * 26 # number of check_choices
- + 100; # rest
+ + 102; # rest
sub cleanup {
system("rm -rf $tmpdir && mkdir -p $admindir && mkdir -p $altdir");
@@ -119,13 +119,17 @@ sub install_choice {
sub remove_choice {
my ($id, %opts) = @_;
my $alt = $choices[$id];
- my @params = ("--remove", $main_name, $alt->{path});
+ my @params;
+ push @params, @{$opts{params}} if exists $opts{params};
+ push @params, "--remove", $main_name, $alt->{path};
call_ua(\@params, %opts);
}
sub remove_all_choices {
my (%opts) = @_;
- my @params = ("--remove-all", $main_name);
+ my @params;
+ push @params, @{$opts{params}} if exists $opts{params};
+ push @params, "--remove-all", $main_name;
call_ua(\@params, %opts);
}
@@ -150,7 +154,9 @@ sub config_choice {
$input .= "\n";
$opts{from_string} = \$input;
$opts{to_string} = \$output;
- my @params = ("--config", $main_name);
+ my @params;
+ push @params, @{$opts{params}} if exists $opts{params};
+ push @params, "--config", $main_name;
call_ua(\@params, %opts);
}
@@ -466,6 +472,8 @@ ok(!-l $main_link, "auto switching preserves files that should be links");
ok(!-l "$bindir/slave2", "auto switching preserves files that should be slave links");
ok(-f $main_link, "auto switching keeps real file installed as master link");
ok(-f "$bindir/slave2", "auto switching keeps real files installed as slave links");
+remove_all_choices(params => ["--force"]);
+ok(!-e "$bindir/slave2", "forced removeall drops real files installed as slave links");
# test management of pre-existing files #3
cleanup();