[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] testing: Delete duplicate tests
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] testing: Delete duplicate tests |
Date: |
Wed, 31 Jan 2024 12:17:14 +0000 |
Ilya Chernyshov <ichernyshovvv@gmail.com> writes:
> Ihor Radchenko <yantar92@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?
Sure. I erroneously checked car of sub-form when testing whether to
ignore testing duplicates in children.
See the attached series of patches to be applied on top the previous 3.
Note that your
`test-org-tests/test-duplicates-detector-testing-find-duplicates' does
not look right. I had to adjust the `equal' condition in order to make
it pass. May you please check if the return value of
`test-duplicates-detector--find-duplicates' is what you intended?
>From 316c36d2b388a81e43fabf392a75af85532f56ba Mon Sep 17 00:00:00 2001
Message-ID:
<316c36d2b388a81e43fabf392a75af85532f56ba.1706703212.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 31 Jan 2024 13:11:31 +0100
Subject: [PATCH 1/3] testing/lisp/test-duplicates-detector.el: Fix recursion,
add more ignored forms
*
testing/lisp/test-duplicates-detector.el
(test-duplicates-detector--search-forms-recursively):
Do not test for duplicates according to parent form, not current form.
*
testing/lisp/test-duplicates-detector.el (test-duplicates-progn-forms):
Add more progn-like forms.
---
testing/lisp/test-duplicates-detector.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testing/lisp/test-duplicates-detector.el
b/testing/lisp/test-duplicates-detector.el
index aed8034ee..b23fbce1e 100644
--- a/testing/lisp/test-duplicates-detector.el
+++ b/testing/lisp/test-duplicates-detector.el
@@ -42,9 +42,10 @@ (require 'org-test "../testing/org-test")
;;;; Variables
(defvar test-duplicates-progn-forms
- '( progn
+ '( progn prog1 let dolist dotimes
org-test-with-temp-text
org-test-with-temp-text-in-file
+ org-test-at-id
org-test-ignore-duplicate)
"List of forms equivalent to `progn'.
Immediate children inside these are not checked for duplicates.")
@@ -232,7 +233,7 @@ (defun test-duplicates-detector--search-forms-recursively
(form form-path)
(let ((idx 0))
(dolist (sub-form form)
(when (consp sub-form)
- (unless (memq (car-safe sub-form) test-duplicates-progn-forms)
+ (unless (memq (car-safe form) test-duplicates-progn-forms)
(push idx (alist-get
sub-form
(alist-get form-path test-duplicates-detector-forms
--
2.43.0
>From 77ec5f6e3834253a3ba872140f32b148b1135887 Mon Sep 17 00:00:00 2001
Message-ID:
<77ec5f6e3834253a3ba872140f32b148b1135887.1706703212.git.yantar92@posteo.net>
In-Reply-To:
<316c36d2b388a81e43fabf392a75af85532f56ba.1706703212.git.yantar92@posteo.net>
References:
<316c36d2b388a81e43fabf392a75af85532f56ba.1706703212.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 31 Jan 2024 13:12:49 +0100
Subject: [PATCH 2/3] ob-haskell/session-named-none-means-one-shot-sessions:
Remove duplicate
*
testing/lisp/test-ob-haskell-ghci.el
(ob-haskell/session-named-none-means-one-shot-sessions):
Remove duplicate from the test.
---
testing/lisp/test-ob-haskell-ghci.el | 2 --
1 file changed, 2 deletions(-)
diff --git a/testing/lisp/test-ob-haskell-ghci.el
b/testing/lisp/test-ob-haskell-ghci.el
index cbd5f6f9a..990addcd4 100644
--- a/testing/lisp/test-ob-haskell-ghci.el
+++ b/testing/lisp/test-ob-haskell-ghci.el
@@ -117,8 +117,6 @@ (ert-deftest ob-haskell/sessions-must-not-share-variables ()
(ert-deftest ob-haskell/session-named-none-means-one-shot-sessions ()
"When no session, use a new session.
\"none\" is a special name that means `no session'."
- (test-ob-haskell-ghci ":session none" "x=2" nil)
- (should-not (equal 2 (test-ob-haskell-ghci ":session \"none\"" "x" nil)))
(test-ob-haskell-ghci ":session none" "x=2" nil)
(should-not (equal 2 (test-ob-haskell-ghci ":session \"none\"" "x" nil))))
--
2.43.0
>From 1f1c576cf5934e1c590faa7b0cad488aa8ffb9eb Mon Sep 17 00:00:00 2001
Message-ID:
<1f1c576cf5934e1c590faa7b0cad488aa8ffb9eb.1706703212.git.yantar92@posteo.net>
In-Reply-To:
<316c36d2b388a81e43fabf392a75af85532f56ba.1706703212.git.yantar92@posteo.net>
References:
<316c36d2b388a81e43fabf392a75af85532f56ba.1706703212.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 31 Jan 2024 13:13:11 +0100
Subject: [PATCH 3/3]
test-org-tests/test-duplicates-detector-testing-find-duplicates: Fix test
*
testing/lisp/test-duplicates-detector.el
(test-org-tests/test-duplicates-detector-testing-find-duplicates):
Fix test condition.
---
testing/lisp/test-duplicates-detector.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/testing/lisp/test-duplicates-detector.el
b/testing/lisp/test-duplicates-detector.el
index b23fbce1e..25293f185 100644
--- a/testing/lisp/test-duplicates-detector.el
+++ b/testing/lisp/test-duplicates-detector.el
@@ -254,13 +254,13 @@ (ert-deftest
test-org-tests/test-duplicates-detector-testing-find-duplicates ()
(equal
(test-duplicates-detector--find-duplicates
(list test-duplicates-detector-file-path))
- `((((,test-duplicates-detector-file-path
- test-org-tests/test-with-nested-duplicates)
- ((let ((var "string")) (should (message "123 %s" var))) 6 4))
- ((,test-duplicates-detector-file-path
- test-org-tests/test-with-duplicates-at-root)
- ((should (message "123")) 6 4)))
- ((test-org-tests/duplicate-test-2 . test-org-tests/duplicate-test-1))))))
+ `(((,test-duplicates-detector-file-path
+ test-org-tests/test-with-nested-duplicates)
+ ((let ((var "string")) (should (message "123 %s" var))) 6 4))
+ ((,test-duplicates-detector-file-path
+ test-org-tests/test-with-duplicates-at-root)
+ ((should (message "123")) 6 4))
+ (test-org-tests/duplicate-test-2 . test-org-tests/duplicate-test-1)))))
;;;;; Tests with duplicate forms
--
2.43.0
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>