From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: PATCH: X03zlebindkey.ztst
Date: Wed, 16 Dec 2015 11:57:10 +0000 [thread overview]
Message-ID: <20151216115710.676174e8@pwslap01u.europe.root.pri> (raw)
This covers the most basic basics of what bindkey does. It leaves
testing the vast array of functions behind the bindings to elsewhere.
pws
diff --git a/Test/X03zlebindkey.ztst b/Test/X03zlebindkey.ztst
index e6fead5..38afc2d 100644
--- a/Test/X03zlebindkey.ztst
+++ b/Test/X03zlebindkey.ztst
@@ -1,4 +1,6 @@
-# Tests of the vi mode of ZLE
+# Tests of the bindkey command.
+# This concentrates on the command itself and also resolving keystrokes
+# into bindings. The latter is particularly tricky with multibyte sequences.
%prep
ZSH_TEST_LANG=
@@ -28,8 +30,81 @@
>BUFFER: foo
>CURSOR: 3
+ zpty_run 'bindkey -s "\C-xy" foo'
+ zpty_run 'bindkey -s "\C-x\C-y" bar'
+ zletest $'\C-xy\C-x\C-y'
+ zpty_run 'bindkey -r "\C-xy"'
+ zpty_run 'bindkey -r "\C-x\C-y"'
+0:bindkey with multiple definitions associated with prefix
+>BUFFER: foobar
+>CURSOR: 6
+
+ bindkey -s '\C-xy' bar
+ bindkey '\C-xy'
+ bindkey -r '\C-xy'
+ bindkey '\C-xy'
+0:bindkey output
+>"^Xy" "bar"
+>"^Xy" undefined-key
+
+# As we're only looking at definitions here, we don't
+# bother using the pseudo-terminal; just test in the normal fashion.
+ bindkey -s '\C-xy' foo
+ bindkey -N testmap emacs
+ bindkey -M testmap '\C-xy'
+ bindkey -s -M testmap '\C-xy' bar
+ bindkey -M testmap '\C-xy'
+ bindkey '\C-xy'
+ bindkey -A testmap main
+ bindkey '\C-xy'
+ bindkey -A emacs main
+ bindkey '\C-xy'
+0:creating keymaps from existing keymaps
+>"^Xy" "foo"
+>"^Xy" "bar"
+>"^Xy" "foo"
+>"^Xy" "bar"
+>"^Xy" "foo"
+
+# Depends on the keymap created in the previous test.
+ bindkey -l
+ bindkey -D testmap
+ print Deleted...
+ bindkey -l
+0:deleting keymaps
+>.safe
+>command
+>emacs
+>isearch
+>main
+>testmap
+>vicmd
+>viins
+>viopp
+>visual
+>Deleted...
+>.safe
+>command
+>emacs
+>isearch
+>main
+>vicmd
+>viins
+>viopp
+>visual
+
+# This \M... style display of 8-bit characters is a bit
+# dated in multibyte mode, but no one's complained...
+ if [[ -z $ZSH_TEST_LANG ]]; then
+ ZTST_skip="multibyte not available for bindkey test"
+ else
+ bindkey | grep '\\M.*self-insert'
+ fi
+0:in multibyte mode all bytes with bit 7 set start self-insert
+>"\M-^@"-"\M-^?" self-insert
+
if [[ -z $ZSH_TEST_LANG ]]; then
- ZTST_skip="bindkey multibyte test skipped"
+ ZTST_skip="multibyte not available for bindkey test"
else
zpty_run 'alias unbind="bindkey -r ホ"'
zpty_run 'bindkey -s ホ bar'
reply other threads:[~2015-12-16 12:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151216115710.676174e8@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).