aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/abbr.in4
-rw-r--r--tests/abbr.out2
-rw-r--r--tests/bind.expect16
-rw-r--r--tests/bind.expect.out1
-rw-r--r--tests/commandline.expect30
-rw-r--r--tests/commandline.expect.err0
-rw-r--r--tests/commandline.expect.out8
-rw-r--r--tests/commandline.expect.status1
8 files changed, 61 insertions, 1 deletions
diff --git a/tests/abbr.in b/tests/abbr.in
index 69fdfb38..be828b08 100644
--- a/tests/abbr.in
+++ b/tests/abbr.in
@@ -31,3 +31,7 @@ abbr -e '~__abbr2'
abbr -- '--__abbr3' 'xyz'
abbr | grep __abbr3
abbr -e '--__abbr3'
+
+# Ensure we are not recognizing later "=" as separators
+abbr d2 env a=b banana
+abbr -l | string match -q d2; or echo "= test failed"
diff --git a/tests/abbr.out b/tests/abbr.out
index b0a9d5ad..53998613 100644
--- a/tests/abbr.out
+++ b/tests/abbr.out
@@ -5,4 +5,4 @@ abbr __abbr1 delta
abbr __abbr1 delta
abbr __abbr1 delta
abbr '~__abbr2' '$xyz'
-abbr -- '--__abbr3' xyz
+abbr -- --__abbr3 xyz
diff --git a/tests/bind.expect b/tests/bind.expect
index 6b5278ee..5ad4fc9c 100644
--- a/tests/bind.expect
+++ b/tests/bind.expect
@@ -97,6 +97,7 @@ expect_prompt -re {\r\nTAXT\r\n} {
# Verify that changing the escape timeout has an effect.
send "set -g fish_escape_delay_ms 100\r"
+
expect_prompt
send "echo fail: lengthened escape timeout"
send "\033"
@@ -122,6 +123,21 @@ expect_prompt -re {\r\nfail: no normal modediinserted\r\n} {
puts stderr "vi replace line, 100ms timeout: short delay"
}
+# Test 't' binding that contains non-zero arity function (forward-jump) followed
+# by another function (and) https://github.com/fish-shell/fish-shell/issues/2357
+send "\033"
+sleep 0.510
+send "ddiecho TEXT\033"
+sleep 0.510
+send "hhtTrN\r"
+expect_prompt -re {\r\nTENT\r\n} {
+ puts "t-binding success"
+} -nounmatched -re {\r\nfail} {
+ puts stderr "t-binding fail"
+} unmatched {
+ puts stderr "Couldn't find expected output 'TENT'"
+}
+
# Switch back to regular (emacs mode) key bindings.
# The custom escape timeout of 100ms set earlier should still be in effect.
send "set -g fish_key_bindings fish_default_key_bindings\r"
diff --git a/tests/bind.expect.out b/tests/bind.expect.out
index 07902427..17437121 100644
--- a/tests/bind.expect.out
+++ b/tests/bind.expect.out
@@ -7,6 +7,7 @@ vi transpose words, default timeout: short delay
vi mode replace char, default timeout: long delay
vi replace line, 100ms timeout: long delay
vi replace line, 100ms timeout: short delay
+t-binding success
emacs transpose words, 100ms timeout: no delay
emacs transpose words, 100ms timeout: short delay
emacs transpose words, 100ms timeout: long delay
diff --git a/tests/commandline.expect b/tests/commandline.expect
new file mode 100644
index 00000000..8db0c833
--- /dev/null
+++ b/tests/commandline.expect
@@ -0,0 +1,30 @@
+# vim: set filetype=expect:
+
+spawn $fish
+
+expect_prompt
+
+send_line "bind '~' 'handle_tilde'"
+expect_prompt
+
+# printing the current buffer should not remove quoting
+send_line "function handle_tilde; echo; echo '@GUARD:1@'; commandline -b; echo '@/GUARD:1@'; commandline -b ''; end"
+expect_prompt
+send_line {echo \en one "two three" four'five six'{7} 'eight~}
+expect_prompt -re {\r\n@GUARD:1@\r\n(.*)\r\n@/GUARD:1@\r\n} {
+ puts "a:"
+ puts $expect_out(1,string)
+} unmatched {
+ abort "Couldn't find guard 1"
+}
+
+# printing the buffer with -o should remove quoting
+send_line "function handle_tilde; echo; echo '@GUARD:2@'; commandline -bo; echo '@/GUARD:2@'; commandline -b ''; end"
+expect_prompt
+send_line {echo one "two three" four'five six'{7} 'eight~}
+expect_prompt -re {\r\n@GUARD:2@\r\n(.*)\r\n@/GUARD:2@\r\n} {
+ puts "b:"
+ puts [string map {\r {}} $expect_out(1,string)]
+} unmatched {
+ abort "Couldn't find guard 2"
+}
diff --git a/tests/commandline.expect.err b/tests/commandline.expect.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/commandline.expect.err
diff --git a/tests/commandline.expect.out b/tests/commandline.expect.out
new file mode 100644
index 00000000..ea3879a8
--- /dev/null
+++ b/tests/commandline.expect.out
@@ -0,0 +1,8 @@
+a:
+echo \en one "two three" four'five six'{7} 'eight
+b:
+echo
+one
+two three
+fourfive six{7}
+eight
diff --git a/tests/commandline.expect.status b/tests/commandline.expect.status
new file mode 100644
index 00000000..573541ac
--- /dev/null
+++ b/tests/commandline.expect.status
@@ -0,0 +1 @@
+0