summaryrefslogtreecommitdiff
path: root/test/lib/completions/ssh.exp
diff options
context:
space:
mode:
authorFreddy Vulto <freddy@rebase.(none)>2009-06-09 22:49:53 +0200
committerFreddy Vulto <freddy@rebase.(none)>2009-06-09 22:49:53 +0200
commite847d57e50ec28b793e5900c8673bd58c7393c4b (patch)
tree88863b8112d0ddbe26f6bdcaac0dd68427ecc403 /test/lib/completions/ssh.exp
parent468ba8f1504df6782570a9d69c559fe5648cd558 (diff)
downloadbash-completion-e847d57e50ec28b793e5900c8673bd58c7393c4b.tar.gz
Improved test suite from bash-completion-lib
Run the tests with: $ cd test $ ./runCompletionUnit $ ./runCompletionCompletion The last test of unit/_known_hosts gives UNRESOLVED and needs fixing.
Diffstat (limited to 'test/lib/completions/ssh.exp')
-rw-r--r--test/lib/completions/ssh.exp45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
new file mode 100644
index 00000000..37942632
--- /dev/null
+++ b/test/lib/completions/ssh.exp
@@ -0,0 +1,45 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete both commands and hostnames"
+ # Try completion
+set cmd "ssh -F fixtures/ssh/config ls"
+send "$cmd\t"
+set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n/@$cmd$"
+expect {
+ -re $expected { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "-F without space shouldn't error"
+ # Try completion
+set cmd "ssh -F"
+send "$cmd\t "
+set expected "^$cmd $"
+expect {
+ -re "^${cmd}bash: option requires an argument -- F" { fail "$test" }
+ -re $expected { pass "$test" }
+ -re /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+teardown