From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24939: [PATCH] Add tests for lisp/kmacro.el Date: Mon, 14 Nov 2016 20:47:23 +0200 Message-ID: <83vavphpac.fsf@gnu.org> References: <834m3ahxic.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1479149352 2896 195.159.176.226 (14 Nov 2016 18:49:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 14 Nov 2016 18:49:12 +0000 (UTC) Cc: 24939@debbugs.gnu.org To: Gemini Lasswell Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 14 19:49:06 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1c6MIZ-0001fN-Ni for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Nov 2016 19:48:07 +0100 Original-Received: from localhost ([::1]:42034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6MIc-0008H3-Qn for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Nov 2016 13:48:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6MIX-0008Gx-2j for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2016 13:48:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6MIU-00054B-09 for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2016 13:48:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c6MIT-000545-T0 for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2016 13:48:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c6MIT-0000yS-Kq for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2016 13:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Nov 2016 18:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 24939-submit@debbugs.gnu.org id=B24939.14791492413685 (code B ref 24939); Mon, 14 Nov 2016 18:48:01 +0000 Original-Received: (at 24939) by debbugs.gnu.org; 14 Nov 2016 18:47:21 +0000 Original-Received: from localhost ([127.0.0.1]:57360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6MHp-0000xM-LA for submit@debbugs.gnu.org; Mon, 14 Nov 2016 13:47:21 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6MHo-0000xB-Pk for 24939@debbugs.gnu.org; Mon, 14 Nov 2016 13:47:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6MHg-0004uD-K4 for 24939@debbugs.gnu.org; Mon, 14 Nov 2016 13:47:15 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6MHg-0004u7-G8; Mon, 14 Nov 2016 13:47:12 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2303 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c6MHf-000437-S5; Mon, 14 Nov 2016 13:47:12 -0500 In-reply-to: (message from Gemini Lasswell on Mon, 14 Nov 2016 10:26:42 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125698 Archived-At: > From: Gemini Lasswell > Cc: > Date: Mon, 14 Nov 2016 10:26:42 -0800 > > >> +(defmacro kmacro-tests-should-match-message (value &rest body) > >> + "Verify that a message matching VALUE is issued while executing BODY. > >> +Execute BODY, then check for a regexp match between > >> +VALUE and any text written to *Messages* during the execution." > >> + (declare (debug (stringp body)) > >> + (indent 1)) > >> + `(with-current-buffer (get-buffer-create "*Messages*") > >> + (save-restriction > >> + (narrow-to-region (point-max) (point-max)) > >> + ,@body > >> + (should (string-match-p ,value (buffer-string)))))) > > > > I don't like this implementation. > > This strategy is used in autorevert-tests.el and filenotify-tests.el, > which is where I copied it from. So those should be changed too. Most probably. But let's first see what better implementation we could come up with. > > get your hands on the messages more reliably. It is possible we > > should have a more thorough infrastructure for collecting echo-area > > messages, which probably means parts of it should be implemented in C, > > but that's a separate project. > > That would definitely be helpful. If you can provide a reasonable spec for such a feature, I'm sure Someoneā„¢ will make it happen. > >> + (kmacro-tests-should-match-message "No keyboard macro defined" > >> + (apply #'funcall cmd)))) > > ^^^^^^^^^^^^^^^^^^^^^ > > Why not ert-simulate-command? > > I'll make that change. What do you think about changing > ert-simulate-command to set current-prefix-arg? That would be very > helpful. Sounds like a useful extension to me. > >> + ;; I'm attempting to make the test work even if keys have been > >> + ;; rebound, but if this is failing try emacs -Q first. > > > > If this comment is still valid, then many other parts of the test have > > the same problem, because they clearly assume the default key > > bindings. > > That comment is out of date, since kmacro-tests-keymap should fix the > problem. I'll remove it. OK, then there are a couple more such comments in the patch. Thanks.