Freddy Vulto 5a38f828d4 (testsuite) Split assert_complete() into
assert_complete_many() and assert_complete_one().
Fix ssh completion now that match_items() also matches on prompt.
2010-11-22 22:57:00 +01:00

50 lines
1.3 KiB
Plaintext

proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
set test "Tab should complete"
assert_complete {"bar bar.d/" foo.d/} "cd $::srcdir/fixtures/shared/default/" $test
sync_after_int
set test "Tab should complete cd at cursor position"
# Try completion
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 $::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" }
}
sync_after_int
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 "$::srcdir/fixtures/shared/default/foo.d/" \
"cd $::srcdir/fixtures/shared/default/fo" $test -nospace -expect-cmd-minus fo
sync_after_int
# Reset CDPATH
assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH"
teardown