summaryrefslogtreecommitdiff
path: root/test/lib/completions/ssh.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/completions/ssh.exp')
-rw-r--r--test/lib/completions/ssh.exp41
1 files changed, 12 insertions, 29 deletions
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
index 91955c1d..1599dccc 100644
--- a/test/lib/completions/ssh.exp
+++ b/test/lib/completions/ssh.exp
@@ -1,15 +1,19 @@
proc setup {} {
save_env
-}; # 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/fixtures/ssh}
+}
proc teardown {} {
+ assert_bash_exec {cd $TESTDIR}
assert_env_unmodified {
/BASH_LINENO=/d
/BASH_SOURCE=/d
/OLDPWD=/d
}
-}; # teardown()
+}
setup
@@ -17,19 +21,14 @@ 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" }
-}; # expect
-sync_after_int $prompt
-assert_bash_exec {cd "$TESTDIR"}
+}
sync_after_int
@@ -45,7 +44,7 @@ expect {
-re "^$cmd\r\n.*\r\n/@" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
default { unresolved "$test" }
-}; # expect
+}
sync_after_int
@@ -61,30 +60,14 @@ sync_after_int
set test "First argument should complete partial hostname"
-assert_complete_partial [get_hosts] ssh "" $test /@ 20 \
- [list "ltrim_colon_completions"]
+assert_complete_partial [get_hosts] ssh "" $test -ltrim-colon-completions
sync_after_int
set test "-F should complete filename"
-set dir fixtures/ssh
-set prompt "/$dir/@"
-assert_bash_exec "cd $dir" "" $prompt
-set cmd "ssh -Fsp"
-send "$cmd\t"
-expect -ex "$cmd"
-expect {
- -ex "aced\\ \\ conf" { pass "$test" }
- # _filedir works only if `-o filenames' is in effect, which isn't the
- # case for `ssh'
- -re "aced conf" { xfail "$test" }
- -re $prompt { unresolved "$test at prompt" }
- default { unresolved "$test" }
-}; # expect
-sync_after_int $prompt
-assert_bash_exec {cd "$TESTDIR"}
+assert_complete "-Fspaced\\ \\ conf" "ssh -Fsp" $test
sync_after_int