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
11 ;; Template test file for Org-mode tests
15 (let ((load-path (cons (expand-file-name
16 ".." (file-name-directory
17 (or load-file-name buffer-file-name
)))
20 (require 'org-test-ob-consts
))
24 (ert-deftest test-ob-exp
/org-babel-exp-src-blocks
/w-no-headers
()
25 "Testing export without any headlines in the org-mode file."
26 (let ((html-file (concat (file-name-sans-extension org-test-no-heading-file
)
28 (when (file-exists-p html-file
) (delete-file html-file
))
29 (org-test-in-example-file org-test-no-heading-file
30 ;; export the file to html
31 (org-export-as-html nil
))
32 ;; should create a .html file
33 (should (file-exists-p html-file
))
34 ;; should not create a file with "::" appended to it's name
35 (should-not (file-exists-p (concat org-test-no-heading-file
"::")))
36 (when (file-exists-p html-file
) (delete-file html-file
))))
38 (ert-deftest test-ob-exp
/org-babel-exp-src-blocks
/w-no-file
()
39 "Testing export from buffers which are not visiting any file."
40 (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*"))
41 (should-not (get-buffer "*Org HTML Export*"))
42 ;; export the file to HTML in a temporary buffer
43 (org-test-in-example-file nil
(org-export-as-html-to-buffer nil
))
44 ;; should create a .html buffer
45 (should (buffer-live-p (get-buffer "*Org HTML Export*")))
46 ;; should contain the content of the buffer
48 (set-buffer (get-buffer "*Org HTML Export*"))
49 (should (string-match (regexp-quote org-test-file-ob-anchor
)
51 (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*")))
53 (ert-deftest test-ob-exp
/org-babel-exp-src-blocks
/w-no-headers
()
54 "Testing export without any headlines in the org-mode file."
55 (let ((html-file (concat (file-name-sans-extension
56 org-test-link-in-heading-file
)
58 (when (file-exists-p html-file
) (delete-file html-file
))
59 (org-test-in-example-file org-test-link-in-heading-file
60 ;; export the file to html
61 (org-export-as-html nil
))
62 ;; should create a .html file
63 (should (file-exists-p html-file
))
64 ;; should not create a file with "::" appended to it's name
65 (should-not (file-exists-p (concat org-test-link-in-heading-file
"::")))
66 (when (file-exists-p html-file
) (delete-file html-file
))))
69 ;; (ert-deftest ob-exp/noweb-on-export ()
70 ;; "Noweb header arguments export correctly.
71 ;; - yes expand on both export and tangle
72 ;; - no expand on neither export or tangle
73 ;; - tangle expand on only tangle not export"
75 ;; (org-test-at-id "eb1f6498-5bd9-45e0-9c56-50717053e7b7"
76 ;; (org-narrow-to-subtree)
79 ;; (mapcar (lambda (x)
81 ;; (org-export-as-html nil
85 ;; '("yes" "no" "tangle"))))))
88 ;; TODO Test broken (args-out-of-range 1927 3462)
89 ;; (ert-deftest ob-exp/exports-both ()
90 ;; "Test the :exports both header argument.
91 ;; The code block should create both <pre></pre> and <table></table>
92 ;; elements in the final html."
94 ;; (org-test-at-id "92518f2a-a46a-4205-a3ab-bcce1008a4bb"
95 ;; (org-narrow-to-subtree)
96 ;; (setq html (org-export-as-html nil nil nil 'string))
97 ;; (should (string-match "<pre.*>[^\000]*</pre>" html))
98 ;; (should (string-match "<table.*>[^\000]*</table>" html)))))
100 ;; TODO Test Broken - causes ert to go off into the weeds
101 ;; (ert-deftest ob-exp/export-subtree ()
102 ;; (org-test-at-id "5daa4d03-e3ea-46b7-b093-62c1b7632df3"
103 ;; (org-mark-subtree)
104 ;; (org-export-as-latex nil)))
106 (provide 'test-ob-exp
)
108 ;;; test-ob-exp.el ends here