lisp/org-table.el: fix table alignment
[org-mode/org-tableheadings.git] / testing / lisp / test-ob-exp.el
blobf6be51ffe8f802ba71f49dff99b45450bf907be0
1 ;;; test-ob-exp.el
3 ;; Copyright (c) 2010-2015, 2019 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\")" ";; noweb-no-start
94 <<noweb-example1>>" ";; noweb-2-yes-start
95 (message \"expanded2\")"
96 ";; noweb-tangle-start
97 <<noweb-example1>>
98 <<noweb-example2>>")
99 (org-test-at-id "eb1f6498-5bd9-45e0-9c56-50717053e7b7"
100 (org-narrow-to-subtree)
101 (org-element-map
102 (org-test-with-expanded-babel-code (org-element-parse-buffer))
103 'src-block
104 (lambda (src) (org-trim (org-element-property :value src))))))))
106 (ert-deftest ob-exp/noweb-on-export-with-exports-results ()
107 "Noweb header arguments export correctly using :exports results.
108 - yes expand on both export and tangle
109 - no expand on neither export or tangle
110 - tangle expand on only tangle not export"
111 (should
112 (equal
113 '(";; noweb-no-start
114 <<noweb-example1>>" "<<noweb-example1>>
115 <<noweb-example2>>")
116 (org-test-at-id "8701beb4-13d9-468c-997a-8e63e8b66f8d"
117 (org-narrow-to-subtree)
118 (org-element-map
119 (org-test-with-expanded-babel-code (org-element-parse-buffer))
120 'src-block
121 (lambda (src) (org-trim (org-element-property :value src))))))))
123 (ert-deftest ob-exp/exports-both ()
124 "Test the \":exports both\" header argument.
125 The code block evaluation should create both a code block and
126 a table."
127 (org-test-at-id "92518f2a-a46a-4205-a3ab-bcce1008a4bb"
128 (org-narrow-to-subtree)
129 (let ((tree (org-test-with-expanded-babel-code (org-element-parse-buffer))))
130 (should (and (org-element-map tree 'src-block 'identity)
131 (org-element-map tree 'table 'identity))))))
133 (ert-deftest ob-exp/mixed-blocks-with-exports-both ()
134 (should
135 (equal
136 '(property-drawer plain-list src-block fixed-width src-block plain-list)
137 (org-test-at-id "5daa4d03-e3ea-46b7-b093-62c1b7632df3"
138 (org-narrow-to-subtree)
139 (mapcar 'org-element-type
140 (org-element-map
141 (org-test-with-expanded-babel-code
142 (org-element-parse-buffer 'greater-element))
143 'section 'org-element-contents nil t))))))
145 (ert-deftest ob-exp/export-with-name ()
146 (should
147 (string-match
148 "=qux="
149 (let ((org-babel-exp-code-template
150 "=%name=\n#+BEGIN_SRC %lang%flags\nbody\n#+END_SRC"))
151 (org-test-at-id "b02ddd8a-eeb8-42ab-8664-8a759e6f43d9"
152 (org-narrow-to-subtree)
153 (org-test-with-expanded-babel-code
154 (buffer-string)))))))
156 (ert-deftest ob-exp/export-with-header-argument ()
157 (let ((org-babel-exp-code-template
159 | header | value |
160 |---------+----------|
161 | foo | %foo |
162 | results | %results |
163 #+BEGIN_SRC %lang%flags\nbody\n#+END_SRC"))
164 (org-test-at-id "b02ddd8a-eeb8-42ab-8664-8a759e6f43d9"
165 (org-narrow-to-subtree)
166 (org-test-with-expanded-babel-code
167 (should (string-match "baz" (buffer-string)))
168 (should (string-match "replace" (buffer-string)))))))
170 (ert-deftest ob-exp/noweb-no-export-and-exports-both ()
171 (should
172 (string-match
173 "<<noweb-no-export-and-exports-both-1>>"
174 (org-test-at-id "8a820f6c-7980-43db-8a24-0710d33729c9"
175 (org-narrow-to-subtree)
176 (org-test-with-expanded-babel-code
177 (org-element-map (org-element-parse-buffer) 'src-block
178 (lambda (src-block) (org-element-property :value src-block))
179 nil t))))))
181 (ert-deftest ob-exp/evaluate-all-executables-in-order ()
182 (should
183 (equal '(5 4 3 2 1)
184 (let ((org-export-use-babel t) *evaluation-collector*)
185 (org-test-at-id "96cc7073-97ec-4556-87cf-1f9bffafd317"
186 (org-narrow-to-subtree)
187 (buffer-string)
188 (org-test-with-expanded-babel-code *evaluation-collector*))))))
190 (ert-deftest ob-exp/exports-inline ()
191 (should
192 (string-match
193 (regexp-quote "Here is one in the middle {{{results(=1=)}}} of a line.
194 Here is one at the end of a line. {{{results(=2=)}}}
195 {{{results(=3=)}}} Here is one at the beginning of a line.")
196 (org-test-at-id "54cb8dc3-298c-4883-a933-029b3c9d4b18"
197 (org-narrow-to-subtree)
198 (let ((org-babel-inline-result-wrap "=%s="))
199 (org-test-with-expanded-babel-code (buffer-string)))))))
201 (ert-deftest ob-exp/exports-inline-code ()
202 (should
203 (equal "src_emacs-lisp[]{(+ 1 1)}"
204 (org-test-with-temp-text "src_emacs-lisp[:exports code]{(+ 1 1)}"
205 (let ((org-babel-inline-result-wrap "=%s=")
206 (org-export-use-babel t))
207 (org-babel-exp-process-buffer))
208 (buffer-string))))
209 (should
210 (equal "src_emacs-lisp[]{(+ 1 1)}"
211 (org-test-with-temp-text "src_emacs-lisp[ :exports code ]{(+ 1 1)}"
212 (let ((org-babel-inline-result-wrap "=%s=")
213 (org-export-use-babel t))
214 (org-babel-exp-process-buffer))
215 (buffer-string))))
216 (should
217 (equal "src_emacs-lisp[]{(+ 1 1)} {{{results(=2=)}}}"
218 (org-test-with-temp-text "src_emacs-lisp[:exports both]{(+ 1 1)}"
219 (let ((org-babel-inline-result-wrap "=%s=")
220 (org-export-use-babel t))
221 (org-babel-exp-process-buffer))
222 (buffer-string))))
223 (should
224 (equal "{{{results(=2=)}}}"
225 (org-test-with-temp-text
226 "src_emacs-lisp[:exports results :results scalar]{(+ 1 1)}"
227 (let ((org-babel-inline-result-wrap "=%s=")
228 (org-export-use-babel t))
229 (org-babel-exp-process-buffer))
230 (buffer-string))))
231 (should
232 (equal "foosrc_emacs-lisp[:exports code]{(+ 1 1)}"
233 (org-test-with-temp-text
234 "foosrc_emacs-lisp[:exports code]{(+ 1 1)}"
235 (let ((org-babel-inline-result-wrap "=%s=")
236 (org-export-use-babel t))
237 (org-babel-exp-process-buffer))
238 (buffer-string))))
239 (should
240 (let ((text "src_emacs lisp{(+ 1 1)}"))
241 (string-match (regexp-quote text)
242 (org-test-with-temp-text
243 text
244 (let ((org-babel-inline-result-wrap "=%s=")
245 (org-export-use-babel t))
246 (org-babel-exp-process-buffer))
247 (buffer-string)))))
248 (should
249 (string-match
250 (replace-regexp-in-string
251 "\\\\\\[]{" "\\(?:\\[]\\)?{" ;accept both src_sh[]{...} or src_sh{...}
252 (regexp-quote "Here is one in the middle src_sh[]{echo 1} of a line.
253 Here is one at the end of a line. src_sh[]{echo 2}
254 src_sh[]{echo 3} Here is one at the beginning of a line.
255 Here is one that is also evaluated: src_sh[]{echo 4} {{{results(=4=)}}}")
256 nil t)
257 (org-test-at-id "cd54fc88-1b6b-45b6-8511-4d8fa7fc8076"
258 (org-narrow-to-subtree)
259 (let ((org-babel-inline-result-wrap "=%s=")
260 (org-export-use-babel t))
261 (org-test-with-expanded-babel-code (buffer-string)))))))
263 (ert-deftest ob-exp/exports-inline-code-double-eval ()
264 "Based on default header arguments for inline code blocks (:exports
265 results), the resulting code block `src_emacs-lisp{2}' should also be
266 evaluated."
267 (let ((org-babel-inline-result-wrap "=%s=")
268 (org-export-use-babel t))
269 (should
270 (string-match "\\`{{{results(src_emacs-lisp\\[\\]{2})}}}$"
271 (org-test-with-temp-text
272 "src_emacs-lisp[:exports results :results code]{(+ 1 1)}"
273 (org-babel-exp-process-buffer)
274 (buffer-string))))))
276 (ert-deftest ob-exp/exports-inline-code-eval-code-once ()
277 "Ibid above, except that the resulting inline code block should not
278 be evaluated."
279 (let ((org-export-use-babel t))
280 (should
281 (string-match "{{{results(src_emacs-lisp\\(?:\\[[: a-zA-Z]+]\\)?{2})}}}$"
282 (org-test-with-temp-text
283 (concat "src_emacs-lisp[:exports results :results code "
284 ":results_switches \":exports code\"]{(+ 1 1)}")
285 (org-babel-exp-process-buffer)
286 (buffer-string))))))
288 (ert-deftest ob-exp/exports-inline-code-double-eval-exports-both ()
289 (let ((org-export-use-babel t))
290 (should
291 (string-match (concat "\\`src_emacs-lisp\\(?:\\[]\\)?{(\\+ 1 1)} "
292 "{{{results(src_emacs-lisp\\[ :exports code\\]{2})}}}$")
293 (org-test-with-temp-text
294 (concat "src_emacs-lisp[:exports both :results code "
295 ":results_switches \":exports code\"]{(+ 1 1)}")
296 (org-babel-exp-process-buffer)
297 (buffer-string))))))
299 (ert-deftest ob-exp/export-call-line-information ()
300 (org-test-at-id "bec63a04-491e-4caa-97f5-108f3020365c"
301 (org-narrow-to-subtree)
302 (let ((org-babel-exp-call-line-template "\n: call: %line special-token"))
303 (org-test-with-expanded-babel-code
304 (should (string-match "double" (buffer-string)))
305 (should (string-match "16" (buffer-string)))
306 (should (string-match "special-token" (buffer-string)))))))
308 (ert-deftest ob-exp/noweb-strip-export-ensure-strips ()
309 (org-test-at-id "8e7bd234-99b2-4b14-8cd6-53945e409775"
310 (org-narrow-to-subtree)
311 (org-babel-next-src-block 2)
312 (should (= 110 (org-babel-execute-src-block)))
313 (let ((result (org-test-with-expanded-babel-code (buffer-string))))
314 (should-not (string-match (regexp-quote "<<strip-export-1>>") result))
315 (should-not (string-match (regexp-quote "i=\"10\"") result)))))
317 (ert-deftest ob-exp/use-case-of-reading-entry-properties ()
318 (org-test-at-id "cc5fbc20-bca5-437a-a7b8-2b4d7a03f820"
319 (org-narrow-to-subtree)
320 (let* ((case-fold-search nil)
321 (result (org-test-with-expanded-babel-code (buffer-string)))
322 (sect "a:1, b:0, c:3, d:0, e:0")
323 (sub0 "a:1, b:2, c:4, d:0, e:0")
324 (sub1 "a:1, b:2, c:5, d:0, e:6")
325 (func sub0))
326 ;; entry "section"
327 (should (string-match (concat "_shell-sect-call\n: shell " sect "\n")
328 result))
329 (should (string-match (concat "_elisp-sect-call\n: elisp " sect "\n")
330 result))
331 (should (string-match (concat "\n- sect inline shell " sect "\n")
332 result))
333 (should (string-match (concat "\n- sect inline elisp " sect "\n")
334 result))
335 ;; entry "subsection", call without arguments
336 (should (string-match (concat "_shell-sub0-call\n: shell " sub0 "\n")
337 result))
338 (should (string-match (concat "_elisp-sub0-call\n: elisp " sub0 "\n")
339 result))
340 (should (string-match (concat "\n- sub0 inline shell " sub0 "\n")
341 result))
342 (should (string-match (concat "\n- sub0 inline elisp " sub0 "\n")
343 result))
344 ;; entry "subsection", call with arguments
345 (should (string-match (concat "_shell-sub1-call\n: shell " sub1 "\n")
346 result))
347 (should (string-match (concat "_elisp-sub1-call\n: elisp " sub1 "\n")
348 result))
349 (should (string-match (concat "\n- sub1 inline shell " sub1 "\n")
350 result))
351 (should (string-match (concat "\n- sub1 inline elisp " sub1 "\n")
352 result))
353 ;; entry "function definition"
354 (should (string-match (concat "_location_shell\n: shell " func "\n")
355 result))
356 (should (string-match (concat "_location_elisp\n: elisp " func "\n")
357 result)))))
359 (ert-deftest ob-exp/export-from-a-temp-buffer ()
360 (let ((org-export-use-babel t))
361 (org-test-with-temp-text
363 #+Title: exporting from a temporary buffer
365 #+name: foo
366 #+BEGIN_SRC emacs-lisp
367 :foo
368 #+END_SRC
370 #+name: bar
371 #+BEGIN_SRC emacs-lisp
372 :bar
373 #+END_SRC
375 #+BEGIN_SRC emacs-lisp :var foo=foo :noweb yes :exports results
376 (list foo <<bar>>)
377 #+END_SRC
379 (let* ((ascii (org-export-as 'ascii)))
380 (should (string-match
381 (regexp-quote " :foo :bar \n")
382 ascii))))))
384 (ert-deftest ob-export/export-with-results-before-block ()
385 "Test export when results are inserted before source block."
386 (let ((org-export-use-babel t))
387 (should
388 (equal
389 "#+RESULTS: src1
392 #+NAME: src1
393 #+BEGIN_SRC emacs-lisp
394 \(+ 1 1)
395 #+END_SRC"
396 (org-test-with-temp-text
397 "#+RESULTS: src1
399 #+NAME: src1
400 #+BEGIN_SRC emacs-lisp :exports both
401 \(+ 1 1)
402 #+END_SRC"
403 (org-babel-exp-process-buffer)
404 (org-trim (org-no-properties (buffer-string))))))))
406 (ert-deftest ob-export/export-src-block-with-switches ()
407 "Test exporting a source block with switches."
408 (should
409 (string-match
410 "\\`#\\+BEGIN_SRC emacs-lisp -n -r$"
411 (org-test-with-temp-text
412 "#+BEGIN_SRC emacs-lisp -n -r\n\(+ 1 1)\n#+END_SRC"
413 (org-babel-exp-process-buffer)
414 (buffer-string)))))
416 (ert-deftest ob-export/export-src-block-with-flags ()
417 "Test exporting a source block with a flag."
418 (should
419 (string-match
420 "\\`#\\+BEGIN_SRC emacs-lisp -some-flag$"
421 (org-test-with-temp-text
422 "#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
423 (org-babel-exp-process-buffer)
424 (buffer-string)))))
426 (ert-deftest ob-export/export-and-indentation ()
427 "Test indentation of evaluated source blocks during export."
428 ;; No indentation.
429 (should
430 (string-match
431 "^t"
432 (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n t\n#+END_SRC"
433 (let ((indent-tabs-mode t)
434 (tab-width 1)
435 (org-src-preserve-indentation nil))
436 (org-babel-exp-process-buffer)
437 (buffer-string)))))
438 ;; Preserve indentation with "-i" flag.
439 (should
440 (string-match
441 "^ t"
442 (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp -i\n t\n#+END_SRC"
443 (let ((indent-tabs-mode t)
444 (tab-width 1))
445 (org-babel-exp-process-buffer)
446 (buffer-string)))))
447 ;; Preserve indentation with a non-nil
448 ;; `org-src-preserve-indentation'.
449 (should
450 (string-match
451 "^ t"
452 (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n t\n#+END_SRC"
453 (let ((indent-tabs-mode t)
454 (tab-width 1)
455 (org-src-preserve-indentation t))
456 (org-babel-exp-process-buffer)
457 (buffer-string))))))
459 (ert-deftest ob-export/export-under-commented-headline ()
460 "Test evaluation of code blocks under COMMENT headings."
461 (let ((org-export-use-babel t)
462 (org-babel-inline-result-wrap "=%s="))
463 ;; Do not eval block in a commented headline.
464 (should
465 (string-match
466 ": 2"
467 (org-test-with-temp-text "* Headline
468 #+BEGIN_SRC emacs-lisp :exports results
469 \(+ 1 1)
470 #+END_SRC"
471 (org-babel-exp-process-buffer)
472 (buffer-string))))
473 (should-not
474 (string-match
475 ": 2"
476 (org-test-with-temp-text "* COMMENT Headline
477 #+BEGIN_SRC emacs-lisp :exports results
478 \(+ 1 1)
479 #+END_SRC"
480 (org-babel-exp-process-buffer)
481 (buffer-string))))
482 ;; Do not eval inline blocks either.
483 (should
484 (string-match
485 "=2="
486 (org-test-with-temp-text "* Headline
487 src_emacs-lisp{(+ 1 1)}"
488 (org-babel-exp-process-buffer)
489 (buffer-string))))
490 (should-not
491 (string-match
492 "=2="
493 (org-test-with-temp-text "* COMMENT Headline
494 src_emacs-lisp{(+ 1 1)}"
495 (org-babel-exp-process-buffer)
496 (buffer-string))))
497 ;; Also check parent headlines.
498 (should-not
499 (string-match
500 ": 2"
501 (org-test-with-temp-text "
502 * COMMENT Headline
503 ** Children
504 #+BEGIN_SRC emacs-lisp :exports results
505 \(+ 1 1)
506 #+END_SRC"
507 (org-babel-exp-process-buffer)
508 (buffer-string))))))
510 (ert-deftest ob-export/reference-in-post-header ()
511 "Test references in :post header during export."
512 (should
513 (org-test-with-temp-text "
514 #+NAME: foo
515 #+BEGIN_SRC emacs-lisp :exports none :var bar=\"baz\"
516 (concat \"bar\" bar)
517 #+END_SRC
519 #+NAME: nofun
520 #+BEGIN_SRC emacs-lisp :exports results :post foo(\"nofun\")
521 #+END_SRC"
522 (org-babel-exp-process-buffer) t)))
524 (ert-deftest ob-export/babel-evaluate ()
525 "Test `org-export-use-babel' effect."
526 ;; When nil, no Babel code is executed.
527 (should-not
528 (string-match-p
530 (org-test-with-temp-text
531 "#+BEGIN_SRC emacs-lisp :exports results\n(+ 1 1)\n#+END_SRC"
532 (let ((org-export-use-babel nil)) (org-babel-exp-process-buffer))
533 (buffer-string))))
534 (should-not
535 (string-match-p
537 (org-test-with-temp-text
538 "src_emacs-lisp{(+ 1 1)}"
539 (let ((org-export-use-babel nil)) (org-babel-exp-process-buffer))
540 (buffer-string))))
541 ;; When non-nil, all Babel code types are executed.
542 (should
543 (string-match-p
545 (org-test-with-temp-text
546 "#+BEGIN_SRC emacs-lisp :exports results\n(+ 1 1)\n#+END_SRC"
547 (let ((org-export-use-babel t)) (org-babel-exp-process-buffer))
548 (buffer-string))))
549 (should
550 (string-match-p
552 (org-test-with-temp-text
553 "src_emacs-lisp{(+ 1 1)}"
554 (let ((org-export-use-babel t)) (org-babel-exp-process-buffer))
555 (buffer-string)))))
557 (ert-deftest ob-export/body-with-coderef ()
558 "Test exporting a code block with coderefs."
559 (should
560 (equal "#+BEGIN_SRC emacs-lisp\n0 (ref:foo)\n#+END_SRC"
561 (org-test-with-temp-text
562 "#+BEGIN_SRC emacs-lisp :exports code\n0 (ref:foo)\n#+END_SRC"
563 (let ((org-export-use-babel t)
564 (org-coderef-label-format "(ref:foo)"))
565 (org-babel-exp-process-buffer))
566 (buffer-string))))
567 (should
568 (equal
569 "#+BEGIN_SRC emacs-lisp -l \"r:%s\"\n1 r:foo\n#+END_SRC"
570 (org-test-with-temp-text
571 "#+BEGIN_SRC emacs-lisp -l \"r:%s\" -lisp :exports code\n1 r:foo\n#+END_SRC"
572 (let ((org-export-use-babel t))
573 (org-babel-exp-process-buffer))
574 (buffer-string)))))
576 (ert-deftest ob-exp/src-block-with-affiliated-keyword ()
577 "Test exporting a code block with affiliated keywords."
578 ;; Pathological case: affiliated keyword matches inline source block
579 ;; syntax.
580 (should
581 (equal "#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
582 (org-test-with-temp-text
583 "#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
584 (let ((org-export-use-babel t))
585 (org-babel-exp-process-buffer))
586 (buffer-string)))))
589 (provide 'test-ob-exp)
591 ;;; test-ob-exp.el ends here