unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: help-gnu-emacs@gnu.org
Subject: Re: ERT: should-error doesn't catch failed assertions
Date: Mon, 18 Jul 2016 04:19:00 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160718T061248-184@post.gmane.org> (raw)
In-Reply-To: 87d1mb9a3u.fsf@gmail.com

Sean McAfee <eefacm <at> gmail.com> writes:

> 
> I've just begin trying to use ERT to write unit tests for my code.  I
> got hung up almost immediately when trying to confirm that a particular
> function call fails an assertion.  A simple example:
> 
> (should-error (cl-assert nil))

Seems to work with

  (should-error (let ((debug-on-error nil)) (cl-assert nil)))

When debug-on-error is non-nil, cl-assert doesn't actually throw an error,
it just calls the debugger directly (see cl--assertion-failed).  ert binds
debug-on-error to t, somewhere along the line.





      parent reply	other threads:[~2016-07-18  4:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-17 22:24 ERT: should-error doesn't catch failed assertions Sean McAfee
2016-07-17 22:57 ` Emanuel Berg
2016-07-17 23:29   ` Sean McAfee
2016-07-18  0:42     ` Emanuel Berg
2016-07-18  4:19 ` Noam Postavsky [this message]

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=loom.20160718T061248-184@post.gmane.org \
    --to=npostavs@users.sourceforge.net \
    --cc=help-gnu-emacs@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.
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).