1 ;;; test-ob-lob.el --- test for ob-lob.el
3 ;; Copyright (c) 2010-2013 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/>.
25 "library-of-babel.org"
35 (or load-file-name buffer-file-name
))))))))
37 (ert-deftest test-ob-lob
/ingest
()
38 "Test the ingestion of an org-mode file."
39 (should (< 0 (org-babel-lob-ingest
40 (expand-file-name "babel.org" org-test-example-dir
)))))
42 (ert-deftest test-ob-lob
/call-with-header-arguments
()
43 "Test the evaluation of a library of babel #+call: line."
44 (org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
45 (move-beginning-of-line 1)
47 (message (buffer-substring (point-at-bol) (point-at-eol)))
48 (should (string= "testing" (org-babel-lob-execute
49 (org-babel-lob-get-info))))
51 (should (string= "testing" (caar (org-babel-lob-execute
52 (org-babel-lob-get-info)))))
54 (should (string= "testing" (org-babel-lob-execute
55 (org-babel-lob-get-info))))
57 (should (string= "testing" (caar (org-babel-lob-execute
58 (org-babel-lob-get-info)))))
60 (should (string= "testing" (org-babel-lob-execute
61 (org-babel-lob-get-info))))
63 (should (string= "testing" (caar (org-babel-lob-execute
64 (org-babel-lob-get-info)))))
65 (forward-line 1) (beginning-of-line) (forward-char 27)
66 (should (string= "testing" (org-babel-lob-execute
67 (org-babel-lob-get-info))))
68 (forward-line 1) (beginning-of-line) (forward-char 27)
69 (should (string= "testing" (caar (org-babel-lob-execute
70 (org-babel-lob-get-info)))))
71 (forward-line 1) (beginning-of-line)
72 (should (= 4 (org-babel-lob-execute (org-babel-lob-get-info))))
74 (should (string= "testing" (org-babel-lob-execute
75 (org-babel-lob-get-info))))
77 (should (string= "123" (org-babel-lob-execute (org-babel-lob-get-info))))))
79 (ert-deftest test-ob-lob
/export-lob-lines
()
80 "Test the export of a variety of library babel call lines."
81 (org-test-at-id "72ddeed3-2d17-4c7f-8192-a575d535d3fc"
82 (org-narrow-to-subtree)
83 (let ((html (org-export-as-html nil nil
'string
'body-only
)))
84 ;; check the location of each exported number
86 (insert html
) (goto-char (point-min))
87 ;; 0 should be on a line by itself
88 (should (re-search-forward "0" nil t
))
89 (should (string= "0" (buffer-substring (point-at-bol) (point-at-eol))))
90 ;; 2 should be in <code> tags
91 (should (re-search-forward "2" nil t
))
92 (should (re-search-forward (regexp-quote "</code>") (point-at-eol) t
))
93 (should (re-search-backward (regexp-quote "<code>") (point-at-bol) t
))
94 ;; 4 should not be exported
95 (should (not (re-search-forward "4" nil t
)))
96 ;; 6 should also be inline
97 (should (re-search-forward "6" nil t
))
98 (should (re-search-forward (regexp-quote "</code>") (point-at-eol) t
))
99 (should (re-search-backward (regexp-quote "<code>") (point-at-bol) t
))
100 ;; 8 should not be quoted
101 (should (re-search-forward "8" nil t
))
102 (should (not (= ?
= (char-after (point)))))
103 (should (not (= ?
= (char-before (- (point) 1)))))
105 (should (re-search-forward "10" nil t
))))))
107 (ert-deftest test-ob-lob
/do-not-eval-lob-lines-in-example-blocks-on-export
()
108 (org-test-with-temp-text-in-file "
113 (org-export-as-html nil
)))
115 (provide 'test-ob-lob
)
117 ;;; test-ob-lob.el ends here