3 ;; Copyright (c) 2010 Eric Schulte
4 ;; Authors: Eric Schulte
6 ;; Released under the GNU General Public License version 3
7 ;; see: http://www.gnu.org/licenses/gpl-3.0.html
15 "library-of-babel.org"
25 (or load-file-name buffer-file-name
))))))))
27 (ert-deftest test-ob-lob
/ingest
()
28 "Test the ingestion of an org-mode file."
29 (should (< 0 (org-babel-lob-ingest
30 (expand-file-name "babel.org" org-test-example-dir
)))))
32 (ert-deftest test-ob-lob
/call-with-header-arguments
()
33 "Test the evaluation of a library of babel #+call: line."
34 (org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
35 (move-beginning-of-line 1)
37 (message (buffer-substring (point-at-bol) (point-at-eol)))
38 (should (string= "testing" (org-babel-lob-execute
39 (org-babel-lob-get-info))))
41 (should (string= "testing" (caar (org-babel-lob-execute
42 (org-babel-lob-get-info)))))
44 (should (string= "testing" (org-babel-lob-execute
45 (org-babel-lob-get-info))))
47 (should (string= "testing" (caar (org-babel-lob-execute
48 (org-babel-lob-get-info)))))
50 (should (string= "testing" (org-babel-lob-execute
51 (org-babel-lob-get-info))))
53 (should (string= "testing" (caar (org-babel-lob-execute
54 (org-babel-lob-get-info)))))
55 (forward-line 1) (beginning-of-line) (forward-char 27)
56 (should (string= "testing" (org-babel-lob-execute
57 (org-babel-lob-get-info))))
58 (forward-line 1) (beginning-of-line) (forward-char 27)
59 (should (string= "testing" (caar (org-babel-lob-execute
60 (org-babel-lob-get-info)))))
61 (forward-line 1) (beginning-of-line)
62 (should (= 4 (org-babel-lob-execute (org-babel-lob-get-info))))
64 (should (string= "testing" (org-babel-lob-execute
65 (org-babel-lob-get-info))))
67 (should (string= "123" (org-babel-lob-execute (org-babel-lob-get-info))))))
69 (ert-deftest test-ob-lob
/export-lob-lines
()
70 "Test the export of a variety of library babel call lines."
71 (org-test-at-id "72ddeed3-2d17-4c7f-8192-a575d535d3fc"
72 (org-narrow-to-subtree)
73 (let ((html (org-export-as-html nil nil nil
'string
'body-only
)))
74 ;; check the location of each exported number
76 (insert html
) (goto-char (point-min))
77 ;; 0 should be on a line by itself
78 (should (re-search-forward "0" nil t
))
79 (should (string= "0" (buffer-substring (point-at-bol) (point-at-eol))))
80 ;; 2 should be in <code> tags
81 (should (re-search-forward "2" nil t
))
82 (should (re-search-forward (regexp-quote "</code>") (point-at-eol) t
))
83 (should (re-search-backward (regexp-quote "<code>") (point-at-bol) t
))
84 ;; 4 should not be exported
85 (should (not (re-search-forward "4" nil t
)))
86 ;; 6 should also be inline
87 (should (re-search-forward "6" nil t
))
88 (should (re-search-forward (regexp-quote "</code>") (point-at-eol) t
))
89 (should (re-search-backward (regexp-quote "<code>") (point-at-bol) t
))
90 ;; 8 should not be quoted
91 (should (re-search-forward "8" nil t
))
92 (should (not (= ?
= (char-after (point)))))
93 (should (not (= ?
= (char-before (- (point) 1)))))
95 (should (re-search-forward "10" nil t
))))))
97 (ert-deftest test-ob-lob
/do-not-eval-lob-lines-in-example-blocks-on-export
()
98 (org-test-with-temp-text-in-file "
103 (org-export-as-html nil
)))
105 (provide 'test-ob-lob
)
107 ;;; test-ob-lob.el ends here