help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: ERT: should-error doesn't catch failed assertions


From: Noam Postavsky
Subject: Re: ERT: should-error doesn't catch failed assertions
Date: Mon, 18 Jul 2016 04:19:00 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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.





reply via email to

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