From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#47320: Improve failure reporting in test/lisp/electrict-tests.el Date: Thu, 25 Mar 2021 13:43:27 +0000 Message-ID: References: <87v99i5k0f.fsf@gmx.de> <877dlx3nb8.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3805"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Albinus , 47320-done@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 25 14:44:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lPQHT-0000r8-0a for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Mar 2021 14:44:11 +0100 Original-Received: from localhost ([::1]:48144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPQHR-0000sd-FU for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Mar 2021 09:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPQHK-0000sR-FB for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 09:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54225) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPQHK-0000lL-89 for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 09:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lPQHK-0007lF-6Y for bug-gnu-emacs@gnu.org; Thu, 25 Mar 2021 09:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Mar 2021 13:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47320 X-GNU-PR-Package: emacs Original-Received: via spool by 47320-done@debbugs.gnu.org id=D47320.161667981729773 (code D ref 47320); Thu, 25 Mar 2021 13:44:02 +0000 Original-Received: (at 47320-done) by debbugs.gnu.org; 25 Mar 2021 13:43:37 +0000 Original-Received: from localhost ([127.0.0.1]:37535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lPQGv-0007k9-3G for submit@debbugs.gnu.org; Thu, 25 Mar 2021 09:43:37 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:21402 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lPQGt-0007jk-0n for 47320-done@debbugs.gnu.org; Thu, 25 Mar 2021 09:43:35 -0400 Original-Received: (qmail 50659 invoked by uid 3782); 25 Mar 2021 13:43:28 -0000 Original-Received: from acm.muc.de (p4fe1524f.dip0.t-ipconnect.de [79.225.82.79]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 25 Mar 2021 14:43:27 +0100 Original-Received: (qmail 6423 invoked by uid 1000); 25 Mar 2021 13:43:27 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202999 Archived-At: Hello, Jaão. On Wed, Mar 24, 2021 at 20:10:48 +0000, João Távora wrote: > > I just committed the patch as it was. Sorry. > I don't much see the point in asking for comments from people > and then proceeding to ignore the simplest request for adjustments > outright. The requests were only simple on the surface. Even though the original change took me around about an hour (it was at ~03-00 a.m. one sleepless night in 2019), I've spent a large part of two days trying to use the ert facilities without reading its source (they are essentially undocumented). I misunderstood your suggestion as suggesting outputting the doc-string using ert-fail. In the end I couldn't get that to work, as I said. > You did write "if there are no objections...". Well I had a small > objection. I get it that following Michael's idea, which is probably > better, takes a little bit more work, but a simple adjustment > to avoid code repetition could certainly be accommodated. > FWIW I've quickly tried with this version and it seems to work > fine: > (defun electric-pair-test-for (fixture where char expected-string > expected-point mode bindings > fixture-fn &optional doc-string) > (with-temp-buffer > (funcall mode) > (insert fixture) > (save-electric-modes > (let ((last-command-event char) > (transient-mark-mode 'lambda)) > (goto-char where) > (funcall fixture-fn) > (cl-progv > (mapcar #'car bindings) > (mapcar #'cdr bindings) > (call-interactively (key-binding `[,last-command-event]))))) > (unless (equal (buffer-substring-no-properties (point-min) (point-max)) > expected-string) > (when doc-string (message "\n%s\n" doc-string)) > (ert-fail (format > "buffer contents don't match! (observed %s, expected %s)" > (buffer-string) expected-string))) > (unless (equal (point) expected-point) > (when doc-string (message "\n%s\n" doc-string)) > (ert-fail > (format "point isn't where it was supposed to be! (observed %s, > expected %s)" > (point) expected-point))))) OK, I see what you meant now. This version, instead of duplicating the test comparisons, duplicates the call to message. I think it boils down to ert (particularly its documentation) not being sufficiently advanced to do what we'd both like. But if you'd prefer your version, I'd be happy enough to commit it. I mainly just want finally to get the amendment off my hands and into master. [ .... ] > -- > João Távora -- Alan Mackenzie (Nuremberg, Germany).