From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jim Meyering Newsgroups: gmane.emacs.devel Subject: 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 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1477458628 1593 195.159.176.226 (26 Oct 2016 05:10:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Oct 2016 05:10:28 +0000 (UTC) To: emacs-devel , 24672@debbugs.gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 26 07:10:24 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bzGTY-0006Pp-7Y for ged-emacs-devel@m.gmane.org; Wed, 26 Oct 2016 07:10:08 +0200 Original-Received: from localhost ([::1]:59706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzGTa-0005Pj-MM for ged-emacs-devel@m.gmane.org; Wed, 26 Oct 2016 01:10:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzGTV-0005PZ-3T for emacs-devel@gnu.org; Wed, 26 Oct 2016 01:10:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzGTU-0001l7-2D for emacs-devel@gnu.org; Wed, 26 Oct 2016 01:10:05 -0400 Original-Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]:39928) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bzGTT-0001jh-RN for emacs-devel@gnu.org; Wed, 26 Oct 2016 01:10:03 -0400 Original-Received: by mail-it0-x241.google.com with SMTP id q75so301433itc.6 for ; Tue, 25 Oct 2016 22:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to; bh=eBx8JsoaJVlyG0rxSAfigMaGNAvtuLT/6018hbM0+DE=; b=mYGjfGdzGKKlvPTkYizZffCk718jpdxFyPs/Mr/qXz8gvElQL0j8uQ8NEsHqEWYfdN ze86bH5gK/YdHDHFZYmUbtTG2/a7UTN3aaqsK6y+YvcXkA/LbFaG4GjzvIpVk/eTJ1Ke 5qYgbotlbThAGkGKSvwPqWqrqx4uBKIIWVFvSZRTLSLQlNpljakrCVmvr71TySiDxo4f qKAKgR/TtlT+kbYvLi46VvgQE91+FgKf7NuUYTqEGQG59bGxmmVrIWnKDvvCulETmSpU elFnTrC+31RZf+boi8RqPUrbLHH430wZhKYlWS92wWkmi+niWe57iEJV4P1GgyjsGLof MUbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=eBx8JsoaJVlyG0rxSAfigMaGNAvtuLT/6018hbM0+DE=; b=GHRvyp8SxwyDFuovR3fOuxl9ZnZ3+34B/r7U8VjxeD98UqpJ3POQSR1WxDDQTYusHR /t27kO3mS/Gq3ZZHu4P2jLHoBZWOzK592xUn25Pu+Nv6gq31Oa92lSSpFKdH1GlqSq93 RgrUyfX+bVJewOu/UmFJLnWaRQua72FmKfriiqn3roz/MMj3ulJ3/EuSMP/zG0g658uu V/ipJ1fiisPK+sa0mT3M8J5NwDzSn/UfGCXAETj0A6O9aOOVMUhHv4gyjAXSBL56HS8N ZYngEJAOs/DLuTrEUG2HJO7AwAPx3xsHKuIB9d/1F2FPX26ZiaNVAfgBWkK2NP4/7onR pxYA== X-Gm-Message-State: ABUngvdfMfLxSTZDsbaXRfARvdsR4U5Dsj5yZIPIx2o20Hk+D5rWiOpW3V3+C6g0PwNINP7COOaMtAoHTzsWmA== X-Received: by 10.107.132.88 with SMTP id g85mr659124iod.29.1477458600811; Tue, 25 Oct 2016 22:10:00 -0700 (PDT) Original-Received: by 10.107.174.21 with HTTP; Tue, 25 Oct 2016 22:09:40 -0700 (PDT) X-Google-Sender-Auth: xPK-SpbdaWBUDLhqwyyZXIScQSI X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208822 Archived-At: 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 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?