From 4d035cbd10d4cdb2fc90c500ea68e4297114e412 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 26 Jun 2019 21:10:01 +0200 Subject: [PATCH] Port bind tests to littlecheck --- tests/bind.err | 5 --- tests/bind.in | 33 ---------------- tests/bind.out | 55 -------------------------- tests/checks/bind.fish | 90 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 93 deletions(-) delete mode 100644 tests/bind.err delete mode 100644 tests/bind.in delete mode 100644 tests/bind.out create mode 100644 tests/checks/bind.fish diff --git a/tests/bind.err b/tests/bind.err deleted file mode 100644 index 8b777ec7b..000000000 --- a/tests/bind.err +++ /dev/null @@ -1,5 +0,0 @@ -# Verify that an invalid bind mode is rejected. -bind: mode name 'bad bind mode' is not valid. See `help identifiers`. -# Verify that an invalid bind mode target is rejected. -bind: mode name 'bind-mode' is not valid. See `help identifiers`. -bind: No binding found for sequence '\t' diff --git a/tests/bind.in b/tests/bind.in deleted file mode 100644 index 17c7e7bb8..000000000 --- a/tests/bind.in +++ /dev/null @@ -1,33 +0,0 @@ -# Test various `bind` command invocations. This is meant to verify that -# invalid flags, mode names, etc. are caught as well as to verify that valid -# ones are allowed. - -echo \# Verify that an invalid bind mode is rejected. >&2 -bind -m 'bad bind mode' \cX true -echo \# Verify that an invalid bind mode target is rejected. >&2 -bind -M bind-mode \cX true - -# This should succeed and result in a success, zero, status. -bind -M bind_mode \cX true - -### HACK: All full bind listings need to have the \x7f -> backward-delete-char -# binding explicitly removed, because on some systems that's backspace, on others not. -echo \# Listing bindings -bind | string match -v '*backward-delete-char' -bind --user --preset | string match -v '*backward-delete-char' -echo \# Preset only -bind --preset | string match -v '*backward-delete-char' -echo \# User only -bind --user | string match -v '*backward-delete-char' - -echo \# Adding bindings -bind \t 'echo banana' -bind | string match -v '*backward-delete-char' -echo \# Erasing bindings -bind --erase \t -bind \t -bind \t 'echo wurst' -bind --erase --user --preset \t -bind \t - -exit 0 diff --git a/tests/bind.out b/tests/bind.out deleted file mode 100644 index 39053cc6c..000000000 --- a/tests/bind.out +++ /dev/null @@ -1,55 +0,0 @@ -# Listing bindings -bind --preset '' self-insert -bind --preset \n execute -bind --preset \r execute -bind --preset \t complete -bind --preset \cc commandline\ \'\' -bind --preset \cd exit -bind --preset \ce bind -bind --preset \e\[A up-line -bind --preset \e\[B down-line -bind --preset \e\[C forward-char -bind --preset \e\[D backward-char -bind -M bind_mode \cx true -bind --preset '' self-insert -bind --preset \n execute -bind --preset \r execute -bind --preset \t complete -bind --preset \cc commandline\ \'\' -bind --preset \cd exit -bind --preset \ce bind -bind --preset \e\[A up-line -bind --preset \e\[B down-line -bind --preset \e\[C forward-char -bind --preset \e\[D backward-char -bind -M bind_mode \cx true -# Preset only -bind --preset '' self-insert -bind --preset \n execute -bind --preset \r execute -bind --preset \t complete -bind --preset \cc commandline\ \'\' -bind --preset \cd exit -bind --preset \ce bind -bind --preset \e\[A up-line -bind --preset \e\[B down-line -bind --preset \e\[C forward-char -bind --preset \e\[D backward-char -# User only -bind -M bind_mode \cx true -# Adding bindings -bind --preset '' self-insert -bind --preset \n execute -bind --preset \r execute -bind --preset \t complete -bind --preset \cc commandline\ \'\' -bind --preset \cd exit -bind --preset \ce bind -bind --preset \e\[A up-line -bind --preset \e\[B down-line -bind --preset \e\[C forward-char -bind --preset \e\[D backward-char -bind -M bind_mode \cx true -bind \t 'echo banana' -# Erasing bindings -bind --preset \t complete diff --git a/tests/checks/bind.fish b/tests/checks/bind.fish new file mode 100644 index 000000000..9b483689f --- /dev/null +++ b/tests/checks/bind.fish @@ -0,0 +1,90 @@ +#RUN: %fish %s +# Test various `bind` command invocations. This is meant to verify that +# invalid flags, mode names, etc. are caught as well as to verify that valid +# ones are allowed. + +# Verify that an invalid bind mode is rejected. >&2 +bind -m 'bad bind mode' \cX true +# CHECKERR: bind: mode name 'bad bind mode' is not valid. See `help identifiers`. +# Verify that an invalid bind mode target is rejected. >&2 +bind -M bind-mode \cX true +# CHECKERR: bind: mode name 'bind-mode' is not valid. See `help identifiers`. +# CHECKERR: bind: No binding found for sequence '\t' + +# This should succeed and result in a success, zero, status. +bind -M bind_mode \cX true + +### HACK: All full bind listings need to have the \x7f -> backward-delete-char +# binding explicitly removed, because on some systems that's backspace, on others not. +# Listing bindings +bind | string match -v '*backward-delete-char' +bind --user --preset | string match -v '*backward-delete-char' +# CHECK: bind --preset '' self-insert +# CHECK: bind --preset \n execute +# CHECK: bind --preset \r execute +# CHECK: bind --preset \t complete +# CHECK: bind --preset \cc commandline\ \'\' +# CHECK: bind --preset \cd exit +# CHECK: bind --preset \ce bind +# CHECK: bind --preset \e\[A up-line +# CHECK: bind --preset \e\[B down-line +# CHECK: bind --preset \e\[C forward-char +# CHECK: bind --preset \e\[D backward-char +# CHECK: bind -M bind_mode \cx true +# CHECK: bind --preset '' self-insert +# CHECK: bind --preset \n execute +# CHECK: bind --preset \r execute +# CHECK: bind --preset \t complete +# CHECK: bind --preset \cc commandline\ \'\' +# CHECK: bind --preset \cd exit +# CHECK: bind --preset \ce bind +# CHECK: bind --preset \e\[A up-line +# CHECK: bind --preset \e\[B down-line +# CHECK: bind --preset \e\[C forward-char +# CHECK: bind --preset \e\[D backward-char +# CHECK: bind -M bind_mode \cx true + +# Preset only +bind --preset | string match -v '*backward-delete-char' +# CHECK: bind --preset '' self-insert +# CHECK: bind --preset \n execute +# CHECK: bind --preset \r execute +# CHECK: bind --preset \t complete +# CHECK: bind --preset \cc commandline\ \'\' +# CHECK: bind --preset \cd exit +# CHECK: bind --preset \ce bind +# CHECK: bind --preset \e\[A up-line +# CHECK: bind --preset \e\[B down-line +# CHECK: bind --preset \e\[C forward-char +# CHECK: bind --preset \e\[D backward-char + +# User only +bind --user | string match -v '*backward-delete-char' +# CHECK: bind -M bind_mode \cx true + +# Adding bindings +bind \t 'echo banana' +bind | string match -v '*backward-delete-char' +# CHECK: bind --preset '' self-insert +# CHECK: bind --preset \n execute +# CHECK: bind --preset \r execute +# CHECK: bind --preset \t complete +# CHECK: bind --preset \cc commandline\ \'\' +# CHECK: bind --preset \cd exit +# CHECK: bind --preset \ce bind +# CHECK: bind --preset \e\[A up-line +# CHECK: bind --preset \e\[B down-line +# CHECK: bind --preset \e\[C forward-char +# CHECK: bind --preset \e\[D backward-char +# CHECK: bind -M bind_mode \cx true +# CHECK: bind \t 'echo banana' + +# Erasing bindings +bind --erase \t +bind \t +bind \t 'echo wurst' +bind --erase --user --preset \t +bind \t +# CHECK: bind --preset \t complete + +exit 0