From: Jim Meyering <jim@meyering.net>
To: emacs-devel <emacs-devel@gnu.org>, 24672@debbugs.gnu.org
Subject: bug#24672: writing a test for Bug#24672 (viper mode malfunction while inserting a paren in continued cpp directive)
Date: Tue, 25 Oct 2016 22:09:40 -0700 [thread overview]
Message-ID: <CA+8g5KGMrDHWQywkP-OsZoEVEVreWHTOwajFjVeB4ugeu-6pog__18391.1434528001$1477458686$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <lubpf3fuo2tdyu.fsf@meyering.net>
This is a corner case.
When I start in viper mode with this file contents:
#define z_b\
and then change the "z" to a parenthesis (either one), I get this:
#define (z_b^I^I^I^I^I\$
[I have represented each TAB as "^I", of course]
Rather surprising to see all of those TAB characters inserted. To
reproduce, run this:
mkdir ~/empty && printf '#define z_b\\\n' > k.c \
&& HOME=$HOME/empty /bin/emacs -Q -f viper-mode k.c
hit "n", "n", and "5" at the successive prompts, then e.g., "fzs(" to
perform the change and to see the surprising result.
I tried to write a test case to encapsulate the above, but so far have
failed, because when run via the test, viper-mode does what one would
expect.
commit 3309c37d8c42b2fd002b0d965dafc4be3b6d3e44
Author: Jim Meyering <meyering@fb.com>
Date: Wed Oct 12 08:57:48 2016 -0700
viper-tests.el: add a test for bug #24672
diff --git a/test/lisp/emulation/viper-tests.el
b/test/lisp/emulation/viper-tests.el
index 2c63b24..85d83aa 100644
--- a/test/lisp/emulation/viper-tests.el
+++ b/test/lisp/emulation/viper-tests.el
@@ -99,6 +99,19 @@ viper-test-undo-kmacro
]
))))
+(ert-deftest viper-test-insert-paren-on-cpp-continued-line()
+ "Test for bug #24672:
+Insert '#define z_b\', then change the 'z' to a parenthesis (open or closed)"
+ (should
+ (equal
+ "#define (_b\\\n"
+ (viper-test-undo-kmacro
+ [
+ ?i ?# ?d ?e ?f ?i ?n ?e ? ?z ?_ ?b ?\\ escape
+ ?F ?z ?s ?\( escape
+ ])
+ )))
+
(ert-deftest viper-test-undo-2 ()
"Test for VI like undo behavior.
Is there some test set-up I can perform to make that test work like
what I outlined above?
next prev parent reply other threads:[~2016-10-26 5:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-12 3:59 bug#24672: 26.0.50; viper-mode + c-mode: "ce" fails in cpp-continued stmt Jim Meyering
2016-10-26 5:09 ` Jim Meyering [this message]
2016-10-26 5:09 ` writing a test for Bug#24672 (viper mode malfunction while inserting a paren in continued cpp directive) Jim Meyering
2016-10-26 11:51 ` bug#24672: " Eli Zaretskii
2016-10-26 14:33 ` Jim Meyering
2016-10-26 15:02 ` Eli Zaretskii
2016-10-26 11:52 ` Eli Zaretskii
2016-10-26 15:03 ` Eli Zaretskii
2016-10-26 15:37 ` Jim Meyering
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='CA+8g5KGMrDHWQywkP-OsZoEVEVreWHTOwajFjVeB4ugeu-6pog__18391.1434528001$1477458686$gmane$org@mail.gmail.com' \
--to=jim@meyering.net \
--cc=24672@debbugs.gnu.org \
--cc=emacs-devel@gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.