From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id eAx1OE0ZxmX7CgAAqHPOHw:P1 (envelope-from ) for ; Fri, 09 Feb 2024 13:23:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id eAx1OE0ZxmX7CgAAqHPOHw (envelope-from ) for ; Fri, 09 Feb 2024 13:23:42 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WeIHDjEj; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707481421; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=efy92uSF5sNKRE7hKmDkaelQiRxi6hge7gfkqi6e7cI=; b=TvxUp5BvsGNuzswBc852r48U/c4Ih7+p9dT5liwx8oRdipKaa7WMwiR+e2qYW/Iu/Y7dFK oVz/yxZPik1UEHVIRxM2MvU2oJaA0J29Rl3dOkk2WBdrWR3E2S1TUoMIYgVaf9xoBmR0rP GmdfBBpe+6iLqV4ZHXqoEaSSVuMn/8zTVypn//+uPeHw8KCWgvTs6Qc6tmBQkmKykFUwQj qUUaL1bKU6hOlmJ+YAKfGzAo0bbtpfGoo25ymujKN8pjSL0Fu0N4nH2XbVhRpecmxnSAS4 X84Ioes4serr2m8WYrcyMSwgO+wZzzm72Z3yVp0iNSm346DASm+NHCpeL1gNqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WeIHDjEj; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707481421; a=rsa-sha256; cv=none; b=b8t5+i5drTI2zA76Pf7G5gCxC1E0QDEfFRIeWEhXcw31D7+/BOk6x6ENnpJo7uYM7+M4xe kQ+INwoso8otkVFe1Y/N/xErbdj7jO0UIL8m+eRHFUGNn0wqCx6Xg+GZ+OR12fZlf3KFp/ YtfdoVb1JFWSB+IiZ6BS2RdUscizvB9+ZpOAJxAEnZdujmGD+ZqLiXbE2T0WiDcB9KQ/6k KifcV6pVxt9kI4QdKdOR3+FNN6FKVPqOiTsCkAhRFoc30ZHEHD+O7TCzKxWYWb+D5Z4PAZ NXikL4m14VfvmyrZl8ZtVpljYn7tCrzg+rJ4QN1KVMAM8L+cEItzXCHSaAcb5A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BAC1C6705D for ; Fri, 9 Feb 2024 13:23:41 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rYPty-0004Ml-Jg; Fri, 09 Feb 2024 07:22:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rYPtw-0004MM-SM for emacs-orgmode@gnu.org; Fri, 09 Feb 2024 07:22:40 -0500 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rYPtu-0008EP-Uq for emacs-orgmode@gnu.org; Fri, 09 Feb 2024 07:22:40 -0500 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50eac018059so1178317e87.0 for ; Fri, 09 Feb 2024 04:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707481355; x=1708086155; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=efy92uSF5sNKRE7hKmDkaelQiRxi6hge7gfkqi6e7cI=; b=WeIHDjEjeT/LVSubkb4VQo0VWJAcrg81EM44mMrjq9y8iuiXQZEGhZIgtzlbZurExZ p3bQN+GGr7MFfEFCGJYuhcj706qcb7DeQ+nMdO3+Gl7VN2TrgPFaJk9v2rbShjevuyeT 9Rlsa2T9IYdJNqPpPwUoR8AGKgjyIuHNDP65nC8309qDfI4Woj7hpPZPvBGSd5k9SlcH qxqoiEcGOXFym8/ijP5Kd7N83ZEx7GXz5layBhH25IvLCTL8fNehlBx1QM+b5zatfDmL i6/pLR1jWGOPiXgIqVXppif93oR4IQ4nh1KbjLNddsSf/tMZ5Ok3/RKgSoNdoabA3Qgo Uq0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707481355; x=1708086155; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=efy92uSF5sNKRE7hKmDkaelQiRxi6hge7gfkqi6e7cI=; b=W8sLHd/+/ue8+OJR9YFtQGSE0sPpSvzntHO08kH1pAv11Jm2EinhX535So/Kx8Iai7 ghc207HMMdlOghE7319whNcadzeiLSE/oe2eNqVkcw4cPncClIiUo+LW3MGJS7EZEj1h vYy0AK8wcaY2Ubhv3E0wmaWvLIIjHxh7V3T8tS+8l2i1Uo0f0rXbDAcxqT9NBLjf48Nk biLkLX9s3e835954e0xHZFO3cwWN6n8qQz0VZ2dG7214S1I/VU0VSKiWU2lhoaV1j4j5 wr4NsrE+++cAM6O9+DLOj3unsX730oToXDgucP64FwRYtXDTr+apDOHkuha4DR8goq9p GiFw== X-Gm-Message-State: AOJu0Yy5/6gT/z8bV50O68wOS29vTHyc2eQxn9pmsMRJMorn5MjQm9PR tIRIML5qLZ4OF4wIeqYxyvChvFVABOXq3f9v9ww22gjd1vI5OcSsgdr7j4Cu X-Google-Smtp-Source: AGHT+IFX1rJLZqXgQWydd/i9nLz3waEzfr+IxXlrHzmFSoZGgTzZRjBH1asV0mPXiACsu6JY00CsKA== X-Received: by 2002:ac2:5203:0:b0:511:53c6:1f with SMTP id a3-20020ac25203000000b0051153c6001fmr859207lfl.14.1707481354939; Fri, 09 Feb 2024 04:22:34 -0800 (PST) Received: from sonyvaio ([5.136.0.28]) by smtp.gmail.com with ESMTPSA id z22-20020ac25df6000000b00511740efdd1sm276035lfq.39.2024.02.09.04.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 04:22:32 -0800 (PST) From: Ilya Chernyshov To: Ihor Radchenko Cc: emacs-orgmode Subject: Re: [PATCH] testing: Delete duplicate tests In-Reply-To: <87wmrpu27p.fsf@localhost> References: <87cz0xndem.fsf@gmail.com> <87cz0wyw9m.fsf@localhost> <87y1ilitzo.fsf@localhost> <87fs3zybvj.fsf@gmail.com> <875y4viv14.fsf@localhost> <878r78ftvs.fsf@localhost> <87sf5cr7na.fsf@gmail.com> <87il3tl7eb.fsf@localhost> <87il3kw91t.fsf@gmail.com> <871qa4fcs5.fsf@localhost> <874jeznz82.fsf@gmail.com> <87wmrpu27p.fsf@localhost> Date: Fri, 09 Feb 2024 18:22:28 +0600 Message-ID: <871q9laku3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=ichernyshovvv@gmail.com; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.99 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -9.99 X-Migadu-Queue-Id: BAC1C6705D X-TUID: KTk9GRfGNNt6 --=-=-= Content-Type: text/plain Ihor Radchenko writes: > 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? Yeah, now it works as it should. Thanks. I've made some minor changes I've described in the attached patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-test-duplicates-detector.el-Simplify-the-docs-refact.patch >From 8bcd02bac32d3a4442814c2a42b097d642964372 Mon Sep 17 00:00:00 2001 From: Ilya Chernyshov Date: Fri, 9 Feb 2024 17:32:58 +0600 Subject: [PATCH] test-duplicates-detector.el: Simplify the docs, refactor, optimize the search * test-duplicates-detector.el (test-duplicates-detector-duplicate-forms): Simplify the docstring. Add that the list also may have information about duplicate ert test definitions. * test-duplicates-detector.el (test-duplicates-detector--find-duplicates): Don't go through a duplicate ert test definition. * test-duplicates-detector.el (test-duplicates-detector--search-forms-recursively): Replace (car-safe sub-form) with (car sub-form) because we already checked that sub-form is a cons. --- testing/lisp/test-duplicates-detector.el | 51 ++++++++++-------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/testing/lisp/test-duplicates-detector.el b/testing/lisp/test-duplicates-detector.el index 25293f185..58da27c07 100644 --- a/testing/lisp/test-duplicates-detector.el +++ b/testing/lisp/test-duplicates-detector.el @@ -61,24 +61,19 @@ Immediate children inside these are not checked for duplicates.") (expand-file-name "lisp" org-test-dir) t "\\.el$"))) (defvar test-duplicates-detector-duplicate-forms nil - "A nested list of the form: + "A list where each element is either: - (((file test-name [(form-1 . numerical-order) - (form-2 . numerical-order) ...]) - (dup-form-1 . (numerical-order [numerical-order ...])) - [ (dup-form-2 . (numerical-order [numerical-order ...])) - (dup-form-3 . (numerical-order [numerical-order ...])) - ...]) - - ((file test-name [(form-1 . numerical-order) - (form-2 . numerical-order) ...]) + ((file test-name [(form-1 . numerical-order) + (form-2 . numerical-order) ...]) (dup-form-1 . (numerical-order [numerical-order ...])) [ (dup-form-2 . (numerical-order [numerical-order ...])) (dup-form-3 . (numerical-order [numerical-order ...])) ...]) - ... - ) +or + + (test-1-symbol . duplicate-of-test-1-symbol) + Where @@ -88,31 +83,29 @@ Where is a path to duplicates. For example, the path for the duplicates in the following test: - test-ob-haskell-ghci.el + test-file.el - (ertdeftest 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'.\" + (ertdeftest test-name () + \"Docstring.\" (let ((var-1 \"value\")) (when var-1 (should-not - (equal 2 (test-ob-haskell-ghci \":session \"none\"\" \"x\" nil))) - (test-ob-haskell-ghci \":session none\" \"x=2\") + (equal 2 (some-func \"string\" \"x\" nil))) + (some-func \"string\" \"x=2\") (should-not - (equal 2 (test-ob-haskell-ghci \":session \"none\"\" \"x\" nil))) - (test-ob-haskell-ghci \":session none\" \"x=2\")))) + (equal 2 (some-func \"string\" \"x\" nil))) + (some-func \"string\" \"x=2\")))) would look like this: - (\"test-ob-haskell-ghci.el\" - ob-haskell/session-named-none-means-one-shot-sessions + (\"/absolute/path/to/test-file.el\" + test-name (let . 4) (when . 2)) And the records about the duplicates would look like this: - ((test-ob-haskell-ghci \":session none\" \"x=2\") 5 3) ((should-not - (equal 2 (test-ob-haskell-ghci \":session \"none\"\" \"x\" nil))) 4 2)") + (equal 2 (some-func \"string\" \"x\" nil))) 4 2)") (defvar test-duplicates-detector-forms nil "Nested alist of found forms and paths to them (not filtered).") @@ -168,9 +161,9 @@ Duplicate forms will be written to (cdddr x)))) found-deftests))) (push (cons test-name (cadr f)) duplicate-tests) - (push deftest found-deftests)) - (test-duplicates-detector--search-forms-recursively - deftest (list file (cadr deftest))))))))) + (push deftest found-deftests) + (test-duplicates-detector--search-forms-recursively + deftest (list file test-name))))))))) (setq test-duplicates-detector-duplicate-forms (seq-filter #'cdr @@ -239,11 +232,11 @@ Write each form to `test-duplicates-detector-forms'" (alist-get form-path test-duplicates-detector-forms nil nil #'equal) nil nil #'equal-including-properties))) - (unless (memq (car-safe sub-form) + (unless (memq (car 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)))))) + (append form-path (list (cons (car sub-form) idx)))))) (cl-incf idx)))) ;;;; Testing the detector itself -- 2.41.0 --=-=-=--