From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Miele Subject: Re: Bug: COMMENT and noweb-ref Date: Wed, 02 Oct 2019 13:38:23 +0000 Message-ID: <875zl79sj4.fsf@gmail.com> References: <87o8zkyli6.fsf@gmail.com> <87y2ybgfk4.fsf@gmail.com> <84zhirc4l5.fsf@gmail.com> Reply-To: sebastian.miele@gmail.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58390) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFepo-0001zc-R9 for emacs-orgmode@gnu.org; Wed, 02 Oct 2019 09:38:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFepn-0005RJ-NO for emacs-orgmode@gnu.org; Wed, 02 Oct 2019 09:38:28 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:40442) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iFepn-0005Pp-D5 for emacs-orgmode@gnu.org; Wed, 02 Oct 2019 09:38:27 -0400 Received: by mail-wm1-x332.google.com with SMTP id b24so7023682wmj.5 for ; Wed, 02 Oct 2019 06:38:27 -0700 (PDT) Received: from tisch ([2a02:908:175c:4260:5ffc:7882:6024:ca5b]) by smtp.gmail.com with ESMTPSA id u83sm7242572wme.0.2019.10.02.06.38.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 06:38:24 -0700 (PDT) In-reply-to: <84zhirc4l5.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain First, here is a patch introducing tests concerning Org comments and tangling. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-ob-tangle-Add-tests.patch >From c769435b9ab11f7a3b5ff5f1ec2df95ae2c6aa32 Mon Sep 17 00:00:00 2001 From: Sebastian Miele Date: Wed, 2 Oct 2019 13:02:46 +0000 Subject: [PATCH] ob-tangle: Add tests * testing/lisp/test-ob-tangle.el (ob-tangle/commented-src-blocks): (ob-tangle/commented-src-blocks-with-nowebref): Add tests. --- testing/lisp/test-ob-tangle.el | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el index 47c31dff5..675f0714b 100644 --- a/testing/lisp/test-ob-tangle.el +++ b/testing/lisp/test-ob-tangle.el @@ -296,6 +296,91 @@ another block (org-split-string (buffer-string)))) (delete-file file)))))) +(ert-deftest ob-tangle/commented-src-blocks () + "Test omission of commented src blocks." + (should + (equal '("A") + (let ((file (make-temp-file "org-tangle-"))) + (unwind-protect + (progn + (org-test-with-temp-text-in-file + (format "#+property: header-args :tangle %S +* A + + #+BEGIN_SRC emacs-lisp + A + #+END_SRC + +* COMMENT B + + #+BEGIN_SRC emacs-lisp + B + #+END_SRC + +* C + + # #+BEGIN_SRC emacs-lisp + # C + # #+END_SRC + +* D + + #+BEGIN_COMMENT + #+BEGIN_SRC emacs-lisp + D + #+END_SRC + #+END_COMMENT" + file) + (org-babel-tangle)) + (with-temp-buffer + (insert-file-contents file) + (org-split-string (buffer-string)))) + (delete-file file)))))) + +(ert-deftest ob-tangle/commented-src-blocks-with-nowebref () + "Test omission of commented src blocks with nowebref." + (should + (equal '("A") + (let ((file (make-temp-file "org-tangle-"))) + (unwind-protect + (progn + (org-test-with-temp-text-in-file + (format "#+property: header-args :tangle %S +* A + + #+BEGIN_SRC elisp :noweb yes + A + <> + <> + <> + #+END_SRC + +* COMMENT B + + #+BEGIN_SRC elisp :noweb-ref B + B + #+END_SRC + +* C + + # #+BEGIN_SRC elisp :noweb-ref C + # C + # #+END_SRC + +* D + + #+BEGIN_COMMENT + #+BEGIN_SRC elisp :noweb-ref D + D + #+END_SRC + #+END_COMMENT" + file) + (org-babel-tangle)) + (with-temp-buffer + (insert-file-contents file) + (org-split-string (buffer-string)))) + (delete-file file)))))) + (provide 'test-ob-tangle) ;;; test-ob-tangle.el ends here -- 2.23.0 --=-=-=--