[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11218: with-demoted-errors use of condition-case-unless-debug; ert

From: Christian Ohler
Subject: bug#11218: with-demoted-errors use of condition-case-unless-debug; ert
Date: Fri, 20 Apr 2012 14:02:39 -0700

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]