summaryrefslogtreecommitdiff
path: root/test/lib/completions/cd.exp
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2010-06-16 18:20:29 +0200
committerDavid Paleino <dapal@debian.org>2010-06-16 18:20:29 +0200
commitf9748115fb4b2950fb4df7535fb723c4affde078 (patch)
tree20875f42b219a5d56e8a7e98840f6dbced003ae0 /test/lib/completions/cd.exp
parente5a9b6220e93ca656fd9774c6aefa78241edca6f (diff)
downloadbash-completion-f9748115fb4b2950fb4df7535fb723c4affde078.tar.gz
Imported Upstream version 1.2upstream/1.2
Diffstat (limited to 'test/lib/completions/cd.exp')
-rw-r--r--test/lib/completions/cd.exp47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp
new file mode 100644
index 00000000..58233575
--- /dev/null
+++ b/test/lib/completions/cd.exp
@@ -0,0 +1,47 @@
+proc setup {} {
+ save_env
+}; # setup()
+
+
+proc teardown {} {
+ assert_env_unmodified
+}; # teardown()
+
+
+setup
+
+
+set test "Tab should complete"
+assert_complete {"bar bar.d/" foo.d/} "cd fixtures/shared/default/" $test
+
+
+sync_after_int
+
+
+set test "Tab should complete cd at cursor position"
+ # Try completion
+set cmd "cd 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 /@ { unresolved "$test at prompt" }
+ default { unresolved "$test" }
+}; # expect
+
+
+sync_after_int
+
+
+set test "Tab should complete CDPATH"
+ # Set CDPATH
+assert_bash_exec "CDPATH=\$PWD";
+assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test
+sync_after_int
+ # Reset CDPATH
+assert_bash_exec "unset CDPATH"
+
+
+teardown