GNU bug report logs -
#67862
30.0.50; Handler-bind and ert-test-error-debug
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Sun, 17 Dec 2023 00:38:02 UTC
Severity: normal
Found in version 30.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Stefan Monnier <monnier <at> 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.
This bug report was last modified 1 year and 111 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.