unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Leo Liu <sdl.web@gmail.com>
Cc: 20066@debbugs.gnu.org
Subject: bug#20066: 24.4; should-error and cl-assert
Date: Tue, 07 Apr 2015 22:05:11 -0400	[thread overview]
Message-ID: <jwvlhi3v0mi.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <m2vbh85qmq.fsf@gmail.com> (Leo Liu's message of "Tue, 07 Apr 2015 15:44:45 +0800")

>> 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





  parent reply	other threads:[~2015-04-08  2:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-09  8:06 bug#20066: 24.4; should-error and cl-assert Leo Liu
2015-03-09 16:12 ` Wolfgang Jenkner
2015-04-07  7:44 ` Leo Liu
2015-04-07 12:47   ` Nicolas Richard
2015-04-07 13:10     ` Nicolas Richard
2015-04-08  2:05   ` Stefan Monnier [this message]
2015-04-08  4:15     ` Leo Liu

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=jwvlhi3v0mi.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=20066@debbugs.gnu.org \
    --cc=sdl.web@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).