From: Alex <agrambot@gmail.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: Gemini Lasswell <gazally@runbox.com>,
24402@debbugs.gnu.org, npostavs@users.sourceforge.net
Subject: bug#24402: should-error doesn't catch all errors
Date: Sun, 09 Jul 2017 01:04:24 -0600 [thread overview]
Message-ID: <87bmounlaf.fsf@lylat> (raw)
In-Reply-To: <87d19clfim.fsf@calancha-pc> (Tino Calancha's message of "Fri, 07 Jul 2017 19:15:13 +0900")
Tino Calancha <tino.calancha@gmail.com> 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?
next prev parent reply other threads:[~2017-07-09 7:04 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-10 1:26 bug#24402: 25.1.50; testcover-start breaks should-error Gemini Lasswell
[not found] ` <handler.24402.B.14734739098199.ack@debbugs.gnu.org>
2016-09-20 4:27 ` bug#24402: More Information Gemini Lasswell
2017-07-04 3:28 ` bug#24402: should-error doesn't catch all errors (Was:bug#24402: More Information) Alex
2017-07-05 0:00 ` bug#24402: should-error doesn't catch all errors Alex
2017-07-05 13:43 ` Tino Calancha
2017-07-05 19:56 ` Alex
2017-07-07 10:15 ` Tino Calancha
2017-07-09 7:04 ` Alex [this message]
2017-07-11 12:18 ` npostavs
2017-07-12 3:47 ` Alex
2017-07-12 12:30 ` npostavs
2017-07-12 16:45 ` Alex
2017-07-13 1:31 ` npostavs
2017-07-13 3:04 ` Alex
2017-07-13 3:44 ` npostavs
2017-07-13 22:45 ` Alex
2017-07-13 23:49 ` npostavs
2017-07-14 4:42 ` Alex
2017-07-14 4:45 ` Alex
2017-07-15 21:57 ` npostavs
2017-07-16 3:49 ` Alex
2017-07-17 0:46 ` npostavs
2017-07-19 21:23 ` Gemini Lasswell
2017-07-19 22:40 ` Alex
2017-07-19 23:04 ` npostavs
2017-07-20 4:04 ` Alex
2017-07-20 19:23 ` Gemini Lasswell
2017-08-08 1:15 ` npostavs
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmounlaf.fsf@lylat \
--to=agrambot@gmail.com \
--cc=24402@debbugs.gnu.org \
--cc=gazally@runbox.com \
--cc=npostavs@users.sourceforge.net \
--cc=tino.calancha@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.