GNU bug report logs -
#11218
with-demoted-errors use of condition-case-unless-debug; ert
Previous Next
Reported by: Glenn Morris <rgm <at> gnu.org>
Date: Wed, 11 Apr 2012 03:39:01 UTC
Severity: normal
Tags: fixed
Found in version 24.0.95
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 4/20/12 5:13 AM, Stefan Monnier wrote:
>>> So the next question is: why does ERT record a backtrace and that extra
>>> information provided by ert-info?
>> To be able to show them to the user, together with the test failure. If you
>> have one or more failing tests, it's much more useful to see the error
>> messages and backtraces rather than just the error messages.
>
> I don't see the point of showing that info when running the tests.
> If the user wants that info, he should be able to easily say "run this
> test with debug-on-error" so he doesn't only get a backtrace but also
> gets put in the debugger where he can inspect the state.
ERT's keyboard shortcut for that is "d". But it's not a good solution if:
* the test is nondeterministic (maybe due to subprocess interaction),
* the test takes a long time to run,
* you have multiple failing tests and want to quickly compare if they
are crashing in the same place,
* ERT is running in batch mode (e.g. make check).
It's better to collect as much data as reasonably possible when the
error first occurs.
>> (ert-deftest foo ()
>> (with-demoted-errors (error "a"))
>> (error "b"))
>
>> would normally fail with "b", but if we enable debugging to track down why,
>> it will fail with "a" instead (with no way to continue execution to get to
>> the error we are interested in).
>
> No: you'll be put in the debugger for the error "a" but if you hit `c'
> it will continue and re-enter the debugger for error "b".
My Emacs is a few months old, but that doesn't work for me. Has it
changed recently?
I'm using
(defun foo ()
(with-demoted-errors (error "a"))
(error "b"))
and typing
C-u <escape> C-x <escape> : ( f o o ) <return> c c
and all I find in *Messages* is
error: "a"
Continue...
edebug-signal: a
No mention of "b".
If `debug-on-error' is t, `with-demoted-errors' becomes essentially
equivalent to `progn', and (error "b") can ever be reached in
(defun foo ()
(progn (error "a"))
(error "b"))
since `error' never returns (and I think that's an important guarantee
that the debugger shouldn't violate, at least not without confirmation).
Christian.
This bug report was last modified 167 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.