The following commit has been merged in the sid branch:
commit 5174ba18f14b60b01749fc0c8a415acbf62254a6
Author: Raphaël Hertzog <[email protected]>
Date:   Thu Jul 29 21:07:18 2010 +0200

    Add u-a non-regression test to ensure the sorting of choices/slaves is ok

diff --git a/utils/t/100_update_alternatives.t 
b/utils/t/100_update_alternatives.t
index 83f8a28..5d92239 100644
--- a/utils/t/100_update_alternatives.t
+++ b/utils/t/100_update_alternatives.t
@@ -46,10 +46,20 @@ my @choices = (
                path => "/bin/cat",
            },
            {
+               "link" => "$bindir/slave3",
+               name => "slave3",
+               path => "/bin/cat",
+           },
+           {
                "link" => "$bindir/slave1",
                name => "slave1",
                path => "/usr/bin/yes",
            },
+           {
+               "link" => "$bindir/slave4",
+               name => "slave4",
+               path => "/bin/cat",
+           },
        ],
     },
     {
@@ -69,9 +79,9 @@ my @choices = (
         slaves => [],
     },
 );
-my $nb_slaves = 2;
+my $nb_slaves = 4;
 plan tests => (4 * ($nb_slaves + 1) + 2) * 24 # number of check_choices
-               + 64;                         # rest
+               + 65;                         # rest
 
 sub cleanup {
     system("rm -rf $tmpdir && mkdir -p $admindir && mkdir -p $altdir");
@@ -220,6 +230,46 @@ check_choice(1, "auto", "initial install 2");
 install_choice(0); # 0 is higher priority
 check_choice(0, "auto", "initial install 3");
 
+# verify that the administrative file is sorted properly
+{
+    local $/ = undef;
+    open(FILE, "<", "$admindir/generic-test") or die $!;
+    my $content = <FILE>;
+    close(FILE);
+    is($content,
+"auto
+$bindir/generic-test
+slave1
+$bindir/slave1
+slave2
+$bindir/slave2
+slave3
+$bindir/slave3
+slave4
+$bindir/slave4
+
+/bin/false
+10
+/bin/date
+
+
+
+/bin/sleep
+5
+
+
+
+
+/bin/true
+20
+/usr/bin/yes
+/bin/cat
+/bin/cat
+/bin/cat
+
+", "administrative file is as expected");
+}
+
 # manual change with --set-selections
 my $input = "doesntexist auto /bin/date\ngeneric-test manual /bin/false\n";
 my $output = "";

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to