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

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

bug#24402: should-error doesn't catch all errors


From: Gemini Lasswell
Subject: bug#24402: should-error doesn't catch all errors
Date: Thu, 20 Jul 2017 12:23:25 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

address@hidden writes:

> The following appears to fix it, though perhaps we should use a smarter
> equal function that would consider the circular lists to actually be
> equal instead of bailing out and returning nil on circularity.

Thanks for tracking this one down and making a patch, which looks good
to me. Does that smarter equal function already exist? It doesn't seem
worth the effort of writing one for this purpose only.

Here is a test to add to your patch, which fails without it and passes
with it:

>From f401e3169ff3887b8215b6625d111d70e5340efe Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <address@hidden>
Date: Thu, 20 Jul 2017 12:01:42 -0700
Subject: [PATCH] Add a test of handling of circular values to testcover-tests

* test/lisp/emacs-lisp-testcover-resources/testcases.el
(testcover-testcase-cyc1): New function.
(testcover-tests-circular-lists-bug-24402): New test.
---
 test/lisp/emacs-lisp/testcover-resources/testcases.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el 
b/test/lisp/emacs-lisp/testcover-resources/testcases.el
index 1eb791a993..c9a5a6daac 100644
--- a/test/lisp/emacs-lisp/testcover-resources/testcases.el
+++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el
@@ -490,4 +490,14 @@ testcover-testcase-how-do-i-know-you
 
 (should (eq (testcover-testcase-how-do-i-know-you "Liz") 'unknown))
 
+;; ==== circular-lists-bug-24402 ====
+"Testcover captures and ignores circular list errors."
+;; ====
+(defun testcover-testcase-cyc1 (a)
+  (let ((ls (make-list 10 a%%%)))
+    (nconc ls ls)
+    ls))
+(testcover-testcase-cyc1 1)
+(testcover-testcase-cyc1 1)
+
 ;; testcases.el ends here.
-- 
2.12.2


reply via email to

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