From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id mMh8GDmNu2TbvQAASxT56A (envelope-from ) for ; Sat, 22 Jul 2023 10:03:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id QMmnFzmNu2QaHwAAG6o9tA (envelope-from ) for ; Sat, 22 Jul 2023 10:03:05 +0200 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 602943BBE6 for ; Sat, 22 Jul 2023 10:03:04 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=FU2EKa2k; 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=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1690012985; 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=j5ILy9IUGSDx2BHoEsLyN6BROj3kj/dH09Z7ccMCpoM=; b=B+i7bq1BnD7RF9LO98Ni59fowSqbpirfRxJ5p9eJLz36OTV9OMCn3vzKrLty7VMvFnTTMd cN3dgxV47wNybjzb79kr9lzGIDqQQdldyv8JpxK8Bh+K6fl/UlvnkPBTS6qDittukRPmDA Ju55h12ShzHWY8tKnuTzx+BnH/fvnUYSCWNE0utg7dLFXuERkZP1WtsYYP2b1ZAslOqOCM OcqZyVc36qjbqnfTB3l4obK3bFoiPEfg0nFqd61qc9h33q8Wi1VpD5gBznxPHKlDAKa3bR 59iKUgm7/1oBJZwLEvZKx7oUX0erEeEjoMB6tqk73RxqEApWLtBcVDz7d9Ol2w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1690012985; a=rsa-sha256; cv=none; b=BV6WEfo5YZ//9YbUgsIcVgrfd8Mz1SwFFkZDWNwT8SUQ8lBjxQWuYhzuO4t1e3afeUwoen rXVB9Gp7KcUo0Ah7LzrrgmUx2fLNca+X2eLd1273V1blVQlO35WSKGZ+MlQCPhS4sjeRIN NjrF5g/ucqXwfLMmxaNaMfgcozi6wJPm6yPrYq0da81bZO2O7EkZwZuBLCTdcPmyjWVZkd waK4tpder3oYYBOGKiWHjg/BtNhT4W7MP9d3mkEBH90/TVx9OPZkzHKtd+Q4dYiW/5f4Zs L4mKOmHt2es3pZ8VqMtCzc58GX31ptDGcltJWpoHlGamuZUw42O0Sp+FTxwB6A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=FU2EKa2k; 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=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qN7ZF-00051Q-3T; Sat, 22 Jul 2023 04:02:21 -0400 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 1qN7ZC-00051H-Ra for emacs-orgmode@gnu.org; Sat, 22 Jul 2023 04:02:18 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN7ZA-00021x-BL for emacs-orgmode@gnu.org; Sat, 22 Jul 2023 04:02:18 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 2C543240103 for ; Sat, 22 Jul 2023 10:02:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690012933; bh=XW6P96mqjBFFTVEyxUZd/FreI5X/EDx/uL8hef9j1uQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=FU2EKa2kqUxtZrN9Hm450yViUUuDTNl33PjkD9NWylnNFTeNWW9fTknVwZQeQ5QDR ShQen84dIl2oqBh3aM5UhJH4nFUNid3JQchS33AEpBNOYu8BgJh080b+Qy6iaPcpkJ R/t/BiggBXlHF32txn1kPndgEE6bCOnmXHErAz38RqQAFEMO7iWGNPhWh0IelwlKLt S8z/Mq0Qm3lvj5tqFpV6lKulKLNnHor+Jesm8NiUuIK/bqoM+9oLRVtQtaaRxOWGq9 JWAH/ILDXobXcJG0w0mDy8rBUDBhb4ldaJ45hGCWbfCPqrW7OnqIaXuEi/ogjtUedI pIKsrMDCAYe7w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R7Jmh0p1cz6tvp; Sat, 22 Jul 2023 10:02:11 +0200 (CEST) From: Ihor Radchenko To: Mehmet Tekman Cc: emacs-orgmode@gnu.org Subject: Re: [ANN] lisp/ob-tangle-sync.el In-Reply-To: References: <87r0rxv3t5.fsf@localhost> <87lei577g4.fsf@gmail.com> <87lei5v1fg.fsf@localhost> <87fs8duyae.fsf@localhost> <8735451u20.fsf@gmail.com> <874jokbjsk.fsf@localhost> <87zg6ch2dm.fsf@gmail.com> <87sfc4a0ce.fsf@localhost> <87r0ro9mzc.fsf@gmail.com> <87zg69zq49.fsf@localhost> <87r0rg1lwe.fsf@gmail.com> <87leho3y0n.fsf@localhost> <87a5y3vzpe.fsf@gmail.com> <87jzx6ylrm.fsf@localhost> <87ttw8kd9u.fsf@gmail.com> <87fs5ppcx7.fsf@localhost> <875y6hwqqe.fsf@localhost> Date: Sat, 22 Jul 2023 08:02:24 +0000 Message-ID: <87o7k48jcf.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -9.33 X-Spam-Score: -9.33 X-Migadu-Queue-Id: 602943BBE6 X-Migadu-Scanner: mx1.migadu.com X-TUID: 6PFDOHRwfZSP --=-=-= Content-Type: text/plain Mehmet Tekman writes: >> P.S. There going to be Emacs meetup this Saturday, July 22 >> (https://emacs-apac.gitlab.io/announcements/july-2023/). I plan to be >> there and, if you need it, we can try to resolve difficulties in more >> interactive way. > > I am currently travelling this weekend, otherwise I happily would > attend so that this patch could speed forward. Next month maybe? Another meetup is on July 26. https://emacs-berlin.org/ Or we can arrange a jitsi call. >> Side note: You are re-implementing the already available ERT >> features for failed test reporting. Instead of controlling >> which tests failed manually, you should better follow the >> example of all other tests and simply use a sequence of >> `should'/`should-not' forms. > > Okay, I've re-written this to conform to the `should' macros. I > *really* wish these macros could be named so that I could debug > failing statements better, but for now numbering them in the > comments and using the `l' binding works well enough for > debugging. To name them, you can use separate ert-deftest statements. Also, see the attached modified version of your diff - I made it so that `should' failures immediately provide some clue about expected result value, that can help to identify which of the should clauses fails. > I have two tests that I've set to "should-not" pass for now, but > once the correct merging behaviour has been implemented, I > believe that I will change them to "should" pass statements: > > - 9. do-not-tangle-this-block > - 12. tangle-file-with-spaces The tests are indeed not passing on vanilla Org. I assume that you tested them with your other patch applied. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-testing-lisp-test-ob.el-test-ob-merge-params-new-test-v3-Ihor.patch diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index c8dbd44f4..de92cb90b 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -314,6 +314,147 @@ (ert-deftest test-ob/parse-header-args2 () (org-babel-next-src-block) (should (= 14 (org-babel-execute-src-block))))) +(defun test-ob/get-src-block-property (properties) + "Get plist of PROPERTIES and values for the first src block in buffer. +PROPERTIES is a list of property keywords or a single keyword." + (org-with-wide-buffer + (goto-char (point-min)) + (org-babel-next-src-block) + (org-set-regexps-and-options) + (let ((all-props (nth 2 (org-babel-get-src-block-info)))) + (if (listp properties) + (apply #'nconc (mapcar (lambda (p) (list p (cdr (assoc p all-props)))) properties)) + (list properties (cdr (assoc properties all-props))))))) + +(ert-deftest test-ob/merge-params () + "Test the output of merging multiple header parameters. The +expected output is given in the contents of the source code block +in each test. The desired test header parameters are given +either as a symbol or a list in the `idtest-alist' variable. +Multiple header parameters must be separated by a newline and +exactly two spaces in the block contents." + (should ;; 1. inherit-document-header-args + (equal '(:tangle "/tmp/default_tangle.txt") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +#+begin_src conf +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 2. inherit-document-header-with-local-sync-action + (equal '(:tangle "/tmp/default_tangle.txt skip") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +#+begin_src conf :tangle skip +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 3. override-document-header-with-local-tfile + (equal '(:tangle "randomfile sync") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +#+begin_src conf :tangle randomfile sync +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 4. override-document-and-parent-header-with-local-tfile-and-action + (equal '(:tangle "randomfile sync") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +:PROPERTIES: +:header-args: :tangle \"newfile.txt\" import +:END: +** Two +#+begin_src conf :tangle randomfile sync +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 5. test-tangle-and-default-results-param-together + (equal '(:tangle "randomfile" :results "replace") + (org-test-with-temp-text + "\ +* One +#+begin_src conf :tangle randomfile +#+end_src" + (test-ob/get-src-block-property '(:tangle :results))))) + (should ;; 6. inherit-document-tfile-take-only-last-local-sync-action + (equal '(:tangle "/tmp/default_tangle.txt export") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +#+begin_src conf :tangle import export +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 7. ignore-document-header-take-last-tfile-and-sync-action + (equal '(:tangle "fname2 export") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +#+begin_src conf :tangle fname1 fname2 sync export +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 8. test-results-and-exports + (equal '(:results "wrap file replace" :exports "code") + (org-test-with-temp-text + "\ +* One +#+begin_src sh :results file wrap +#+end_src" + (test-ob/get-src-block-property '(:results :exports))))) + (should-not ;; 9. do-not-tangle-this-block -- + (equal '(:tangle "no") + ;; THIS SHOULD NOT FAIL WITH NEW MERGE FUNCTION. + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +#+begin_src conf :tangle no +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should ;; 10. test-tangle-exports-and-comments + (equal '(:tangle "foo.txt" :exports "verbatim code" :comments "link") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +:PROPERTIES: +:header-args: :tangle no :exports verbatim +:END: +#+begin_src conf :tangle \"foo.txt\" :comments link +#+end_src" + (test-ob/get-src-block-property '(:tangle :exports :comments))))) + (should ;; 11. override-document-and-heading-tfile-with-yes + (equal '(:tangle "foo.txt") + (org-test-with-temp-text + "\ +#+PROPERTY: header-args :tangle /tmp/default_tangle.txt +* One +:PROPERTIES: +:header-args: :tangle \"foo.txt\" +:END: +#+begin_src conf :tangle yes +#+end_src" + (test-ob/get-src-block-property :tangle)))) + (should-not ;; 12. tangle-file-with-spaces + ;; THIS SHOULD NOT FAIL WITH NEW MERGE FUNCTION. + (equal '(:tangle "file with spaces.txt") + (org-test-with-temp-text + "\ +* One +:PROPERTIES: +:header-args: :tangle \"foo.txt\" +:END: +** Two +#+begin_src conf :tangle \"file with spaces.txt\" +#+end_src" + (test-ob/get-src-block-property :tangle))))) + (ert-deftest test-ob/inline-src-blocks () (should (= 1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--