org-footnote: no footnote in latex fragments
[org-mode.git] / testing / lisp / test-ob-lob.el
blob60f9399c4176adb49acd260cd3ec005e53da9ec1
1 ;;; test-ob-lob.el
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
9 ;;;; Comments:
11 ;; Template test file for Org-mode tests
14 ;;; Code:
15 (let ((load-path (cons (expand-file-name
16 ".." (file-name-directory
17 (or load-file-name buffer-file-name)))
18 load-path)))
19 (require 'org-test)
20 (require 'org-test-ob-consts))
23 ;;; Tests
24 (ert-deftest test-ob-lob/ingest ()
25 "Test the ingestion of an org-mode file."
26 (should (< 0 (org-babel-lob-ingest
27 (expand-file-name "babel.org" org-test-example-dir)))))
29 (ert-deftest test-ob-lob/call-with-header-arguments ()
30 "Test the evaluation of a library of babel #+call: line."
31 (org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
32 (move-beginning-of-line 1)
33 (forward-line 6)
34 (message (buffer-substring (point-at-bol) (point-at-eol)))
35 (should (string= "testing" (org-babel-lob-execute
36 (org-babel-lob-get-info))))
37 (forward-line 1)
38 (should (string= "testing" (caar (org-babel-lob-execute
39 (org-babel-lob-get-info)))))
40 (forward-line 1)
41 (should (string= "testing" (org-babel-lob-execute
42 (org-babel-lob-get-info))))
43 (forward-line 1)
44 (should (string= "testing" (caar (org-babel-lob-execute
45 (org-babel-lob-get-info)))))
46 (forward-line 1)
47 (should (string= "testing" (org-babel-lob-execute
48 (org-babel-lob-get-info))))
49 (forward-line 1)
50 (should (string= "testing" (caar (org-babel-lob-execute
51 (org-babel-lob-get-info)))))
52 (forward-line 1) (beginning-of-line) (forward-char 27)
53 (should (string= "testing" (org-babel-lob-execute
54 (org-babel-lob-get-info))))
55 (forward-line 1) (beginning-of-line) (forward-char 27)
56 (should (string= "testing" (caar (org-babel-lob-execute
57 (org-babel-lob-get-info)))))
58 (forward-line 1) (beginning-of-line)
59 (should (= 4 (org-babel-lob-execute (org-babel-lob-get-info))))
60 (forward-line 1)
61 (should (string= "testing" (org-babel-lob-execute
62 (org-babel-lob-get-info))))
63 (forward-line 1)
64 (should (string= "123" (org-babel-lob-execute (org-babel-lob-get-info))))))
66 (ert-deftest test-ob-lob/export-lob-lines ()
67 "Test the export of a variety of library babel call lines."
68 (org-test-at-id "72ddeed3-2d17-4c7f-8192-a575d535d3fc"
69 (org-narrow-to-subtree)
70 (let ((html (org-export-as-html nil nil nil 'string 'body-only)))
71 ;; check the location of each exported number
72 (with-temp-buffer
73 (insert html) (goto-char (point-min))
74 ;; 0 should be on a line by itself
75 (should (re-search-forward "0" nil t))
76 (should (string= "0" (buffer-substring (point-at-bol) (point-at-eol))))
77 ;; 2 should be in <code> tags
78 (should (re-search-forward "2" nil t))
79 (should (re-search-forward (regexp-quote "</code>") (point-at-eol) t))
80 (should (re-search-backward (regexp-quote "<code>") (point-at-bol) t))
81 ;; 4 should not be exported
82 (should (not (re-search-forward "4" nil t)))
83 ;; 6 should also be inline
84 (should (re-search-forward "6" nil t))
85 (should (re-search-forward (regexp-quote "</code>") (point-at-eol) t))
86 (should (re-search-backward (regexp-quote "<code>") (point-at-bol) t))
87 ;; 8 should not be quoted
88 (should (re-search-forward "8" nil t))
89 (should (not (= ?= (char-after (point)))))
90 (should (not (= ?= (char-before (- (point) 1)))))
91 ;; 10 should export
92 (should (re-search-forward "10" nil t))))))
94 (provide 'test-ob-lob)
96 ;;; test-ob-lob.el ends here