test-ob-exp.el 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ;;; test-ob-exp.el
  2. ;; Copyright (c) 2010 Eric Schulte
  3. ;; Authors: Eric Schulte
  4. ;; Released under the GNU General Public License version 3
  5. ;; see: http://www.gnu.org/licenses/gpl-3.0.html
  6. ;;;; Comments:
  7. ;; Template test file for Org-mode tests
  8. ;;; Code:
  9. (require 'org-test)
  10. ;;; Tests
  11. (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers ()
  12. "Testing export without any headlines in the org-mode file."
  13. (org-test-in-example-file org-test-no-header-file
  14. ;; export the file to html
  15. (org-export-as-html nil)
  16. ;; should create a .html file
  17. (should (file-exists-p (concat
  18. (file-name-sans-extension org-test-no-header-file)
  19. ".html")))
  20. ;; should not create a file with "::" appended to it's name
  21. (should-not (file-exists-p (concat org-test-no-header-file "::")))))
  22. (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-file ()
  23. "Testing export from buffers which are not visiting any file."
  24. (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*"))
  25. (should-not (get-buffer "*Org HTML Export*"))
  26. ;; export the file to HTML in a temporary buffer
  27. (org-test-in-example-file nil (org-export-as-html-to-buffer nil))
  28. ;; should create a .html buffer
  29. (should (buffer-live-p (get-buffer "*Org HTML Export*")))
  30. ;; should contain the content of the buffer
  31. (save-excursion
  32. (set-buffer (get-buffer "*Org HTML Export*"))
  33. (should (string-match (regexp-quote test-org-code-block-anchor)
  34. (buffer-string))))
  35. (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*")))
  36. (provide 'test-ob-exp)
  37. ;;; test-ob-exp.el ends here