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

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

bug#20066: 24.4; should-error and cl-assert


From: Stefan Monnier
Subject: bug#20066: 24.4; should-error and cl-assert
Date: Tue, 07 Apr 2015 22:05:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> 1. (should-error (error "yes"))
>> 2. (should-error (cl-assert nil t))
>> Test 1 succeeds but test 2 fails.

I think test 2 is incorrect.  It assumes that when cl-assert fails it
reacts by throwing a "normal" signal that can be caught like any other.
This is untrue for example when we decide to compile-away the assertions
(depending on speed ans safety settings).

cl-assert should be used to check impossible situations and an assertion
failure is just supposed to bring it to the user's attention to help
debug the code.  It is not meant to be caught&handled like a normal
signal.


        Stefan





reply via email to

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