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 Date: Sun, 09 Jul 2017 01:04:24 -0600 Message-ID: <87bmounlaf.fsf@lylat> References: <3654D8E9-D3CB-402B-922F-B132C1871E9F@runbox.com> <596E65D2-E780-43A1-A75B-603B61B6F9F4@runbox.com> <87zickhoco.fsf_-_@lylat> <877eznda7v.fsf@lylat> <874lur0zki.fsf@calancha-pc> <87o9sywtbz.fsf@lylat> <87d19clfim.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1499583925 29849 195.159.176.226 (9 Jul 2017 07:05:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Jul 2017 07:05:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Gemini Lasswell , 24402@debbugs.gnu.org, npostavs@users.sourceforge.net To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 09 09:05: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 1dU6HH-0006vy-AX for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Jul 2017 09:05:11 +0200 Original-Received: from localhost ([::1]:35159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dU6HJ-0007JX-Eg for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Jul 2017 03:05:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dU6HD-0007Hd-Qu for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2017 03:05:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dU6H8-0000v9-RS for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2017 03:05:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dU6H8-0000uy-M4 for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2017 03:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dU6H8-0004oz-9C for bug-gnu-emacs@gnu.org; Sun, 09 Jul 2017 03:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Jul 2017 07:05: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: confirmed patch Original-Received: via spool by 24402-submit@debbugs.gnu.org id=B24402.149958387918500 (code B ref 24402); Sun, 09 Jul 2017 07:05:02 +0000 Original-Received: (at 24402) by debbugs.gnu.org; 9 Jul 2017 07:04:39 +0000 Original-Received: from localhost ([127.0.0.1]:58321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dU6Gl-0004oJ-Hg for submit@debbugs.gnu.org; Sun, 09 Jul 2017 03:04:39 -0400 Original-Received: from mail-io0-f196.google.com ([209.85.223.196]:36506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dU6Gj-0004o6-9N for 24402@debbugs.gnu.org; Sun, 09 Jul 2017 03:04:39 -0400 Original-Received: by mail-io0-f196.google.com with SMTP id h134so2419028iof.3 for <24402@debbugs.gnu.org>; Sun, 09 Jul 2017 00:04:37 -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; bh=m/phVQmNRp5hbtgo2w80fVa/pBk3XXG65KB9HqdYSdU=; b=ZvIugZAJzduufRwE8XIqFXvce94nJYWBDNBc38QfDlOF7+dSXldAF271DIumdO1Day BV8a1F8JfPVglp4qkYQfHEXgtiDutHMJbtj9//jNBBzBxfUiXAGGwc6AO+rFMD9qAaNs fcDnp4N/ZAQMGX38fVpACYbTaQVvtnXS6/UzteuAYmEp6waAePU1zDbyD8YuTCJHnD+W 1tcUwsyD4oxd+1AYI5QPw6n2shtDk3LB9Ypwy9nAJTQBPSStnsMRx5bch7GRlOeTcELB JhjKALSo36frUqMZupysR9JG+Q0r0jrTvUwKpemhzMb7g26bRBG0SNOvEcyENUkra78Z GVVA== 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; bh=m/phVQmNRp5hbtgo2w80fVa/pBk3XXG65KB9HqdYSdU=; b=Ykm7HIxjlxLRYg//MEa8+UZRzDGkcPz/8rWE07aH048dmi+CY2Yb08uhNqpV4jC3TZ FQvJFMz7SHpZ7qh9mGnYSlRT4jPPH7bD/HZcpvdftjbwtDE6ZaSwIzNe2mAinuH8Bw08 ZozxvzZAqDonEeJMJ20AocR0aV/dFU3362OeigbqV1fBHlJqGugJvop7UZsIItRZspLa gYh3DcWm0WQjmJE36ulC5/D0p02//j8H/KyO46iQ3O1GKbO/srakBqjb2dKnfelBbN+4 ohwFd34HxS0uxX/rZ36p8xFE2Oc+ypLdqv+gd10aCg7Cgflil44PAr5t+Esa7og4jm+L a0Qg== X-Gm-Message-State: AIVw110eIE4pUN++Itndkx9eVP2TN44WMo2ZMApSdDVEMaUM7pphQoMD AZqO0IO+OvjYjQ== X-Received: by 10.107.138.17 with SMTP id m17mr10068652iod.155.1499583871551; Sun, 09 Jul 2017 00:04:31 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id 194sm1617129itl.4.2017.07.09.00.04.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2017 00:04:30 -0700 (PDT) In-Reply-To: <87d19clfim.fsf@calancha-pc> (Tino Calancha's message of "Fri, 07 Jul 2017 19:15:13 +0900") 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:134352 Archived-At: Tino Calancha writes: > I've being thinking about this, and i cannot find something better than > your second patch. > > My suggestion is: > > 1. We apply your 2nd patch. > 2. We handle the failing tests wrapping '(ert-fail "failed")' into > `ignore-errors' as in below patch. > > Then, IMO we are in a better situation than we are know: > That fix this bug, and if i am nt missing something, at a low price: just > tweaking a bit 2 innocents tests. > > What do you think? > > > diff --git a/test/lisp/emacs-lisp/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el > index 317838b250..f3e4db192a 100644 > --- a/test/lisp/emacs-lisp/ert-tests.el > +++ b/test/lisp/emacs-lisp/ert-tests.el > @@ -413,12 +413,14 @@ ert-test--which-file > (let ((test (make-ert-test :body (lambda ())))) > (should (ert-test-result-expected-p test (ert-run-test test)))) > ;; unexpected failure > - (let ((test (make-ert-test :body (lambda () (ert-fail "failed"))))) > - (should-not (ert-test-result-expected-p test (ert-run-test test)))) > - ;; expected failure > - (let ((test (make-ert-test :body (lambda () (ert-fail "failed")) > - :expected-result-type ':failed))) > + (let ((test (make-ert-test > + :body (lambda () (ignore-errors (ert-fail "failed")))))) > (should (ert-test-result-expected-p test (ert-run-test test)))) > + ;; expected failure > + (let ((test (make-ert-test > + :body (lambda () (ignore-errors (ert-fail "failed"))) > + :expected-result-type ':failed))) > + (should-not (ert-test-result-expected-p test (ert-run-test test)))) > ;; `not' expected type > (let ((test (make-ert-test :body (lambda ()) > :expected-result-type '(not :failed)))) I agree that it's a low price, and that it fixes more than it breaks, but it does involve switching the logic in a simple basic test. Also note that ignore-errors expands into a condition-case, so instead of changing the tests, the patch could be tweaked to return nil if the test signals ert-test-{failed, skipped}. Or the two tests could use condition-case directly and make sure that ert-test-failed is/isn't signalled. I'd like to get some more opinions on this bug, in the hopes that there's a better solution. Eli/Noam (or anyone happening upon this), do you have any ideas on how to solve this?