all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 67862@debbugs.gnu.org, Christian Ohler <ohler@gnu.org>
Subject: bug#67862: 30.0.50; Handler-bind and ert-test-error-debug
Date: Tue, 26 Dec 2023 19:00:34 +0100	[thread overview]
Message-ID: <m2il4kyhbx.fsf@Pro.fritz.box> (raw)
In-Reply-To: <jwvo7edhr97.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 26 Dec 2023 11:25:22 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> AFAICT
>
>             (let ((ert-debug-on-error t))
>               (ert-run-test test))
>
> is supposed to say "run the test and please pop up a debugger if there's
> an error".  The ERT code even goes to the trouble to store&use the value of
> `ert-debug-on-error` upon entry to the tests rather the value that
> happens to be current when the error is signaled.

That's also what I've seen in ert.el, and how I think things are
supposed to work.

> So to me the code looks like it wants to test that `ert-debug-on-error`
> indeed brings up a debugger, tho none of the surrounding code tries to
> detect whether the debugger is/was entered, and instead that surrounding
> code uses `condition-case` which prevents entering the debugger.
>
> Is it really the purpose of this test to make sure that "even if we ask
> for the debugger, `condition-case` prevents the use of a debugger"?

from the fact that the test

  (ert-deftest ert-test-error-debug ()
    (let ((test (make-ert-test :body (lambda () (error "Error message")))))
      (condition-case condition
          (progn
            (let ((ert-debug-on-error t))
              (ert-run-test test))
            (cl-assert nil))
        ((error)
         (cl-assert (equal condition '(error "Error message")) t)))))

explicitly tests that the handler for `error' sees the "Error message"
(last 2 lines of the test), I'd also conjecture that tests intends to
check that the debugger does not run in a condition-case.

Also, a bit strange is that this:

  (ert-deftest ert-test-fail-debug-with-condition-case ()
    (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
      (condition-case condition
          (progn
            (let ((ert-debug-on-error t))
              (ert-run-test test))
            (cl-assert nil))
        ((error)
         (cl-assert (equal condition '(ert-test-failed "failure message")) t)))))

is almost the saem test? (Uses ert-fail instead of error).

BTW, there are some more tests in the vicinity of the test above that
test if the debugger is/isn't invoked in various circumstances.








  reply	other threads:[~2023-12-26 18:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-17  0:37 bug#67862: 30.0.50; Handler-bind and ert-test-error-debug Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-17  6:53 ` Gerd Möllmann
2023-12-17 15:08   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-26 16:25   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-26 18:00     ` Gerd Möllmann [this message]
2023-12-31 19:43       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-01  5:56         ` Gerd Möllmann
2024-01-01 12:15           ` Eli Zaretskii
2024-01-01 16:43             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-01 22:27 ` J.P.
2024-02-02  2:46   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-02 23:28     ` J.P.
2024-02-02 23:44       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=m2il4kyhbx.fsf@Pro.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=67862@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=ohler@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.