From: Sebastian Miele <sebastian.miele@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: COMMENT and noweb-ref
Date: Wed, 02 Oct 2019 13:38:23 +0000 [thread overview]
Message-ID: <875zl79sj4.fsf@gmail.com> (raw)
In-Reply-To: <84zhirc4l5.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 79 bytes --]
First, here is a patch introducing tests concerning Org comments and
tangling.
[-- Attachment #2: 0001-ob-tangle-Add-tests.patch --]
[-- Type: text/plain, Size: 2359 bytes --]
From c769435b9ab11f7a3b5ff5f1ec2df95ae2c6aa32 Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
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
+ <<B>>
+ <<C>>
+ <<D>>
+ #+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
next prev parent reply other threads:[~2019-10-02 13:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 21:33 Bug: COMMENT and noweb-ref Sebastian Miele
2019-09-16 21:39 ` Sebastian Miele
2019-09-26 16:58 ` Sebastian Miele
2019-09-26 18:09 ` Marco Wahl
2019-10-02 13:38 ` Sebastian Miele [this message]
2019-10-08 20:34 ` Sebastian Miele
2019-10-20 22:09 ` [PATCH] " Sebastian Miele
2019-10-20 22:30 ` Sebastian Miele
2019-11-24 9:29 ` Nicolas Goaziou
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=875zl79sj4.fsf@gmail.com \
--to=sebastian.miele@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).