org-notify: Fix an error in `org-notify-process' when unconfigured
[org-mode/org-tableheadings.git] / testing / lisp / test-ob-exp.el
blob3129e9b23d097714baf8a120f36be15e2b8e33d3
1 ;;; test-ob-exp.el
3 ;; Copyright (c) 2010-2015 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; This file is not part of GNU Emacs.
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ;;; Comments:
23 ;; Template test file for Org tests
25 ;;; Code:
27 (defmacro org-test-with-expanded-babel-code (&rest body)
28 "Execute BODY while in a buffer with all Babel code evaluated.
29 Current buffer is a copy of the original buffer."
30 `(let ((string (org-with-wide-buffer (buffer-string)))
31 (narrowing (list (point-min) (point-max)))
32 (org-export-use-babel t))
33 (with-temp-buffer
34 (org-mode)
35 (insert string)
36 (apply #'narrow-to-region narrowing)
37 (org-babel-exp-process-buffer)
38 (goto-char (point-min))
39 (progn ,@body))))
41 (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers ()
42 "Testing export without any headlines in the Org mode file."
43 (require 'ox-ascii)
44 (let ((text-file (concat (file-name-sans-extension org-test-no-heading-file)
45 ".txt")))
46 (when (file-exists-p text-file) (delete-file text-file))
47 (org-test-in-example-file org-test-no-heading-file
48 ;; Export the file to HTML.
49 (org-export-to-file 'ascii text-file))
50 ;; should create a ".txt" file
51 (should (file-exists-p text-file))
52 ;; should not create a file with "::" appended to its name
53 (should-not (file-exists-p (concat org-test-no-heading-file "::")))
54 (when (file-exists-p text-file) (delete-file text-file))))
56 (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-file ()
57 "Testing export from buffers which are not visiting any file."
58 (require 'ox-ascii)
59 (let ((name (generate-new-buffer-name "*Org ASCII Export*")))
60 (org-test-in-example-file nil
61 (org-export-to-buffer 'ascii name nil nil nil t))
62 ;; Should create a new buffer.
63 (should (buffer-live-p (get-buffer name)))
64 ;; Should contain the content of the buffer.
65 (with-current-buffer (get-buffer name)
66 (should (string-match (regexp-quote org-test-file-ob-anchor)
67 (buffer-string))))
68 (when (get-buffer name) (kill-buffer name))))
70 (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers2 ()
71 "Testing export without any headlines in the Org file."
72 (let ((html-file (concat (file-name-sans-extension
73 org-test-link-in-heading-file)
74 ".html")))
75 (when (file-exists-p html-file) (delete-file html-file))
76 (org-test-in-example-file org-test-link-in-heading-file
77 ;; export the file to html
78 (org-export-to-file 'html html-file))
79 ;; should create a .html file
80 (should (file-exists-p html-file))
81 ;; should not create a file with "::" appended to its name
82 (should-not (file-exists-p (concat org-test-link-in-heading-file "::")))
83 (when (file-exists-p html-file) (delete-file html-file))))
85 (ert-deftest ob-exp/noweb-on-export ()
86 "Noweb header arguments export correctly.
87 - yes expand on both export and tangle
88 - no expand on neither export or tangle
89 - tangle expand on only tangle not export"
90 (should
91 (equal
92 '("(message \"expanded1\")" "(message \"expanded2\")" ";; noweb-1-yes-start
93 (message \"expanded1\")
94 (message \"expanded1\")" ";; noweb-no-start
95 <<noweb-example1>>" ";; noweb-2-yes-start
96 (message \"expanded2\")
97 (message \"expanded2\")"
98 ";; noweb-tangle-start
99 <<noweb-example1>>
100 <<noweb-example2>>")
101 (org-test-at-id "eb1f6498-5bd9-45e0-9c56-50717053e7b7"
102 (org-narrow-to-subtree)
103 (org-element-map
104 (org-test-with-expanded-babel-code (org-element-parse-buffer))
105 'src-block
106 (lambda (src) (org-trim (org-element-property :value src))))))))
108 (ert-deftest ob-exp/noweb-on-export-with-exports-results ()
109 "Noweb header arguments export correctly using :exports results.
110 - yes expand on both export and tangle
111 - no expand on neither export or tangle
112 - tangle expand on only tangle not export"
113 (should
114 (equal
115 '(";; noweb-no-start
116 <<noweb-example1>>" "<<noweb-example1>>
117 <<noweb-example2>>")
118 (org-test-at-id "8701beb4-13d9-468c-997a-8e63e8b66f8d"
119 (org-narrow-to-subtree)
120 (org-element-map
121 (org-test-with-expanded-babel-code (org-element-parse-buffer))
122 'src-block
123 (lambda (src) (org-trim (org-element-property :value src))))))))
125 (ert-deftest ob-exp/exports-both ()
126 "Test the \":exports both\" header argument.
127 The code block evaluation should create both a code block and
128 a table."
129 (org-test-at-id "92518f2a-a46a-4205-a3ab-bcce1008a4bb"
130 (org-narrow-to-subtree)
131 (let ((tree (org-test-with-expanded-babel-code (org-element-parse-buffer))))
132 (should (and (org-element-map tree 'src-block 'identity)
133 (org-element-map tree 'table 'identity))))))
135 (ert-deftest ob-exp/mixed-blocks-with-exports-both ()
136 (should
137 (equal
138 '(property-drawer plain-list src-block fixed-width src-block plain-list)
139 (org-test-at-id "5daa4d03-e3ea-46b7-b093-62c1b7632df3"
140 (org-narrow-to-subtree)
141 (mapcar 'org-element-type
142 (org-element-map
143 (org-test-with-expanded-babel-code
144 (org-element-parse-buffer 'greater-element))
145 'section 'org-element-contents nil t))))))
147 (ert-deftest ob-exp/export-with-name ()
148 (should
149 (string-match
150 "=qux="
151 (let ((org-babel-exp-code-template
152 "=%name=\n#+BEGIN_SRC %lang%flags\nbody\n#+END_SRC"))
153 (org-test-at-id "b02ddd8a-eeb8-42ab-8664-8a759e6f43d9"
154 (org-narrow-to-subtree)
155 (org-test-with-expanded-babel-code
156 (buffer-string)))))))
158 (ert-deftest ob-exp/export-with-header-argument ()
159 (let ((org-babel-exp-code-template
161 | header | value |
162 |---------+----------|
163 | foo | %foo |
164 | results | %results |
165 #+BEGIN_SRC %lang%flags\nbody\n#+END_SRC"))
166 (org-test-at-id "b02ddd8a-eeb8-42ab-8664-8a759e6f43d9"
167 (org-narrow-to-subtree)
168 (org-test-with-expanded-babel-code
169 (should (string-match "baz" (buffer-string)))
170 (should (string-match "replace" (buffer-string)))))))
172 (ert-deftest ob-exp/noweb-no-export-and-exports-both ()
173 (should
174 (string-match
175 "<<noweb-no-export-and-exports-both-1>>"
176 (org-test-at-id "8a820f6c-7980-43db-8a24-0710d33729c9"
177 (org-narrow-to-subtree)
178 (org-test-with-expanded-babel-code
179 (org-element-map (org-element-parse-buffer) 'src-block
180 (lambda (src-block) (org-element-property :value src-block))
181 nil t))))))
183 (ert-deftest ob-exp/evaluate-all-executables-in-order ()
184 (should
185 (equal '(5 4 3 2 1)
186 (let ((org-export-use-babel t) *evaluation-collector*)
187 (org-test-at-id "96cc7073-97ec-4556-87cf-1f9bffafd317"
188 (org-narrow-to-subtree)
189 (buffer-string)
190 (org-test-with-expanded-babel-code *evaluation-collector*))))))
192 (ert-deftest ob-exp/exports-inline ()
193 (should
194 (string-match
195 (regexp-quote "Here is one in the middle {{{results(=1=)}}} of a line.
196 Here is one at the end of a line. {{{results(=2=)}}}
197 {{{results(=3=)}}} Here is one at the beginning of a line.")
198 (org-test-at-id "54cb8dc3-298c-4883-a933-029b3c9d4b18"
199 (org-narrow-to-subtree)
200 (let ((org-babel-inline-result-wrap "=%s="))
201 (org-test-with-expanded-babel-code (buffer-string)))))))
203 (ert-deftest ob-exp/exports-inline-code ()
204 (should
205 (equal "src_emacs-lisp[]{(+ 1 1)}"
206 (org-test-with-temp-text "src_emacs-lisp[:exports code]{(+ 1 1)}"
207 (let ((org-babel-inline-result-wrap "=%s=")
208 (org-export-use-babel t))
209 (org-babel-exp-process-buffer))
210 (buffer-string))))
211 (should
212 (equal "src_emacs-lisp[]{(+ 1 1)}"
213 (org-test-with-temp-text "src_emacs-lisp[ :exports code ]{(+ 1 1)}"
214 (let ((org-babel-inline-result-wrap "=%s=")
215 (org-export-use-babel t))
216 (org-babel-exp-process-buffer))
217 (buffer-string))))
218 (should
219 (equal "src_emacs-lisp[]{(+ 1 1)} {{{results(=2=)}}}"
220 (org-test-with-temp-text "src_emacs-lisp[:exports both]{(+ 1 1)}"
221 (let ((org-babel-inline-result-wrap "=%s=")
222 (org-export-use-babel t))
223 (org-babel-exp-process-buffer))
224 (buffer-string))))
225 (should
226 (equal "{{{results(=2=)}}}"
227 (org-test-with-temp-text
228 "src_emacs-lisp[:exports results :results scalar]{(+ 1 1)}"
229 (let ((org-babel-inline-result-wrap "=%s=")
230 (org-export-use-babel t))
231 (org-babel-exp-process-buffer))
232 (buffer-string))))
233 (should
234 (equal "foosrc_emacs-lisp[:exports code]{(+ 1 1)}"
235 (org-test-with-temp-text
236 "foosrc_emacs-lisp[:exports code]{(+ 1 1)}"
237 (let ((org-babel-inline-result-wrap "=%s=")
238 (org-export-use-babel t))
239 (org-babel-exp-process-buffer))
240 (buffer-string))))
241 (should
242 (let ((text "src_emacs lisp{(+ 1 1)}"))
243 (string-match (regexp-quote text)
244 (org-test-with-temp-text
245 text
246 (let ((org-babel-inline-result-wrap "=%s=")
247 (org-export-use-babel t))
248 (org-babel-exp-process-buffer))
249 (buffer-string)))))
250 (should
251 (string-match
252 (replace-regexp-in-string
253 "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_sh[]{...} or src_sh{...}
254 (regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line.
255 Here is one at the end of a line. src_sh[]{echo 2}
256 src_sh[]{echo 3} Here is one at the beginning of a line.
257 Here is one that is also evaluated: src_sh[]{echo 4} {{{results(=4=)}}}")
258 nil t)
259 (org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076"
260 (org-narrow-to-subtree)
261 (let ((org-babel-inline-result-wrap "=%s=")
262 (org-export-use-babel t))
263 (org-test-with-expanded-babel-code (buffer-string)))))))
265 (ert-deftest ob-exp/exports-inline-code-double-eval ()
266 "Based on default header arguments for inline code blocks (:exports
267 results), the resulting code block `src_emacs-lisp{2}' should also be
268 evaluated."
269 (let ((org-babel-inline-result-wrap "=%s=")
270 (org-export-use-babel t))
271 (should
272 (string-match "\\`{{{results(src_emacs-lisp\\[\\]{2})}}}$"
273 (org-test-with-temp-text
274 "src_emacs-lisp[:exports results :results code]{(+ 1 1)}"
275 (org-babel-exp-process-buffer)
276 (buffer-string))))))
278 (ert-deftest ob-exp/exports-inline-code-eval-code-once ()
279 "Ibid above, except that the resulting inline code block should not
280 be evaluated."
281 (let ((org-export-use-babel t))
282 (should
283 (string-match "{{{results(src_emacs-lisp\\(?:\\[[: a-zA-Z]+]\\)?{2})}}}$"
284 (org-test-with-temp-text
285 (concat "src_emacs-lisp[:exports results :results code "
286 ":results_switches \":exports code\"]{(+ 1 1)}")
287 (org-babel-exp-process-buffer)
288 (buffer-string))))))
290 (ert-deftest ob-exp/exports-inline-code-double-eval-exports-both ()
291 (let ((org-export-use-babel t))
292 (should
293 (string-match (concat "\\`src_emacs-lisp\\(?:\\[]\\)?{(\\+ 1 1)} "
294 "{{{results(src_emacs-lisp\\[ :exports code\\]{2})}}}$")
295 (org-test-with-temp-text
296 (concat "src_emacs-lisp[:exports both :results code "
297 ":results_switches \":exports code\"]{(+ 1 1)}")
298 (org-babel-exp-process-buffer)
299 (buffer-string))))))
301 (ert-deftest ob-exp/export-call-line-information ()
302 (org-test-at-id "bec63a04-491e-4caa-97f5-108f3020365c"
303 (org-narrow-to-subtree)
304 (let ((org-babel-exp-call-line-template "\n: call: %line special-token"))
305 (org-test-with-expanded-babel-code
306 (should (string-match "double" (buffer-string)))
307 (should (string-match "16" (buffer-string)))
308 (should (string-match "special-token" (buffer-string)))))))
310 (ert-deftest ob-exp/noweb-strip-export-ensure-strips ()
311 (org-test-at-id "8e7bd234-99b2-4b14-8cd6-53945e409775"
312 (org-narrow-to-subtree)
313 (org-babel-next-src-block 2)
314 (should (= 110 (org-babel-execute-src-block)))
315 (let ((result (org-test-with-expanded-babel-code (buffer-string))))
316 (should-not (string-match (regexp-quote "<<strip-export-1>>") result))
317 (should-not (string-match (regexp-quote "i=\"10\"") result)))))
319 (ert-deftest ob-exp/use-case-of-reading-entry-properties ()
320 (org-test-at-id "cc5fbc20-bca5-437a-a7b8-2b4d7a03f820"
321 (org-narrow-to-subtree)
322 (let* ((case-fold-search nil)
323 (result (org-test-with-expanded-babel-code (buffer-string)))
324 (sect "a:1, b:0, c:3, d:0, e:0")
325 (sub0 "a:1, b:2, c:4, d:0, e:0")
326 (sub1 "a:1, b:2, c:5, d:0, e:6")
327 (func sub0))
328 ;; entry "section"
329 (should (string-match (concat "_shell-sect-call\n: shell " sect "\n")
330 result))
331 (should (string-match (concat "_elisp-sect-call\n: elisp " sect "\n")
332 result))
333 (should (string-match (concat "\n- sect inline shell " sect "\n")
334 result))
335 (should (string-match (concat "\n- sect inline elisp " sect "\n")
336 result))
337 ;; entry "subsection", call without arguments
338 (should (string-match (concat "_shell-sub0-call\n: shell " sub0 "\n")
339 result))
340 (should (string-match (concat "_elisp-sub0-call\n: elisp " sub0 "\n")
341 result))
342 (should (string-match (concat "\n- sub0 inline shell " sub0 "\n")
343 result))
344 (should (string-match (concat "\n- sub0 inline elisp " sub0 "\n")
345 result))
346 ;; entry "subsection", call with arguments
347 (should (string-match (concat "_shell-sub1-call\n: shell " sub1 "\n")
348 result))
349 (should (string-match (concat "_elisp-sub1-call\n: elisp " sub1 "\n")
350 result))
351 (should (string-match (concat "\n- sub1 inline shell " sub1 "\n")
352 result))
353 (should (string-match (concat "\n- sub1 inline elisp " sub1 "\n")
354 result))
355 ;; entry "function definition"
356 (should (string-match (concat "_location_shell\n: shell " func "\n")
357 result))
358 (should (string-match (concat "_location_elisp\n: elisp " func "\n")
359 result)))))
361 (ert-deftest ob-exp/export-from-a-temp-buffer ()
362 (let ((org-export-use-babel t))
363 (org-test-with-temp-text
365 #+Title: exporting from a temporary buffer
367 #+name: foo
368 #+BEGIN_SRC emacs-lisp
369 :foo
370 #+END_SRC
372 #+name: bar
373 #+BEGIN_SRC emacs-lisp
374 :bar
375 #+END_SRC
377 #+BEGIN_SRC emacs-lisp :var foo=foo :noweb yes :exports results
378 (list foo <<bar>>)
379 #+END_SRC
381 (let* ((ascii (org-export-as 'ascii)))
382 (should (string-match
383 (regexp-quote " :foo :bar \n")
384 ascii))))))
386 (ert-deftest ob-export/export-with-results-before-block ()
387 "Test export when results are inserted before source block."
388 (let ((org-export-use-babel t))
389 (should
390 (equal
391 "#+RESULTS: src1
394 #+NAME: src1
395 #+BEGIN_SRC emacs-lisp
396 \(+ 1 1)
397 #+END_SRC"
398 (org-test-with-temp-text
399 "#+RESULTS: src1
401 #+NAME: src1
402 #+BEGIN_SRC emacs-lisp :exports both
403 \(+ 1 1)
404 #+END_SRC"
405 (org-babel-exp-process-buffer)
406 (org-trim (org-no-properties (buffer-string))))))))
408 (ert-deftest ob-export/export-src-block-with-switches ()
409 "Test exporting a source block with switches."
410 (should
411 (string-match
412 "\\`#\\+BEGIN_SRC emacs-lisp -n -r$"
413 (org-test-with-temp-text
414 "#+BEGIN_SRC emacs-lisp -n -r\n\(+ 1 1)\n#+END_SRC"
415 (org-babel-exp-process-buffer)
416 (buffer-string)))))
418 (ert-deftest ob-export/export-src-block-with-flags ()
419 "Test exporting a source block with a flag."
420 (should
421 (string-match
422 "\\`#\\+BEGIN_SRC emacs-lisp -some-flag$"
423 (org-test-with-temp-text
424 "#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
425 (org-babel-exp-process-buffer)
426 (buffer-string)))))
428 (ert-deftest ob-export/export-and-indentation ()
429 "Test indentation of evaluated source blocks during export."
430 ;; No indentation.
431 (should
432 (string-match
433 "^t"
434 (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n t\n#+END_SRC"
435 (let ((indent-tabs-mode t)
436 (tab-width 1)
437 (org-src-preserve-indentation nil))
438 (org-babel-exp-process-buffer)
439 (buffer-string)))))
440 ;; Preserve indentation with "-i" flag.
441 (should
442 (string-match
443 "^ t"
444 (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -i\n t\n#+END_SRC"
445 (let ((indent-tabs-mode t)
446 (tab-width 1))
447 (org-babel-exp-process-buffer)
448 (buffer-string)))))
449 ;; Preserve indentation with a non-nil
450 ;; `org-src-preserve-indentation'.
451 (should
452 (string-match
453 "^ t"
454 (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n t\n#+END_SRC"
455 (let ((indent-tabs-mode t)
456 (tab-width 1)
457 (org-src-preserve-indentation t))
458 (org-babel-exp-process-buffer)
459 (buffer-string))))))
461 (ert-deftest ob-export/export-under-commented-headline ()
462 "Test evaluation of code blocks under COMMENT headings."
463 (let ((org-export-use-babel t)
464 (org-babel-inline-result-wrap "=%s="))
465 ;; Do not eval block in a commented headline.
466 (should
467 (string-match
468 ": 2"
469 (org-test-with-temp-text "* Headline
470 #+BEGIN_SRC emacs-lisp :exports results
471 \(+ 1 1)
472 #+END_SRC"
473 (org-babel-exp-process-buffer)
474 (buffer-string))))
475 (should-not
476 (string-match
477 ": 2"
478 (org-test-with-temp-text "* COMMENT Headline
479 #+BEGIN_SRC emacs-lisp :exports results
480 \(+ 1 1)
481 #+END_SRC"
482 (org-babel-exp-process-buffer)
483 (buffer-string))))
484 ;; Do not eval inline blocks either.
485 (should
486 (string-match
487 "=2="
488 (org-test-with-temp-text "* Headline
489 src_emacs-lisp{(+ 1 1)}"
490 (org-babel-exp-process-buffer)
491 (buffer-string))))
492 (should-not
493 (string-match
494 "=2="
495 (org-test-with-temp-text "* COMMENT Headline
496 src_emacs-lisp{(+ 1 1)}"
497 (org-babel-exp-process-buffer)
498 (buffer-string))))
499 ;; Also check parent headlines.
500 (should-not
501 (string-match
502 ": 2"
503 (org-test-with-temp-text "
504 * COMMENT Headline
505 ** Children
506 #+BEGIN_SRC emacs-lisp :exports results
507 \(+ 1 1)
508 #+END_SRC"
509 (org-babel-exp-process-buffer)
510 (buffer-string))))))
512 (ert-deftest ob-export/reference-in-post-header ()
513 "Test references in :post header during export."
514 (should
515 (org-test-with-temp-text "
516 #+NAME: foo
517 #+BEGIN_SRC emacs-lisp :exports none :var bar=\"baz\"
518 (concat \"bar\" bar)
519 #+END_SRC
521 #+NAME: nofun
522 #+BEGIN_SRC emacs-lisp :exports results :post foo(\"nofun\")
523 #+END_SRC"
524 (org-babel-exp-process-buffer) t)))
526 (ert-deftest ob-export/babel-evaluate ()
527 "Test `org-export-use-babel' effect."
528 ;; When nil, no Babel code is executed.
529 (should-not
530 (string-match-p
532 (org-test-with-temp-text
533 "#+BEGIN_SRC emacs-lisp :exports results\n(+ 1 1)\n#+END_SRC"
534 (let ((org-export-use-babel nil)) (org-babel-exp-process-buffer))
535 (buffer-string))))
536 (should-not
537 (string-match-p
539 (org-test-with-temp-text
540 "src_emacs-lisp{(+ 1 1)}"
541 (let ((org-export-use-babel nil)) (org-babel-exp-process-buffer))
542 (buffer-string))))
543 ;; When non-nil, all Babel code types are executed.
544 (should
545 (string-match-p
547 (org-test-with-temp-text
548 "#+BEGIN_SRC emacs-lisp :exports results\n(+ 1 1)\n#+END_SRC"
549 (let ((org-export-use-babel t)) (org-babel-exp-process-buffer))
550 (buffer-string))))
551 (should
552 (string-match-p
554 (org-test-with-temp-text
555 "src_emacs-lisp{(+ 1 1)}"
556 (let ((org-export-use-babel t)) (org-babel-exp-process-buffer))
557 (buffer-string)))))
559 (ert-deftest ob-export/body-with-coderef ()
560 "Test exporting a code block with coderefs."
561 (should
562 (equal "#+BEGIN_SRC emacs-lisp\n0 (ref:foo)\n#+END_SRC"
563 (org-test-with-temp-text
564 "#+BEGIN_SRC emacs-lisp :exports code\n0 (ref:foo)\n#+END_SRC"
565 (let ((org-export-use-babel t)
566 (org-coderef-label-format "(ref:foo)"))
567 (org-babel-exp-process-buffer))
568 (buffer-string))))
569 (should
570 (equal
571 "#+BEGIN_SRC emacs-lisp -l \"r:%s\"\n1 r:foo\n#+END_SRC"
572 (org-test-with-temp-text
573 "#+BEGIN_SRC emacs-lisp -l \"r:%s\" -lisp :exports code\n1 r:foo\n#+END_SRC"
574 (let ((org-export-use-babel t))
575 (org-babel-exp-process-buffer))
576 (buffer-string)))))
578 (ert-deftest ob-exp/src-block-with-affiliated-keyword ()
579 "Test exporting a code block with affiliated keywords."
580 ;; Pathological case: affiliated keyword matches inline src block
581 ;; syntax.
582 (should
583 (equal "#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
584 (org-test-with-temp-text
585 "#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
586 (let ((org-export-use-babel t))
587 (org-babel-exp-process-buffer))
588 (buffer-string)))))
591 (provide 'test-ob-exp)
593 ;;; test-ob-exp.el ends here