aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bind.expect
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-09-18 15:45:07 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-18 15:46:17 -0700
commit0a32d96b270345af59ad1c807e9f001894d0bb81 (patch)
tree5b724d3300f6e44b16c71e61818cd8cf0899128f /tests/bind.expect
parent174f5ba99ad633cf538ca0d2644418ea69fe9853 (diff)
Reset fish_bind_mode when changing fish_key_bindings
Also avoid resetting bindings if fish_key_bindings is "modified" without actually changing. Fixes #1638.
Diffstat (limited to 'tests/bind.expect')
-rw-r--r--tests/bind.expect43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/bind.expect b/tests/bind.expect
new file mode 100644
index 00000000..91585c96
--- /dev/null
+++ b/tests/bind.expect
@@ -0,0 +1,43 @@
+# vim: set filetype=expect:
+
+spawn $fish
+
+expect_prompt
+
+# test switching key bindings
+# this should leave the mode in the appropriate state
+
+send_line "set -g fish_key_bindings fish_vi_key_bindings"
+expect_prompt
+send_line -h "echo fail\033ddiecho success"
+expect_prompt -re {\r\nsuccess\r\n} {
+ puts "success"
+} -nounmatched -re {\r\nfail} {
+ puts stderr "fail"
+} unmatched {
+ puts stderr "Couldn't find expected output 'success'"
+}
+# try again without the human typing
+send_line "echo fail\033ddiecho success"
+expect_prompt -re {\r\nsuccess\r\n} {
+ puts "success"
+} -nounmatched -re {\r\nfail} {
+ puts stderr "fail"
+} unmatched {
+ puts stderr "Couldn't find expected output 'success'"
+}
+
+# still in insert mode, switch back to regular key bindings
+send_line "set -g fish_key_bindings fish_default_key_bindings"
+expect_prompt
+send_line "echo success"
+expect_prompt -re {\r\nsuccess\r\n} {
+ puts "success"
+} unmatched {
+ puts stderr "Couldn't find expected output 'success'"
+} timeout {
+ set msg ""
+ append msg "Timeout after setting fish_key_bindings to fish_default_key_bindings\n" \
+ "\$fish_bind_mode is most likely still set to 'insert'"
+ abort $msg
+}