unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: npostavs@users.sourceforge.net
Cc: Gemini Lasswell <gazally@runbox.com>,
	24402@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>
Subject: bug#24402: should-error doesn't catch all errors
Date: Wed, 12 Jul 2017 10:45:14 -0600	[thread overview]
Message-ID: <874luhbo4l.fsf@lylat> (raw)
In-Reply-To: <87tw2het1b.fsf@users.sourceforge.net> (npostavs's message of "Wed, 12 Jul 2017 08:30:56 -0400")

npostavs@users.sourceforge.net writes:

> Alex <agrambot@gmail.com> writes:
>
>> npostavs@users.sourceforge.net writes:
>>
>>> Yes, ert binds `debugger' in order to get full backtrace information
>>> when there is an error.  This means it won't see errors caught by
>>> condition-case.  That's good when it ignores errors caught by test code
>>> using condition-case, but does give rise to problems.  There is some
>>> relevant discussion in Bugs #11218 and #24617.
>>>
>>> Espcially the suggestion in #24617 of using `signal-hook-function' to
>>> record error info instead of using `debugger', I think doing this could
>>> simplify things a lot.  It is definitely going to require messing around
>>> with ert's internals though...
>>
>> Thanks for the info. I may have discovered a workaround, but I'm not
>> sure if there's any negative side-effects. All the tests pass, though.
>>
>> What do you think of it? It's obviously not ideal, but I think it at
>> least fixes the issues at hand.
>
> Does it also work when loading the elc version of the test file?  (try
> 'make check TEST_LOAD_EL=no')

Oh, it doesn't load the elc version by default? That's surprising; I
think that should be documented in the test README.

I get 3 test failures with TEST_LOAD_EL=no, but I don't believe they're
because of me. On a mostly clean master (d014a5e15) those 3 also error.
One of them is simple to fix (the (require 'subr-x) should not be inside
eval-when-compile in dom-tests). The other failing tests are
subr-test-backtrace-integration-test and cl-lib-defstruct-record.

> What about tests like this?
>
>     (ert-deftest check-error-handling ()
>       (should
>        (eq 42
>            (condition-case ()
>                (/ 1 0)
>              (arith-error 42)))))

It works for me, yes. As long as `debugger' is set to a symbol. I can
make it a bit more robust by using an additional defvar in
ert--run-test-internal.

Are you asking because it doesn't work for you?





  reply	other threads:[~2017-07-12 16:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-10  1:26 bug#24402: 25.1.50; testcover-start breaks should-error Gemini Lasswell
     [not found] ` <handler.24402.B.14734739098199.ack@debbugs.gnu.org>
2016-09-20  4:27   ` bug#24402: More Information Gemini Lasswell
2017-07-04  3:28     ` bug#24402: should-error doesn't catch all errors (Was:bug#24402: More Information) Alex
2017-07-05  0:00       ` bug#24402: should-error doesn't catch all errors Alex
2017-07-05 13:43         ` Tino Calancha
2017-07-05 19:56           ` Alex
2017-07-07 10:15             ` Tino Calancha
2017-07-09  7:04               ` Alex
2017-07-11 12:18             ` npostavs
2017-07-12  3:47               ` Alex
2017-07-12 12:30                 ` npostavs
2017-07-12 16:45                   ` Alex [this message]
2017-07-13  1:31                     ` npostavs
2017-07-13  3:04                       ` Alex
2017-07-13  3:44                         ` npostavs
2017-07-13 22:45                           ` Alex
2017-07-13 23:49                             ` npostavs
2017-07-14  4:42                               ` Alex
2017-07-14  4:45                                 ` Alex
2017-07-15 21:57                                 ` npostavs
2017-07-16  3:49                                   ` Alex
2017-07-17  0:46                                     ` npostavs
2017-07-19 21:23                                     ` Gemini Lasswell
2017-07-19 22:40                                       ` Alex
2017-07-19 23:04                                       ` npostavs
2017-07-20  4:04                                         ` Alex
2017-07-20 19:23                                         ` Gemini Lasswell
2017-08-08  1:15                                           ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874luhbo4l.fsf@lylat \
    --to=agrambot@gmail.com \
    --cc=24402@debbugs.gnu.org \
    --cc=gazally@runbox.com \
    --cc=npostavs@users.sourceforge.net \
    --cc=tino.calancha@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).