summaryrefslogtreecommitdiff
path: root/test/lib/completions/screen.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/completions/screen.exp')
-rw-r--r--test/lib/completions/screen.exp52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
new file mode 100644
index 00000000..985862c1
--- /dev/null
+++ b/test/lib/completions/screen.exp
@@ -0,0 +1,52 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}; # teardown()
+
+
+setup
+
+
+assert_complete_any "screen -"
+
+
+sync_after_int
+
+
+set test "-c should complete files/dirs"
+set dir fixtures/shared/default
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "screen -c "
+set expected {bar {bar bar.d} foo {foo.d}}
+send "$cmd\t"
+expect -ex "$cmd"
+expect {
+ -re "\r\nbar\\s+bar bar.d/\\s+foo\\s+foo.d/" { pass "$test" }
+ # Directories might not be suffixed with a slash (/). This is because
+ # _filedir only works if `-o filenames' is in effect, which isn't the
+ # case for `screen' on bash-3, so an expected failure (xfail)
+ -re "\r\nbar\\s+bar bar.d\\s+foo\\s+foo.d" {
+ if {[lindex $::BASH_VERSINFO 0] < 4} {xfail "$test"} {fail "$test"}
+ }
+ -re "\r\nbar\\s+bar\\\\ bar.d/\\s+foo\\s+foo.d/" {
+ # On bash-3, the space in `bar bar.d' is escaped with a backslash
+ # as a side-effect of emulating `-o filenames'.
+ if {[lindex $::BASH_VERSINFO 0] <= 3} {pass "$test"} {fail "$test"}
+ }
+ -re $prompt { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+sync_after_int $prompt
+assert_bash_exec {cd "$TESTDIR"}
+
+
+
+sync_after_int
+
+
+teardown