all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "João Távora" <joaotavora@gmail.com>
Cc: Michael Albinus <michael.albinus@gmx.de>, 47320-done@debbugs.gnu.org
Subject: bug#47320: Improve failure reporting in test/lisp/electrict-tests.el
Date: Thu, 25 Mar 2021 13:43:27 +0000	[thread overview]
Message-ID: <YFyTf4BxJ2UtOJin@ACM> (raw)
In-Reply-To: <CALDnm53ENAKZPg9UZAtyj+EE7ok310trWqsjUZ9xP8-b21Tyug@mail.gmail.com>

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).





  reply	other threads:[~2021-03-25 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 14:24 bug#47320: Improve failure reporting in test/lisp/electrict-tests.el Alan Mackenzie
2021-03-23  8:53 ` Michael Albinus
2021-03-23 14:47   ` Alan Mackenzie
2021-03-23 15:24     ` Michael Albinus
2021-03-23 15:59       ` João Távora
2021-03-24 13:46         ` Alan Mackenzie
2021-03-24 14:02           ` João Távora
2021-03-24 19:42             ` Alan Mackenzie
2021-03-24 20:10               ` João Távora
2021-03-25 13:43                 ` Alan Mackenzie [this message]
2021-03-25 23:47                   ` João Távora

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=YFyTf4BxJ2UtOJin@ACM \
    --to=acm@muc.de \
    --cc=47320-done@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=michael.albinus@gmx.de \
    /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.