emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Ilya Chernyshov <ichernyshovvv@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] testing: Delete duplicate tests
Date: Wed, 31 Jan 2024 12:17:14 +0000	[thread overview]
Message-ID: <87wmrpu27p.fsf@localhost> (raw)
In-Reply-To: <874jeznz82.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-testing-lisp-test-duplicates-detector.el-Fix-recursi.patch --]
[-- Type: text/x-patch, Size: 1788 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ob-haskell-session-named-none-means-one-shot-session.patch --]
[-- Type: text/x-patch, Size: 1456 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-test-org-tests-test-duplicates-detector-testing-find.patch --]
[-- Type: text/x-patch, Size: 1991 bytes --]

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


[-- Attachment #5: Type: text/plain, Size: 224 bytes --]


-- 
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>

  reply	other threads:[~2024-01-31 12:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 19:22 [PATCH] testing: Delete duplicate tests Ilya Chernyshov
2023-07-13  9:51 ` Ihor Radchenko
2023-08-08 12:44   ` Ihor Radchenko
2023-08-31  6:17     ` Ilya Chernyshov
2023-08-31  6:29       ` Ihor Radchenko
2023-11-08  9:59         ` Ihor Radchenko
2023-11-11  8:55           ` Ilya Chernyshov
2023-11-16 12:27             ` Ilya Chernyshov
2024-01-16 13:44             ` Ihor Radchenko
2024-01-23 12:03               ` Ilya Chernyshov
2024-01-26 13:24                 ` Ihor Radchenko
2024-01-27  5:04                   ` Ilya Chernyshov
2024-01-31 12:17                     ` Ihor Radchenko [this message]
2024-02-09 12:22                       ` Ilya Chernyshov
2024-02-09 14:11                         ` Ihor Radchenko
2023-07-14 11:50 ` Max Nikulin
2023-07-15  7:56   ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmrpu27p.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=ichernyshovvv@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).