From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#24402: should-error doesn't catch all errors (Was:bug#24402: More Information) Date: Mon, 03 Jul 2017 21:28:55 -0600 Message-ID: <87zickhoco.fsf_-_@lylat> References: <3654D8E9-D3CB-402B-922F-B132C1871E9F@runbox.com> <596E65D2-E780-43A1-A75B-603B61B6F9F4@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1499139022 22306 195.159.176.226 (4 Jul 2017 03:30:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 4 Jul 2017 03:30:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 24402@debbugs.gnu.org To: Gemini Lasswell Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 04 05:30:17 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSEXS-00056e-Sr for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Jul 2017 05:30:11 +0200 Original-Received: from localhost ([::1]:38458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSEXW-0003Iv-JT for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Jul 2017 23:30:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSEXP-0003HM-Uu for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2017 23:30:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSEXK-0002EB-Sn for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2017 23:30:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48363) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSEXK-0002E1-Om for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2017 23:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dSEXK-0001nL-BV for bug-gnu-emacs@gnu.org; Mon, 03 Jul 2017 23:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jul 2017 03:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24402 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24402-submit@debbugs.gnu.org id=B24402.14991389496804 (code B ref 24402); Tue, 04 Jul 2017 03:30:02 +0000 Original-Received: (at 24402) by debbugs.gnu.org; 4 Jul 2017 03:29:09 +0000 Original-Received: from localhost ([127.0.0.1]:51040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSEWT-0001lb-AE for submit@debbugs.gnu.org; Mon, 03 Jul 2017 23:29:09 -0400 Original-Received: from mail-it0-f54.google.com ([209.85.214.54]:34581) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSEWR-0001lB-3D; Mon, 03 Jul 2017 23:29:07 -0400 Original-Received: by mail-it0-f54.google.com with SMTP id v202so18085420itb.1; Mon, 03 Jul 2017 20:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Y4Gtvv2y5eZXN9JOC6kLSiGZPLbcFpOo4VoIsSySo6Q=; b=motDJKiAqCPSlkBMB9Efw2sUMf5sGsnsk0+vRicflKK/oHlLHNBcBldEi0+lRZwBjz OmrgkRHUK5V8sLu34yKSGtO2sk2PtCBz9aZf2lzvneZ50RAreupibhYSgD8HJs4P3ZLA xQH/zSsm0V667vg0pT4vBWje3YkenuMQyQIFlrSxXcK+7idXDwZQ5+ZQl0nIh8E/FT5M 9ZjKZ2ap6YM0lElEb2FNznuSX7iWbDlcTogeNNArXRNOwXXmvNnJsIzU6af07YOVCr8H uNt0yTq9VSRCLM0PWwq4yaLFjlh8UAwIq8FFvtGEK/ftE84B2qO0yx3Ex1aJU/SR8gmD iT1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Y4Gtvv2y5eZXN9JOC6kLSiGZPLbcFpOo4VoIsSySo6Q=; b=cWvEOqeMVeMObxIi7Otxi5th53J0R3t5Kp6dP9WlLkOaDddGkvReb65g0BXGiR7X2T o1CvLrgzKYIfA7l9OEowECVP7hlZN1CNBcY48oOxPEWUBmpqr9p01rV/FcqXVhPy6dd8 NVaWRqc/R1TBDBomJCiIVaVefRpPREN5RsYMA9nWR92Ime//uI0Nub68nFWrAUZB+1QO 7iM7A8+0FMQ0nL6mwIZgQ4Xr0LWlY3GkoIt9kUMHolQU1zkJ0+Laq8MrmhjQPnD2tqdS wbix9dSJHSC6Zvc4vqw8K5S8KP5CJRnwkmp5v7IFV5z4CA0u3GUvHHvKHXgHZDMpWXD1 tUNw== X-Gm-Message-State: AIVw111IwPGKfuxqoKC06Yh+odmgHV8NaBKUiELpB1Ksc2K922VqbX9H 59tHlOWDp9dC9efL X-Received: by 10.36.141.134 with SMTP id w128mr11087776itd.84.1499138940928; Mon, 03 Jul 2017 20:29:00 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id s135sm11068828ita.2.2017.07.03.20.28.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2017 20:28:59 -0700 (PDT) In-Reply-To: <596E65D2-E780-43A1-A75B-603B61B6F9F4@runbox.com> (Gemini Lasswell's message of "Mon, 19 Sep 2016 21:27:54 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134156 Archived-At: tags + 24402 confirmed quit Gemini Lasswell writes: > I=E2=80=99ve done some investigating of why this is happening. testcover-= start > transforms: > (should-error (my-error)) > into: > (should-error (testcover-after 2 (my-error))) > > Then the macro expansion of should-error separates the form which it > is passed into a function symbol and list of arguments, and applies > the function to the arguments inside of a condition-case that traps > errors. The problem is that the arguments are evaluated first, outside > of the condition-case, so errors in their evaluation do not get > caught. This problem is not specific to testcover. In this example, > the first test passes and the second fails: > > (defun div-by (n) > (/ 100 n)) > > (defmacro log-div-by (n) > `(message "div-by: %d" (div-by ,n))) > > (ert-deftest test-div-by () > (should-error (div-by 0))) > > (ert-deftest test-log-div-by () > (should-error (log-div-by 0))) >=20=20=20 I just ran into this as well. Consider these two forms: (should-error (cl-fourth "1234") :type 'wrong-type-argument) (should-error (car (cdr (cdr (cdr "1234")))) :type 'wrong-type-argument) Only the second raises an error, even though cl-fourth is equivalent to the car/cdr chain.