Merge branch 'master' into sftp
This commit is contained in:
commit
17ad6be32c
1
CHANGES
1
CHANGES
@ -36,6 +36,7 @@ bash-completion (2.x)
|
||||
* Improve relevance of many user/group completions, depending on context.
|
||||
* Remove most "-o filenames" options to "complete", turn "-o filenames" on
|
||||
dynamically when needed instead.
|
||||
* Add/improve various autotools completions.
|
||||
|
||||
[ Freddy Vulto ]
|
||||
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)
|
||||
|
@ -1575,7 +1575,7 @@ _longopt()
|
||||
fi
|
||||
}
|
||||
# makeinfo and texi2dvi are defined elsewhere.
|
||||
for i in a2ps autoconf automake awk bash bc bison cat colordiff cp csplit \
|
||||
for i in a2ps awk bash bc bison cat colordiff cp csplit \
|
||||
curl cut date df diff dir du enscript env expand fmt fold gperf gprof \
|
||||
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
|
||||
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
|
||||
|
@ -6,6 +6,8 @@ bashcomp_DATA = abook \
|
||||
apt-build \
|
||||
aptitude \
|
||||
aspell \
|
||||
autoconf \
|
||||
automake \
|
||||
autorpm \
|
||||
bash-builtins \
|
||||
bind-utils \
|
||||
|
124
completions/autoconf
Normal file
124
completions/autoconf
Normal file
@ -0,0 +1,124 @@
|
||||
# Completions for autoconf tools
|
||||
|
||||
have autoconf &&
|
||||
_autoconf()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev split=false
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
_split_longopt && split=true
|
||||
|
||||
case "$prev" in
|
||||
--help|-h|--version|-V|--trace|-t)
|
||||
return 0
|
||||
;;
|
||||
--output|-o)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
--warnings|-W)
|
||||
local cats=( cross obsolete syntax )
|
||||
COMPREPLY=( $( compgen -W \
|
||||
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
--prepend-include|-B|--include|-I)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_longopt $1
|
||||
return
|
||||
fi
|
||||
|
||||
_filedir '@(ac|in)'
|
||||
} &&
|
||||
complete -F _autoconf autoconf
|
||||
|
||||
have autoreconf || have autoheader &&
|
||||
_autoreconf()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev split=false
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
_split_longopt && split=true
|
||||
|
||||
case "$prev" in
|
||||
--help|-h|--version|-V)
|
||||
return 0
|
||||
;;
|
||||
--warnings|-W)
|
||||
local cats=( cross gnu obsolete override portability syntax \
|
||||
unsupported )
|
||||
COMPREPLY=( $( compgen -W \
|
||||
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
--prepend-include|-B|--include|-I)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_longopt $1
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $1 == autoheader ]] ; then
|
||||
_filedir '@(ac|in)'
|
||||
else
|
||||
_filedir -d
|
||||
fi
|
||||
} &&
|
||||
complete -F _autoreconf autoreconf autoheader
|
||||
|
||||
have autoscan || have autoupdate &&
|
||||
_autoscan()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev split=false
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
_split_longopt && split=true
|
||||
|
||||
case "$prev" in
|
||||
--help|-h|--version|-V)
|
||||
return 0
|
||||
;;
|
||||
--prepend-include|-B|--include|-I)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_longopt $1
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $1 == autoupdate ]] ; then
|
||||
_filedir '@(ac|in)'
|
||||
else
|
||||
_filedir -d
|
||||
fi
|
||||
} &&
|
||||
complete -F _autoscan autoscan autoupdate
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 4
|
||||
# sh-indent-comment: t
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
80
completions/automake
Normal file
80
completions/automake
Normal file
@ -0,0 +1,80 @@
|
||||
# Completions for automake tools
|
||||
|
||||
have automake &&
|
||||
_automake()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev split=false
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
_split_longopt && split=true
|
||||
|
||||
case "$prev" in
|
||||
--help|--version)
|
||||
return 0
|
||||
;;
|
||||
--warnings|-W)
|
||||
local cats=( gnu obsolete override portability syntax unsupported )
|
||||
COMPREPLY=( $( compgen -W \
|
||||
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
--libdir)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
_longopt $1
|
||||
return
|
||||
fi
|
||||
|
||||
_filedir
|
||||
} &&
|
||||
complete -F _automake automake automake-1.11
|
||||
|
||||
have aclocal &&
|
||||
_aclocal()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev split=false
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
_split_longopt && split=true
|
||||
|
||||
case "$prev" in
|
||||
--help|--print-ac-dir|--version)
|
||||
return 0
|
||||
;;
|
||||
--acdir|-I)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
--output)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
--warnings|-W)
|
||||
local cats=( syntax unsupported )
|
||||
COMPREPLY=( $( compgen -W \
|
||||
'${cats[@]} ${cats[@]/#/no-} all none error' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
$split && return 0
|
||||
|
||||
_longopt $1
|
||||
} &&
|
||||
complete -F _aclocal aclocal aclocal-1.11
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 4
|
||||
# sh-indent-comment: t
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
@ -1,3 +1,3 @@
|
||||
helpers_SCRIPTS = perldoc
|
||||
helpers_SCRIPTS = perl
|
||||
|
||||
EXTRA_DIST = $(helpers_SCRIPTS)
|
||||
|
80
completions/helpers/perl
Executable file
80
completions/helpers/perl
Executable file
@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use Config;
|
||||
use File::Spec::Functions;
|
||||
|
||||
my %seen;
|
||||
|
||||
sub print_modules_real {
|
||||
my ($base, $dir, $word) = @_;
|
||||
|
||||
# returns immediatly if the base doesn't match
|
||||
return if $base && $base !~ /^\Q$word/;
|
||||
|
||||
chdir($dir) or return;
|
||||
|
||||
# print each file
|
||||
foreach my $file (glob('*.pm')) {
|
||||
$file =~ s/\.pm$//;
|
||||
my $module = $base . $file;
|
||||
next if $module !~ /^\Q$word/;
|
||||
next if $seen{$module}++;
|
||||
print $module . "\n";
|
||||
}
|
||||
|
||||
# recurse in each subdirectory
|
||||
foreach my $directory (grep { -d } glob('*')) {
|
||||
my $subdir = $dir . '/' . $directory;
|
||||
if ($directory =~ /^(?:[.\d]+|$Config{archname}|auto)$/) {
|
||||
# exclude subdirectory name from base
|
||||
print_modules_real(undef, $subdir, $word);
|
||||
} else {
|
||||
# add subdirectory name to base
|
||||
print_modules_real($base . $directory . '::', $subdir, $word);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub print_modules {
|
||||
my ($word) = @_;
|
||||
|
||||
foreach my $directory (@INC) {
|
||||
print_modules_real(undef, $directory, $word);
|
||||
}
|
||||
}
|
||||
|
||||
sub print_functions {
|
||||
my ($word) = @_;
|
||||
|
||||
my $perlfunc;
|
||||
for ( @INC, undef ) {
|
||||
return if not defined;
|
||||
$perlfunc = catfile $_, qw( pod perlfunc.pod );
|
||||
last if -r $perlfunc;
|
||||
}
|
||||
|
||||
open my $fh, '<', $perlfunc or return;
|
||||
|
||||
my $nest_level = -1;
|
||||
while ( <$fh> ) {
|
||||
next if 1 .. /^=head2 Alphabetical Listing of Perl Functions$/;
|
||||
++$nest_level if /^=over/;
|
||||
--$nest_level if /^=back/;
|
||||
next if $nest_level;
|
||||
next unless /^=item (-?\w+)/;
|
||||
my $function = $1;
|
||||
next if $function !~ /^\Q$word/;
|
||||
next if $seen{$function}++;
|
||||
print $function . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $type = shift;
|
||||
my $word = shift;
|
||||
|
||||
if ($type eq 'functions') {
|
||||
print_functions($word);
|
||||
} elsif ($type eq 'modules') {
|
||||
print_modules($word);
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use File::Spec::Functions qw( rel2abs catdir catfile no_upwards );
|
||||
|
||||
sub uniq { my %seen; grep { not $seen{$_}++ } @_ }
|
||||
|
||||
sub get_command_line {
|
||||
my $comp = substr $ENV{'COMP_LINE'}, 0, $ENV{'COMP_POINT'};
|
||||
return split /[ \t]+/, $comp, -1; # if not good enough, use Text::ParseWords
|
||||
}
|
||||
|
||||
sub slurp_dir {
|
||||
opendir my $dir, shift or return;
|
||||
no_upwards readdir $dir;
|
||||
}
|
||||
|
||||
sub suggestion_from_name {
|
||||
my ( $file_rx, $path, $name ) = @_;
|
||||
return if not $name =~ /$file_rx/;
|
||||
return $name.'::' if -d catdir $path, $name;
|
||||
return $1;
|
||||
}
|
||||
|
||||
sub suggestions_from_path {
|
||||
my ( $file_rx, $path ) = @_;
|
||||
map { suggestion_from_name $file_rx, $path, $_ } slurp_dir $path;
|
||||
}
|
||||
|
||||
sub get_package_suggestions {
|
||||
my ( $pkg ) = @_;
|
||||
|
||||
my @segment = split /::|:\z/, $pkg, -1;
|
||||
my $file_rx = qr/\A(${\quotemeta pop @segment}\w*)(?:\.pm|\.pod)?\z/;
|
||||
|
||||
my $home = rel2abs $ENV{'HOME'};
|
||||
my $cwd = rel2abs do { require Cwd; Cwd::cwd() };
|
||||
|
||||
my @suggestion =
|
||||
map { suggestions_from_path $file_rx, $_ }
|
||||
uniq map { catdir $_, @segment }
|
||||
grep { $home ne $_ and $cwd ne $_ }
|
||||
map { $_, ( catdir $_, 'pod' ) }
|
||||
map { rel2abs $_ }
|
||||
@INC;
|
||||
|
||||
# fixups
|
||||
if ( $pkg eq '' ) {
|
||||
my $total = @suggestion;
|
||||
@suggestion = grep { not /^perl/ } @suggestion;
|
||||
my $num_hidden = $total - @suggestion;
|
||||
push @suggestion, "perl* ($num_hidden hidden)" if $num_hidden;
|
||||
}
|
||||
elsif ( $pkg =~ /(?<!:):\z/ ) {
|
||||
@suggestion = map { ":$_" } @suggestion;
|
||||
}
|
||||
|
||||
return @suggestion;
|
||||
}
|
||||
|
||||
sub get_function_suggestions {
|
||||
my ( $func ) = @_;
|
||||
|
||||
my $perlfunc;
|
||||
for ( @INC, undef ) {
|
||||
return if not defined;
|
||||
$perlfunc = catfile $_, qw( pod perlfunc.pod );
|
||||
last if -r $perlfunc;
|
||||
}
|
||||
|
||||
open my $fh, '<', $perlfunc or return;
|
||||
|
||||
my @suggestion;
|
||||
my $nest_level = -1;
|
||||
while ( <$fh> ) {
|
||||
next if 1 .. /^=head2 Alphabetical Listing of Perl Functions$/;
|
||||
++$nest_level if /^=over/;
|
||||
--$nest_level if /^=back/;
|
||||
next if $nest_level;
|
||||
push @suggestion, /^=item (-?\w+)/;
|
||||
}
|
||||
|
||||
my $func_rx = qr/\A${\quotemeta $func}/;
|
||||
|
||||
return grep { /$func_rx/ } @suggestion;
|
||||
}
|
||||
|
||||
sub usage {
|
||||
die map "\n$_\n", (
|
||||
"To use, issue the following command in bash:",
|
||||
"\tcomplete -C perldoc-complete -o nospace -o default perldoc",
|
||||
"You probably want to put that line in your ~/.bashrc file.\n",
|
||||
);
|
||||
}
|
||||
|
||||
usage() if not exists $ENV{'COMP_LINE'};
|
||||
|
||||
my ( $cmd, @arg ) = get_command_line();
|
||||
my $word = pop @arg;
|
||||
|
||||
print "$_\n" for ( @arg and @arg[-1] eq '-f' )
|
||||
? get_function_suggestions( $word )
|
||||
: get_package_suggestions( $word );
|
@ -4,10 +4,15 @@ have perl &&
|
||||
{
|
||||
_perlmodules()
|
||||
{
|
||||
COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}::],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -P "$prefix" -W "$( ${BASH_SOURCE[0]%/*}/helpers/perl modules $cur )" -- "$cur" ) )
|
||||
__ltrim_colon_completions "$1"
|
||||
}
|
||||
|
||||
_perlfunctions()
|
||||
{
|
||||
COMPREPLY=( $( compgen -P "$prefix" -W "$( ${BASH_SOURCE[0]%/*}/helpers/perl functions $cur )" -- "$cur" ) )
|
||||
}
|
||||
|
||||
_perl()
|
||||
{
|
||||
local cur prev prefix temp
|
||||
@ -50,7 +55,45 @@ _perl()
|
||||
}
|
||||
complete -F _perl -o nospace perl
|
||||
|
||||
complete -C ${BASH_SOURCE[0]%/*}/helpers/perldoc -o nospace -o default perldoc
|
||||
_perldoc()
|
||||
{
|
||||
local cur prev prefix temp
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref -n : cur prev
|
||||
prefix=""
|
||||
|
||||
# completing an option (may or may not be separated by a space)
|
||||
if [[ "$cur" == -?* ]]; then
|
||||
temp=$cur
|
||||
prev=${temp:0:2}
|
||||
cur=${temp:2}
|
||||
prefix=$prev
|
||||
fi
|
||||
|
||||
# complete builtin perl functions
|
||||
case $prev in
|
||||
-f)
|
||||
_perlfunctions "$cur"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
|
||||
else
|
||||
# return available modules (unless it is clearly a file)
|
||||
if [[ "$cur" != */* ]]; then
|
||||
_perlmodules "$cur"
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
|
||||
'$( PAGER=/bin/cat man perl | \
|
||||
sed -ne "/perl.*Perl overview/,/perlwin32/p" | \
|
||||
awk "\$NF=2 { print \$1}" | command grep perl )' -- "$cur" ) )
|
||||
fi
|
||||
_filedir '@(pl|PL|pm|PM|pod|POD)'
|
||||
fi
|
||||
}
|
||||
complete -F _perldoc -o bashdefault perldoc
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
|
@ -1,6 +1,6 @@
|
||||
AC_PREREQ([2.59])
|
||||
AC_INIT([bash-completion], [1.99])
|
||||
AM_INIT_AUTOMAKE([foreign dejagnu dist-bzip2 no-dist-gzip -Wall -Werror])
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip -Wall -Werror])
|
||||
AC_SUBST(bashcompdir, $sysconfdir/bash_completion.d)
|
||||
AC_SUBST(helpersdir, $sysconfdir/bash_completion.d/helpers)
|
||||
AC_CONFIG_FILES([Makefile completions/Makefile completions/helpers/Makefile test/Makefile])
|
||||
|
@ -17,6 +17,9 @@ Environment variables
|
||||
remotely checked-out files. This requires passwordless access to the
|
||||
remote repository. Default is unset.
|
||||
|
||||
*COMP_IWLIST_SCAN*::
|
||||
If set and not null, `iwconfig` completion will try to complete on
|
||||
available wireless networks identifiers. Default is unset.
|
||||
|
||||
*COMP_KNOWN_HOSTS_WITH_HOSTFILE*::
|
||||
If set and not null (default), known hosts completion will complement
|
||||
|
@ -12,3 +12,5 @@ all:
|
||||
|
||||
distclean-local:
|
||||
rm -rf log tmp
|
||||
|
||||
AUTOMAKE_OPTIONS = dejagnu
|
||||
|
1
test/completion/aclocal.exp
Normal file
1
test/completion/aclocal.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions aclocal
|
@ -9,4 +9,4 @@ expect {
|
||||
}; # expect
|
||||
|
||||
|
||||
source "lib/completions/acroread.exp"
|
||||
source "$::srcdir/lib/completions/acroread.exp"
|
||||
|
1
test/completion/autoheader.exp
Normal file
1
test/completion/autoheader.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions autoheader
|
1
test/completion/autoreconf.exp
Normal file
1
test/completion/autoreconf.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions autoreconf
|
1
test/completion/autoscan.exp
Normal file
1
test/completion/autoscan.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions autoscan
|
1
test/completion/autoupdate.exp
Normal file
1
test/completion/autoupdate.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions autoupdate
|
@ -1,6 +1 @@
|
||||
source "lib/completions/finger.exp"
|
||||
|
||||
# TODO: Dynamic loading of completions. After the tests have run a first time
|
||||
# and real completion is installed, the tests can be run a second time.
|
||||
#
|
||||
# source "lib/completions/finger.exp"
|
||||
assert_source_completions finger
|
||||
|
@ -7,13 +7,12 @@ set -o posix
|
||||
# Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this
|
||||
# troubles and slows down testing
|
||||
unset -f command_not_found_handle
|
||||
# Set prompt to ignore current root directory; display path starting
|
||||
# from here. E.g. prompt: /fixtures/@
|
||||
# Set fixed prompt `/@'
|
||||
TESTDIR=$(pwd)
|
||||
export PS1='$(wd=$(pwd); echo ${wd#$TESTDIR}/)@'
|
||||
export PS1='/@'
|
||||
export PS2='> '
|
||||
# Configure readline
|
||||
export INPUTRC=$TESTDIR/config/inputrc
|
||||
export INPUTRC=$SRCDIR/config/inputrc
|
||||
# When not running via cron, avoid escape junk at beginning of line from
|
||||
# readline, see e.g. http://bugs.gentoo.org/246091
|
||||
[ "$CRON" ] || export TERM=dummy
|
||||
@ -31,7 +30,7 @@ unset -v \
|
||||
COMP_TAR_INTERNAL_PATHS
|
||||
|
||||
# Load bash testsuite helper functions
|
||||
. lib/library.sh
|
||||
. $SRCDIR/lib/library.sh
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
|
0
test/fixtures/acroread/bar
vendored
Normal file
0
test/fixtures/acroread/bar
vendored
Normal file
0
test/fixtures/acroread/foo.d/.gitignore
vendored
Normal file
0
test/fixtures/acroread/foo.d/.gitignore
vendored
Normal file
0
test/fixtures/acroread/t.pdf
vendored
Normal file
0
test/fixtures/acroread/t.pdf
vendored
Normal file
20
test/lib/completions/aclocal.exp
Normal file
20
test/lib/completions/aclocal.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "aclocal "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
@ -1,19 +1,17 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
assert_bash_exec "touch fixtures/shared/default/t.pdf"; # Create temporary files
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_bash_exec "rm fixtures/shared/default/t.pdf"; # Remove temporary files
|
||||
assert_env_unmodified
|
||||
assert_env_unmodified {/OLDPWD/d}
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete {"bar bar.d/" foo.d/ t.pdf} "acroread fixtures/shared/default/"
|
||||
assert_complete_dir {foo.d/ t.pdf} "acroread " $::srcdir/fixtures/acroread
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
20
test/lib/completions/autoheader.exp
Normal file
20
test/lib/completions/autoheader.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "autoheader "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/autoreconf.exp
Normal file
20
test/lib/completions/autoreconf.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "autoreconf "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/autoscan.exp
Normal file
20
test/lib/completions/autoscan.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "autoscan "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/autoupdate.exp
Normal file
20
test/lib/completions/autoupdate.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "autoupdate "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
@ -12,7 +12,7 @@ setup
|
||||
|
||||
|
||||
# Adding a print job is successful?
|
||||
if {[assert_exec {lp -H hold fixtures/shared/default/foo} job "" "untested"]} {
|
||||
if {[assert_exec {lp -H hold $::srcdir/fixtures/shared/default/foo} job "" "untested"]} {
|
||||
# Yes, adding a print-job is successful;
|
||||
# Retrieve job-id, so we can cancel the job after the test
|
||||
set job_id [lindex [split $job] 3]
|
||||
|
@ -12,7 +12,7 @@ setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
assert_complete {"bar bar.d/" foo.d/} "cd fixtures/shared/default/" $test
|
||||
assert_complete {"bar bar.d/" foo.d/} "cd $::srcdir/fixtures/shared/default/" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -20,13 +20,13 @@ sync_after_int
|
||||
|
||||
set test "Tab should complete cd at cursor position"
|
||||
# Try completion
|
||||
set cmd "cd fixtures/shared/default/foo"
|
||||
set cmd "cd $::srcdir/fixtures/shared/default/foo"
|
||||
append cmd \002\002\002; # \002 = ^B = Move cursor left in bash emacs mode
|
||||
#append cmd \033\0133D; # Escape-[-D = Cursor left
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "cd fixtures/shared/default/foo\b\b\b\r\n(\.svn/ +|)bar bar.d/ +foo.d/ *(\.svn/ *|)\r\n/@cd fixtures/shared/default/foo\b\b\b$" { pass "$test" }
|
||||
-re "^cd fixtures/shared/default/foo\b\b\bfoo.d/foo\b\b\b$" { fail "$test: Wrong cursor position" }
|
||||
-re "cd $::srcdir/fixtures/shared/default/foo\b\b\b\r\n(\.svn/ +|)bar bar.d/ +foo.d/ *(\.svn/ *|)\r\n/@cd $::srcdir/fixtures/shared/default/foo\b\b\b$" { pass "$test" }
|
||||
-re "^cd $::srcdir/fixtures/shared/default/foo\b\b\bfoo.d/foo\b\b\b$" { fail "$test: Wrong cursor position" }
|
||||
-re /@ { unresolved "$test at prompt" }
|
||||
default { unresolved "$test" }
|
||||
}
|
||||
@ -39,7 +39,7 @@ set test "Tab should complete CDPATH"
|
||||
# Set CDPATH
|
||||
assert_bash_exec "declare -p CDPATH &>/dev/null && OLDCDPATH=\$CDPATH || :"
|
||||
assert_bash_exec "CDPATH=\$PWD";
|
||||
assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test
|
||||
assert_complete "$::srcdir/fixtures/shared/default/foo.d/" "cd $::srcdir/fixtures/shared/default/fo" $test
|
||||
sync_after_int
|
||||
# Reset CDPATH
|
||||
assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH"
|
||||
|
@ -1,6 +1,6 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
|
||||
assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
|
||||
assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs}
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ set files {
|
||||
.tga .TGA .tif .TIF .tiff .TIFF
|
||||
.xpm .XPM .xwd .XWD
|
||||
}
|
||||
assert_complete_dir $files "evince " "fixtures/evince"
|
||||
assert_complete_dir $files "evince " "$::srcdir/fixtures/evince"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -41,7 +41,7 @@ sync_after_int
|
||||
|
||||
|
||||
set test "-wholename should complete files/dirs"
|
||||
set dir fixtures/shared/default
|
||||
set dir $::srcdir/fixtures/shared/default
|
||||
set files [split [exec bash -c "cd $dir && ls -p"] "\n"]
|
||||
assert_complete_dir $files "find -wholename " $dir
|
||||
|
||||
|
@ -39,7 +39,7 @@ set hosts {}
|
||||
set char ""
|
||||
foreach h [get_known_hosts] {
|
||||
set first [string range $h 0 0]
|
||||
if {$char == "" && [string first $first $COMP_WORDBREAKS] == -1} {set char $first}
|
||||
if {$char == "" && [string first $first $::COMP_WORDBREAKS] == -1} {set char $first}
|
||||
if {$char != ""} {
|
||||
# Only append unique hostnames starting with $char
|
||||
if {$first == $char && [lsearch -exact $hosts "test@$h"] == -1} {
|
||||
|
@ -1,5 +1,5 @@
|
||||
proc setup {} {
|
||||
assert_bash_exec {CLASSPATH=$TESTDIR/fixtures/java/a:$TESTDIR/fixtures/java/bashcomp.jar}
|
||||
assert_bash_exec {CLASSPATH=$SRCDIR/fixtures/java/a:$SRCDIR/fixtures/java/bashcomp.jar}
|
||||
save_env
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ sync_after_int
|
||||
|
||||
|
||||
assert_complete "bashcomp.jarred toplevel" \
|
||||
"java -cp fixtures/java/bashcomp.jar "
|
||||
"java -cp $::srcdir/fixtures/java/bashcomp.jar "
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -37,7 +37,7 @@ assert_no_complete "java -cp \"\" "
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete "a/ bashcomp.jar" "java -jar fixtures/java/"
|
||||
assert_complete "a/ bashcomp.jar" "java -jar $::srcdir/fixtures/java/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -18,7 +18,7 @@ set files {
|
||||
foo/
|
||||
.dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz .DVI.gz .dvi.Z .DVI.Z
|
||||
}
|
||||
assert_complete_dir $files "kdvi " "fixtures/kdvi"
|
||||
assert_complete_dir $files "kdvi " "$::srcdir/fixtures/kdvi"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -17,7 +17,7 @@ setup
|
||||
set files {
|
||||
foo/ .eps .ps .EPS .PS .pdf .PDF
|
||||
}
|
||||
assert_complete_dir $files "kpdf " "fixtures/kpdf"
|
||||
assert_complete_dir $files "kpdf " "$::srcdir/fixtures/kpdf"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -1,5 +1,5 @@
|
||||
proc setup {} {
|
||||
assert_bash_exec {HOME=$TESTDIR/fixtures/lftp}
|
||||
assert_bash_exec {HOME=$SRCDIR/fixtures/lftp}
|
||||
save_env
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ assert_complete_any "lzma "
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d fixtures/xz/"
|
||||
assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d $::srcdir/fixtures/xz/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -1,11 +1,11 @@
|
||||
proc setup {} {
|
||||
assert_bash_exec {export MANPATH=$TESTDIR/fixtures/man}
|
||||
assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man"
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
assert_env_unmodified {/OLDPWD/d}
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ assert_complete "bar" "man b"
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete "fixtures/man/man1/foo.1" "man fixtures/man/man1/f"
|
||||
assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -17,7 +17,7 @@ assert_complete_any "mkdir "
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete {"bar bar.d/" foo.d/} "mkdir fixtures/shared/default/"
|
||||
assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -5,11 +5,10 @@ proc setup_dummy_mnt {} {
|
||||
assert_bash_exec {unset COMPREPLY cur}
|
||||
assert_bash_exec {unset -f _mnt}
|
||||
|
||||
global TESTDIR
|
||||
assert_bash_exec { \
|
||||
_mnt() { \
|
||||
local cur=$(_get_cword); \
|
||||
_linux_fstab $(_get_pword) < "$TESTDIR/fixtures/mount/test-fstab"; \
|
||||
_linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \
|
||||
}; \
|
||||
complete -F _mnt mnt \
|
||||
}
|
||||
@ -53,7 +52,7 @@ sync_after_int
|
||||
set test "Check completing nfs mounts"
|
||||
set expected [list /test/path /test/path2 /second/path]
|
||||
set cmd "mount mocksrv:/"
|
||||
assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/mount/bin:$PATH";}
|
||||
assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIRABS/fixtures/mount/bin:$PATH";}
|
||||
# This needs an explicit cword param or will output "unresolved".
|
||||
assert_complete $expected $cmd $test "/@" 20 "/"
|
||||
sync_after_int
|
||||
|
@ -19,12 +19,12 @@ sync_after_int
|
||||
|
||||
set test "mutt should complete mailboxes"
|
||||
set expected {foo/ bar/ muttrc}
|
||||
assert_complete_dir $expected "mutt -F muttrc -f =" fixtures/mutt
|
||||
assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt
|
||||
|
||||
|
||||
set test "mutt should complete aliases"
|
||||
set expected {a1 a2}
|
||||
assert_complete_dir $expected "mutt -F muttrc -A " fixtures/mutt
|
||||
assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -18,7 +18,7 @@ sync_after_int
|
||||
|
||||
|
||||
set test "Second argument should file complete"
|
||||
set cmd "perl foo fixtures/shared/default/f"
|
||||
set cmd "perl foo $::srcdir/fixtures/shared/default/f"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" }
|
||||
@ -31,7 +31,7 @@ sync_after_int
|
||||
|
||||
|
||||
set test "-I without space should complete directories"
|
||||
set cmd "perl -Ifixtures/shared/default/"
|
||||
set cmd "perl -I$::srcdir/fixtures/shared/default/"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
|
||||
@ -44,7 +44,7 @@ sync_after_int
|
||||
|
||||
|
||||
set test "-I with space should complete directories"
|
||||
set cmd "perl -I fixtures/shared/default/"
|
||||
set cmd "perl -I $::srcdir/fixtures/shared/default/"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" }
|
||||
@ -57,7 +57,7 @@ sync_after_int
|
||||
|
||||
|
||||
set test "-x without space should complete directories"
|
||||
set cmd "perl -xfixtures/shared/default/b"
|
||||
set cmd "perl -x$::srcdir/fixtures/shared/default/b"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
|
||||
@ -70,7 +70,7 @@ sync_after_int
|
||||
|
||||
|
||||
set test "-x with space should complete directories"
|
||||
set cmd "perl -x fixtures/shared/default/b"
|
||||
set cmd "perl -x $::srcdir/fixtures/shared/default/b"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" }
|
||||
|
@ -11,25 +11,6 @@ proc teardown {} {
|
||||
setup
|
||||
|
||||
|
||||
set test "perldoc should complete options"
|
||||
set cmd "perldoc -"
|
||||
send "$cmd\t"
|
||||
expect -ex "$cmd"
|
||||
# We can't anchor on $, simulate typing a magical string instead.
|
||||
set endguard "Magic End Guard"
|
||||
send "$endguard"
|
||||
expect {
|
||||
# NOTE: Expected failure: After switching to pure perl perldoc completion,
|
||||
# the completion of options has disappeared. See commit 07b7ddd1d
|
||||
# and Alioth #312800
|
||||
-re "^$endguard$" { xfail "$test" }
|
||||
-re "-h.*$endguard$" { pass "$test" }
|
||||
}
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set test "perldoc should complete word containing colons"
|
||||
set cmd "perldoc File::"
|
||||
send "$cmd\t"
|
||||
@ -45,6 +26,15 @@ expect {
|
||||
}
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
set test "- should complete options"
|
||||
set options {
|
||||
-h -v -t -u -m -l -F -X -f -q
|
||||
}
|
||||
assert_complete $options "perldoc -"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
proc setup {} {
|
||||
assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db}
|
||||
assert_bash_exec {PKG_DBDIR=$::srcdir/fixtures/pkgtools/db}
|
||||
save_env
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ proc teardown {} {
|
||||
setup
|
||||
|
||||
|
||||
set pkgs [exec bash -c "cd fixtures/pkgtools/db ; compgen -d"]
|
||||
set pkgs [exec bash -c "cd $::srcdir/fixtures/pkgtools/db ; compgen -d"]
|
||||
assert_complete $pkgs "pkg_deinstall "
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
proc setup {} {
|
||||
assert_bash_exec {PORTSDIR=fixtures/pkgtools/ports ; sed -e s,PORTSDIR,$PORTSDIR,g $PORTSDIR/INDEX.dist > $PORTSDIR/INDEX ; cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5}
|
||||
assert_bash_exec {PORTSDIR=$TESTDIR/tmp; sed -e s,PORTSDIR,$PORTSDIR,g $::srcdir/fixtures/pkgtools/ports/INDEX.dist > $PORTSDIR/INDEX; cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5}
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_bash_exec {rm fixtures/pkgtools/ports/INDEX fixtures/pkgtools/ports/INDEX-5}
|
||||
assert_bash_exec {rm $PORTSDIR/INDEX $PORTSDIR/INDEX-5}
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ assert_complete_any "rmdir "
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete {"bar bar.d/" foo.d/} "rmdir fixtures/shared/default/"
|
||||
assert_complete {"bar bar.d/" foo.d/} "rmdir $::srcdir/fixtures/shared/default/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -11,7 +11,7 @@ proc teardown {} {
|
||||
setup
|
||||
|
||||
|
||||
assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt fixtures/shared/default/"
|
||||
assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt $::srcdir/fixtures/shared/default/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -11,7 +11,7 @@ proc teardown {} {
|
||||
setup
|
||||
|
||||
|
||||
assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl fixtures/shared/default/"
|
||||
assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl $::srcdir/fixtures/shared/default/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -1,9 +1,13 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
# NOTE: Changing dir to $SRCDIR is necessary because file locations in the
|
||||
# ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
|
||||
assert_bash_exec {cd $SRCDIR/fixtures/scp}
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_bash_exec {cd $TESTDIR}
|
||||
assert_env_unmodified {
|
||||
/BASH_LINENO=/d
|
||||
/BASH_SOURCE=/d
|
||||
@ -60,8 +64,7 @@ foreach host [get_hosts] {
|
||||
lappend expected blah: doo: gee: hus: ike:
|
||||
# Append local filenames
|
||||
lappend expected config known_hosts "spaced\\ \\ conf"
|
||||
set dir fixtures/scp
|
||||
assert_complete_dir $expected "scp -F config " $dir
|
||||
assert_complete $expected "scp -F config "
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -94,16 +97,12 @@ foreach host [get_hosts] {
|
||||
lappend expected blah: doo: gee: hus: ike: jar:
|
||||
# Append local filenames
|
||||
lappend expected config known_hosts "spaced\\ \\ conf"
|
||||
set dir fixtures/scp
|
||||
#assert_complete_dir $expected "scp -F 'spaced conf' " $dir
|
||||
set prompt "/$dir/@"
|
||||
assert_bash_exec "cd $dir" "" $prompt
|
||||
set cmd "scp -F 'spaced conf' "
|
||||
send "$cmd\t"
|
||||
expect -ex "$cmd\r\n"
|
||||
if {[match_items [lsort -unique $expected] -bash-sort]} {
|
||||
expect {
|
||||
-re $prompt { pass "$test" }
|
||||
-re /@ { pass "$test" }
|
||||
-re eof { unresolved "eof" }
|
||||
}
|
||||
} else {
|
||||
@ -111,7 +110,7 @@ if {[match_items [lsort -unique $expected] -bash-sort]} {
|
||||
# http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
|
||||
if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"}
|
||||
}
|
||||
sync_after_int $prompt
|
||||
sync_after_int
|
||||
assert_bash_exec {cd "$TESTDIR"}
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ sync_after_int
|
||||
|
||||
|
||||
assert_complete {bar "bar bar.d/" foo foo.d/} \
|
||||
"screen -c fixtures/shared/default/" "-c should complete files/dirs"
|
||||
"screen -c $::srcdir/fixtures/shared/default/" "-c should complete files/dirs"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -1,9 +1,13 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
# NOTE: Changing dir to $SRCDIR is necessary because file locations in the
|
||||
# ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
|
||||
assert_bash_exec {cd $SRCDIR/fixtures/sftp}
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_bash_exec {cd $TESTDIR}
|
||||
assert_env_unmodified {
|
||||
/BASH_LINENO=/d
|
||||
/BASH_SOURCE=/d
|
||||
@ -20,8 +24,7 @@ set expected [get_hosts]
|
||||
# Hosts `gee' and `hus' are defined in ./fixtures/sftp/config
|
||||
# Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
|
||||
lappend expected 10.10.10.10 doo gee hus ike
|
||||
set dir fixtures/sftp
|
||||
assert_complete_dir $expected "sftp -F config " $dir
|
||||
assert_complete $expected "sftp -F config "
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -48,19 +51,14 @@ set expected [get_hosts]
|
||||
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf"
|
||||
# Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
|
||||
lappend expected 10.10.10.10 doo gee hus ike jar
|
||||
set dir fixtures/sftp
|
||||
assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir
|
||||
assert_complete $expected "sftp -F spaced\\ \\ conf "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set dir fixtures/sftp
|
||||
set prompt "/$dir/@"
|
||||
assert_bash_exec "cd $dir" "" $prompt
|
||||
assert_complete "-Fspaced\\ \\ conf" "sftp -Fsp" "-F should complete filename"
|
||||
sync_after_int $prompt
|
||||
assert_bash_exec {cd "$TESTDIR"}
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
@ -1,9 +1,13 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
# NOTE: Changing dir to $SRCDIR is necessary because file locations in the
|
||||
# ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
|
||||
assert_bash_exec {cd $SRCDIR/fixtures/ssh}
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_bash_exec {cd $TESTDIR}
|
||||
assert_env_unmodified {
|
||||
/BASH_LINENO=/d
|
||||
/BASH_SOURCE=/d
|
||||
@ -17,19 +21,15 @@ setup
|
||||
|
||||
set test "Tab should complete both commands and hostname"
|
||||
# Try completion
|
||||
set dir fixtures/ssh
|
||||
set prompt "/$dir/@"
|
||||
assert_bash_exec "cd $dir" "" $prompt
|
||||
set cmd "ssh -F config ls"
|
||||
send "$cmd\t"
|
||||
set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n$prompt$cmd$"
|
||||
set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n/@$cmd$"
|
||||
expect {
|
||||
-re $expected { pass "$test" }
|
||||
-re $prompt { unresolved "$test at prompt" }
|
||||
-re /@ { unresolved "$test at prompt" }
|
||||
default { unresolved "$test" }
|
||||
}
|
||||
sync_after_int $prompt
|
||||
assert_bash_exec {cd "$TESTDIR"}
|
||||
sync_after_int
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -69,12 +69,8 @@ sync_after_int
|
||||
|
||||
|
||||
set test "-F should complete filename"
|
||||
set dir fixtures/ssh
|
||||
set prompt "/$dir/@"
|
||||
assert_bash_exec "cd $dir" "" $prompt
|
||||
assert_complete "-Fspaced\\ \\ conf" "ssh -Fsp" "-F should complete filename"
|
||||
sync_after_int $prompt
|
||||
assert_bash_exec {cd "$TESTDIR"}
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
@ -4,20 +4,20 @@ proc setup {} {
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
assert_env_unmodified {/OLDPWD/d}
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete "fixtures/shared/default/foo.d/" "sudo cd fixtures/shared/default/fo"
|
||||
assert_complete_dir foo.d/ "sudo cd fo" $::srcdir/fixtures/shared/default
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete "fixtures/" "sudo sh fix"
|
||||
assert_complete_dir fixtures/ "sudo sh fix" $::srcdir
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -1,6 +1,6 @@
|
||||
proc setup {} {
|
||||
# See fixtures/shared/bin/{arp,ifconfig}
|
||||
assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/shared/bin:$PATH";}
|
||||
assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/fixtures/shared/bin:$PATH";}
|
||||
save_env
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ proc setup {} {
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
assert_env_unmodified {/OLDPWD=/d}
|
||||
}
|
||||
|
||||
|
||||
@ -17,14 +17,14 @@ assert_complete_any "xz "
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \
|
||||
"xz -d fixtures/xz/"
|
||||
assert_complete_dir "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \
|
||||
"xz -d " $::srcdir/fixtures/xz
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
assert_complete "a/ bashcomp.tar" "xz fixtures/xz/"
|
||||
assert_complete_dir "a/ bashcomp.tar" "xz " $::srcdir/fixtures/xz
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
@ -295,7 +295,7 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} {
|
||||
# @param string $cword (optional) Last word of $cmd to complete. See: assert_complete()
|
||||
# @result boolean True if successful, False if not
|
||||
proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} {
|
||||
set prompt "/$dir/@"
|
||||
set prompt "/@"
|
||||
assert_bash_exec "cd $dir" "" $prompt
|
||||
assert_complete $expected $cmd $test $prompt $size $cword
|
||||
sync_after_int $prompt
|
||||
@ -510,7 +510,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} {
|
||||
proc assert_source_completions {command {file ""}} {
|
||||
if {[is_bash_completion_installed_for $command]} {
|
||||
if {[string length $file] == 0} {
|
||||
set file "lib/completions/$command.exp"
|
||||
set file "$::srcdir/lib/completions/$command.exp"
|
||||
}
|
||||
source $file
|
||||
} else {
|
||||
@ -738,9 +738,9 @@ proc _save_env {{file ""}} {
|
||||
|
||||
# Source bash_completion package
|
||||
proc source_bash_completion {} {
|
||||
assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/completions}
|
||||
assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$SRCDIR/.."; pwd)/completions}
|
||||
assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
|
||||
assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion}
|
||||
assert_bash_exec {BASH_COMPLETION=$(cd "$SRCDIR/.."; pwd)/bash_completion}
|
||||
assert_bash_exec {source "$BASH_COMPLETION"}
|
||||
}
|
||||
|
||||
@ -854,10 +854,13 @@ proc find_unique_completion_pair {{list} {partName} {fullName}} {
|
||||
|
||||
# Start bash running as test environment.
|
||||
proc start_bash {} {
|
||||
global TESTDIR TOOL_EXECUTABLE spawn_id
|
||||
global TESTDIR TOOL_EXECUTABLE spawn_id env srcdirabs
|
||||
set TESTDIR [pwd]
|
||||
set srcdirabs [file normalize $::srcdir]; # Absolute srcdir
|
||||
# If `--tool_exec' option not specified, use "bash"
|
||||
if {! [info exists TOOL_EXECUTABLE]} {set TOOL_EXECUTABLE bash}
|
||||
set env(SRCDIR) $::srcdir
|
||||
set env(SRCDIRABS) $::srcdirabs
|
||||
exp_spawn $TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc
|
||||
assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc"
|
||||
# Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
|
||||
|
@ -20,17 +20,17 @@ proc setup {} {
|
||||
# directories containing `*' or `\' aren't allowed on Cygwin/Windows
|
||||
if {! [is_cygwin]} {
|
||||
# Create directory `a*b'
|
||||
assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
|
||||
assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\*b ] && mkdir a\*b && touch a\*b/j || true)}
|
||||
# Create directory `a\b'
|
||||
assert_bash_exec {(cd fixtures/_filedir && [ ! -d a\\b ] && mkdir a\\b && touch a\\b/g || true)}
|
||||
assert_bash_exec {(cd $TESTDIR/tmp && [ ! -d a\\b ] && mkdir a\\b && touch a\\b/g || true)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
if {! [is_cygwin]} {
|
||||
assert_bash_exec {(cd fixtures/_filedir && rm -- a\\b/g && rmdir a\\b/ || true)}
|
||||
assert_bash_exec {(cd fixtures/_filedir && rm -- a\*b/j && rmdir a\*b/ || true)}
|
||||
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\\b/g && rmdir a\\b/ || true)}
|
||||
assert_bash_exec {(cd $TESTDIR/tmp && rm -- a\*b/j && rmdir a\*b/ || true)}
|
||||
}
|
||||
assert_bash_exec {unset COMPREPLY cur}
|
||||
assert_bash_exec {unset -f _f _g}
|
||||
@ -56,7 +56,7 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name ab/ should return e"
|
||||
set cmd "$name ab/"
|
||||
assert_complete_dir e $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir e $cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -64,7 +64,7 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name a\\ b/ should return i"
|
||||
set cmd "$name a\\ b/"
|
||||
assert_complete_dir i $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir i $cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -72,7 +72,7 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name a\\\'b/ should return c"
|
||||
set cmd "$name a\\\'b/"
|
||||
assert_complete_dir c $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir c $cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -80,7 +80,7 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name a\\\"b/ should return d"; #"
|
||||
set cmd "$name a\\\"b/"; #"
|
||||
assert_complete_dir d $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir d $cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -88,8 +88,8 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name a\\\$b/ should return h"
|
||||
set cmd "$name a\\\$b/"
|
||||
assert_complete_dir "\b\b\b\b\b$::TESTDIR/fixtures/_filedir/a\\\\\$b/h" \
|
||||
$cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h" \
|
||||
$cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -101,7 +101,7 @@ foreach name {f f2} {
|
||||
if {! [is_cygwin]} {
|
||||
set test "completing $name a\\\\b/ should return g"
|
||||
set cmd "$name a\\\\b/"
|
||||
assert_complete_dir g $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir g $cmd "$TESTDIR/tmp" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -110,7 +110,7 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name a\\&b/ should return f"
|
||||
set cmd "$name a\\&b/"
|
||||
assert_complete_dir f $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir f $cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -118,7 +118,7 @@ foreach name {f f2} {
|
||||
|
||||
set test "completing $name a\$ should return a\\\$b/"
|
||||
set cmd "$name a\$"
|
||||
assert_complete_dir "\b\\\\\$b/" $cmd "fixtures/_filedir" $test
|
||||
assert_complete_dir "\b\\\\\$b/" $cmd "$::srcdir/fixtures/_filedir" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -132,21 +132,21 @@ foreach name {f f2} {
|
||||
[lindex $::BASH_VERSINFO 2] < 35
|
||||
)} {
|
||||
set cmd "$name 'ab/"
|
||||
assert_complete_dir {e'} $cmd "fixtures/_filedir"
|
||||
assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name 'a b/"
|
||||
assert_complete_dir {i'} $cmd "fixtures/_filedir"
|
||||
assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name 'a\"b/"; #"
|
||||
assert_complete_dir {d'} $cmd "fixtures/_filedir"
|
||||
assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -154,9 +154,9 @@ foreach name {f f2} {
|
||||
|
||||
set cmd "$name 'a\$b/"
|
||||
if {[lindex $::BASH_VERSINFO 0] == 4} {
|
||||
assert_complete_dir {h'} $cmd "fixtures/_filedir"
|
||||
assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
|
||||
} else {
|
||||
assert_complete_dir "\b\b\b\b$::TESTDIR/fixtures/_filedir/a\$b/h'" $cmd "fixtures/_filedir"
|
||||
assert_complete_dir "\b\b\b\b$::srcdirabs/fixtures/_filedir/a\$b/h'" $cmd "$::srcdir/fixtures/_filedir"
|
||||
}
|
||||
|
||||
|
||||
@ -166,8 +166,8 @@ foreach name {f f2} {
|
||||
# Execute these tests only when not running on Cygwin/Windows, because
|
||||
# directories containing `*' or `\' aren't allowed on Cygwin/Windows
|
||||
if {! [is_cygwin]} {
|
||||
set cmd "$name 'a\\b/"
|
||||
assert_complete_dir {g'} $cmd "fixtures/_filedir"
|
||||
set cmd "$name '$TESTDIR/tmp/a\\b/"
|
||||
assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -175,63 +175,63 @@ foreach name {f f2} {
|
||||
|
||||
|
||||
set cmd "$name 'a&b/"
|
||||
assert_complete_dir {f'} $cmd "fixtures/_filedir"
|
||||
assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"ab/"; #"
|
||||
assert_complete_dir {e"} $cmd "fixtures/_filedir"; #"
|
||||
assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a b/"; #"
|
||||
assert_complete_dir {i"} $cmd "fixtures/_filedir"; #"
|
||||
assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a'b/"; #"
|
||||
assert_complete_dir {c"} $cmd "fixtures/_filedir"; #"
|
||||
assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a\\\"b/"; #"
|
||||
assert_complete_dir {d"} $cmd "fixtures/_filedir"; #"
|
||||
assert_complete_dir {d"} $cmd "$::srcdir/fixtures/_filedir"; #"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a\\\$b/"; #"
|
||||
assert_complete_dir "\b\b\b\b\b$::TESTDIR/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "fixtures/_filedir"
|
||||
assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a\\b/"; #"
|
||||
assert_complete_dir "\b\b\bb/e\\\"" $cmd "fixtures/_filedir"
|
||||
assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a\\\\b/"; #"
|
||||
assert_complete_dir {g"} $cmd "fixtures/_filedir"; #"
|
||||
assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
set cmd "$name \"a&b/"; #"
|
||||
assert_complete_dir {f"} $cmd "fixtures/_filedir"; #"
|
||||
assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -242,7 +242,7 @@ foreach name {f f2} {
|
||||
|
||||
|
||||
set test "completing with filter '.e1' should show completions"
|
||||
assert_complete_dir {ee.e1 foo/ gg.e1 ii.E1} "g " "fixtures/_filedir/ext" $test
|
||||
assert_complete_dir {ee.e1 foo/ gg.e1 ii.E1} "g " "$::srcdir/fixtures/_filedir/ext" $test
|
||||
|
||||
|
||||
sync_after_int
|
||||
@ -259,7 +259,7 @@ if {
|
||||
[string first "UTF-8" $::LC_CTYPE] != -1 &&
|
||||
[string first 5.44 [exp_version]] != 0
|
||||
} {
|
||||
assert_complete_dir g "f aé/" "fixtures/_filedir"
|
||||
assert_complete_dir g "f aé/" "$::srcdir/fixtures/_filedir"
|
||||
} else {
|
||||
unsupported "$test"
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
proc setup {} {
|
||||
# NOTE: Changing dir to $SRCDIR is necessary because file locations in the
|
||||
# ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR.
|
||||
assert_bash_exec {cd $SRCDIR}
|
||||
save_env
|
||||
}
|
||||
|
||||
@ -8,6 +11,7 @@ proc teardown {} {
|
||||
/COMPREPLY=/d
|
||||
/OLDHOME=/d
|
||||
}
|
||||
assert_bash_exec {cd $TESTDIR}
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +83,7 @@ set hosts [get_hosts]
|
||||
lappend hosts two three
|
||||
set hosts [join [bash_sort $hosts] "\\s+"]
|
||||
# Setup environment
|
||||
set cmd {OLDHOME=$HOME; HOME=$TESTDIR}
|
||||
set cmd {OLDHOME=$HOME; HOME=$SRCDIRABS}
|
||||
send "$cmd\r"
|
||||
expect -ex "$cmd\r\n/@"
|
||||
# Call _known_hosts
|
||||
|
@ -18,9 +18,8 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
|
||||
set test {compgen -f a\\\'b/ on bash-4 should return a\'b/c};
|
||||
set cmd {compgen -f a\\\'b/}
|
||||
}
|
||||
set dir fixtures/compgen
|
||||
set prompt "/$dir/@"
|
||||
assert_bash_exec "cd $dir" "" $prompt
|
||||
set dir $::srcdir/fixtures/compgen
|
||||
assert_bash_exec "cd $dir"
|
||||
send "$cmd\r"
|
||||
expect -ex "$cmd\r\n"
|
||||
expect {
|
||||
@ -37,13 +36,13 @@ expect {
|
||||
if {[lindex $::BASH_VERSINFO 0] <= 3 } \
|
||||
{pass $test} else {fail $test}
|
||||
}
|
||||
-re $prompt { pass "$test" }
|
||||
-re /@ { pass "$test" }
|
||||
-re eof { unresolved "eof" }
|
||||
}
|
||||
sync_after_int $prompt
|
||||
sync_after_int
|
||||
assert_bash_exec {cd "$TESTDIR"}
|
||||
|
||||
#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen
|
||||
#assert_bash_list_dir {a\\\'b/c} $cmd $::srcdir/fixtures/compgen
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
Loading…
x
Reference in New Issue
Block a user