(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()'
This commit is contained in:
Freddy Vulto 2010-04-22 22:22:50 +02:00
parent da990d18d9
commit 827ad88ebb
3 changed files with 8 additions and 6 deletions

View File

@ -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"
}

View File

@ -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 \

View File

@ -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.