Ihor Radchenko <yanta...@posteo.net> writes:

> What about the attached amendment?
> It should simplify things significantly.

Sorry, in my previous patch the test that checks the detector itself was not
even run in 'make test' because of incorrect test prefix.

Your patch does not work as you expect. Could you please revise it?

>From 6eb03414ac4eb8b64160b24dc7fcb805bf782310 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yanta...@posteo.net>
Date: Fri, 26 Jan 2024 14:21:55 +0100
Subject: [PATCH] test-duplicates-detector.el: Add correct prefix to the
 deftest, check if consp

*
testing/lisp/test-duplicates-detector.el (test-duplicates-detector--search-forms-recursively):

*
testing/lisp/test-duplicates-detector.el (test-org-tests/test-duplicates-detector-testing-find-duplicates):
Add correct prefix so that the test could be executed
---
 testing/lisp/test-duplicates-detector.el | 25 ++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/testing/lisp/test-duplicates-detector.el b/testing/lisp/test-duplicates-detector.el
index d6f8aca5a..aed8034ee 100644
--- a/testing/lisp/test-duplicates-detector.el
+++ b/testing/lisp/test-duplicates-detector.el
@@ -231,22 +231,23 @@ FORM-PATH is list of the form:
 Write each form to `test-duplicates-detector-forms'"
   (let ((idx 0))
     (dolist (sub-form form)
-      (unless (memq (car-safe sub-form) test-duplicates-progn-forms)
-        (push idx (alist-get
-		   sub-form
-                   (alist-get form-path test-duplicates-detector-forms
-                              nil nil #'equal)
-                   nil nil #'equal-including-properties)))
-      (unless (memq (car-safe sub-form)
-		    '(should-not should should-error))
-	(test-duplicates-detector--search-forms-recursively
-         sub-form
-         (append form-path (list (cons (car sub-form) idx)))))
+      (when (consp sub-form)
+        (unless (memq (car-safe sub-form) test-duplicates-progn-forms)
+          (push idx (alist-get
+		     sub-form
+                     (alist-get form-path test-duplicates-detector-forms
+                                nil nil #'equal)
+                     nil nil #'equal-including-properties)))
+        (unless (memq (car-safe sub-form)
+		      '(should-not should should-error))
+	  (test-duplicates-detector--search-forms-recursively
+           sub-form
+           (append form-path (list (cons (car-safe sub-form) idx))))))
       (cl-incf idx))))
 
 ;;;; Testing the detector itself
 
-(ert-deftest test-duplicates-detector-testing-find-duplicates ()
+(ert-deftest test-org-tests/test-duplicates-detector-testing-find-duplicates ()
   "Test `test-duplicates-detector--find-duplicates'."
   (should
    (equal
-- 
2.41.0

Reply via email to