[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] testing: Delete duplicate tests
From: |
Ilya Chernyshov |
Subject: |
[PATCH] testing: Delete duplicate tests |
Date: |
Thu, 13 Jul 2023 02:22:09 +0700 |
Hello.
In my last patch, I found a duplicate test, so I decided to find all of
the duplicate tests inside testing/lisp/ folder via this function:
(defun count-duplicate-tests (&optional directory)
(let (files)
(dolist (file (directory-files (or directory default-directory) t (rx ".el"
string-end) t))
(with-current-buffer (find-file-noselect file)
(save-excursion
(goto-char (point-min))
(while (search-forward "(ert-deftest" nil t)
(ignore-errors
(while-let((form (or (read (current-buffer)) t)))
(when (eq (car-safe form) 'should)
(setf
(alist-get form (alist-get file files nil nil #'equal) 0 nil
#'equal)
(1+ (alist-get form (alist-get file files nil nil #'equal) 0
nil #'equal))))))))))
(seq-remove
(lambda(file) (null (cdr file)))
(mapcar
(lambda(file)
(cons
(car file)
(seq-filter
(lambda(form) (/= (cdr form) 1))
(cdr file))))
files))))
(setq dups (count-duplicate-tests "~/org-mode/testing/lisp/"))
Then I checked the result manually and deleted some of them.
Here is the patch I wrote:
0001-testing-Delete-duplicate-tests.patch
Description: Text Data
- [PATCH] testing: Delete duplicate tests,
Ilya Chernyshov <=