[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 827ad88ebb6fcee6cbf0a982584629436b411239

Freddy Vulto fvulto at gmail.com
Thu Apr 22 20:25:53 UTC 2010


The following commit has been merged in the master branch:
commit 827ad88ebb6fcee6cbf0a982584629436b411239
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Thu Apr 22 22:22:50 2010 +0200

    (testsuite) Expand PATH with 'sbin' directories
    This allows for testing completions of system administrator commands,
    which are installed via the same PATH expansion in
    `bash_completion.have()'

diff --git a/bash_completion b/bash_completion
index 570623e..5967ba8 100644
--- a/bash_completion
+++ b/bash_completion
@@ -167,6 +167,8 @@ complete -b builtin
 have()
 {
     unset -v have
+    # Completions for system administrator commands are installed as well in
+    # case completion is attempted via `sudo command ...'.
     PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
     have="yes"
 }
diff --git a/test/config/bashrc b/test/config/bashrc
index cc21db7..ddf0633 100644
--- a/test/config/bashrc
+++ b/test/config/bashrc
@@ -19,6 +19,9 @@ export INPUTRC=$TESTDIR/config/inputrc
 [ "$CRON" ] || export TERM=dummy
 	# Ensure enough columns so expect doesn't have to care about line breaks
 stty columns 150
+    # Also test completions of system administrator commands, which are
+    # installed via the same PATH expansion in `bash_completion.have()'
+export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
 
 	# Make sure default settings are in effect
 unset -v \
diff --git a/test/lib/library.exp b/test/lib/library.exp
index b8fd9f2..c76d985 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -481,10 +481,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} {
 # @param string $file  (optional) File to source/run.  Default is
 #                      "lib/completions/$cmd.exp".
 proc assert_source_completions {command {file ""}} {
-    if {
-        [is_bash_completion_installed_for $command] && 
-        [assert_bash_type $command]
-    } {
+    if {[is_bash_completion_installed_for $command]} {
         if {[string length $file] == 0} {
             set file "lib/completions/$command.exp"
         }
@@ -492,7 +489,7 @@ proc assert_source_completions {command {file ""}} {
     } else {
         untested $command
     }
-}; # assert_source_completions()
+}
 
 
 # Sort list.
@@ -502,7 +499,7 @@ proc assert_source_completions {command {file ""}} {
 # @return list  Sort list
 proc bash_sort {items} {
     return [split [exec sort << [join $items "\n"]] "\n"]
-}; # bash_sort()
+}
 
 
 # Get 'known' hostnames.  Looks also in ssh's 'known_hosts' files.

-- 
bash-completion



More information about the Bash-completion-commits mailing list