Skip to content

Commit 394f84f

Browse files
committed
Add property drawer tests
1 parent d095461 commit 394f84f

File tree

6 files changed

+108
-0
lines changed

6 files changed

+108
-0
lines changed

tests/property_drawer/foo.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(message "this will be tangled to foo.el")
2+
3+
echo "this block will be tangled to foo.el too!"

tests/property_drawer/foo/bar.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(message "this will be tangled to foo/bar.el")
2+
3+
(message "second line tangled to foo/bar.el")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
echo "this will be tangled to property_drawer.nim"
2+
3+
echo "this will the second block tangled to property_drawer.nim"
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#+property: header-args :tangle yes
2+
3+
At Org level 0.
4+
5+
#+begin_src nim
6+
echo "this will be tangled to property_drawer.nim"
7+
#+end_src
8+
9+
#+begin_src nim :tangle no
10+
echo "this block won't get tangled"
11+
#+end_src
12+
13+
* Heading 1
14+
:PROPERTIES:
15+
:HEADER-ARGS: :tangle no
16+
:END:
17+
Below block will also *not* be tangled. This subtree also tests the
18+
~header-args~ property in all-caps.
19+
#+begin_src nim
20+
echo "hello"
21+
#+end_src
22+
** Heading 1.1
23+
Now at Org level 2.
24+
#+begin_src nim :tangle specified_file.nim
25+
echo "this will be tangled to specified_file.nim"
26+
#+end_src
27+
* Heading 2
28+
:PROPERTIES:
29+
:header-args: :tangle foo/bar.el
30+
:header-args+: :mkdirp yes
31+
:END:
32+
Back at Org level 1.
33+
#+begin_src emacs-lisp
34+
(message "this will be tangled to foo/bar.el")
35+
#+end_src
36+
** Heading 2.1
37+
:PROPERTIES:
38+
:header-args:nim: :tangle no
39+
:END:
40+
Now again at Org level 2.
41+
42+
Only the nim blocks will *not* be tangled from this subtree.
43+
#+begin_src nim
44+
echo "this will *not* be tangled"
45+
#+end_src
46+
47+
But the below block will tangle fine.
48+
#+begin_src emacs-lisp
49+
(message "second line tangled to foo/bar.el")
50+
#+end_src
51+
*** Heading 2.1.1
52+
:PROPERTIES:
53+
:header-args:nim: :tangle yes
54+
:END:
55+
Now at Org level 3.
56+
57+
Below nim block will be tangled.
58+
#+begin_src nim
59+
echo "this will the second block tangled to property_drawer.nim"
60+
#+end_src
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#+property: header-args :tangle yes
2+
3+
At Org level 0.
4+
5+
* Heading 1
6+
:PROPERTIES:
7+
:header-args: :tangle foo.el
8+
:END:
9+
At Org level 1.
10+
#+name: block1
11+
#+begin_src emacs-lisp
12+
(message "this will be tangled to foo.el")
13+
#+end_src
14+
** Heading 1.1
15+
:PROPERTIES:
16+
:header-args:emacs-lisp: :tangle no
17+
:END:
18+
At Org level 2.
19+
20+
Only the emacs-lisp block will *not* be tangled from this subtree.
21+
#+name: block2
22+
#+begin_src emacs-lisp
23+
(message "this block will *not* be tangled")
24+
#+end_src
25+
26+
But the below Nim block will tangle fine (though incorrectly to the
27+
foo.el file!).
28+
#+name: block3
29+
#+begin_src nim
30+
echo "this block will be tangled to foo.el too!"
31+
#+end_src
32+
33+
- Note :: ~ntangle~ creates /block3/ *below* /block1/ in the tangled
34+
~foo.el~, while ~org-bable-tangle~ reverses that order. It's
35+
not clear why that's the case with ~org-babel-tangle~ if
36+
/block3/ is appearing *after* /block1/ in this Org
37+
file. Assuming that that's a bug in Org mode, ~ntangle~ is
38+
not copying that behavior right now. <2018-10-07 Sun>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "this will be tangled to specified_file.nim"

0 commit comments

Comments
 (0)