test-ob-exp.el 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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-example-file-name
  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
  19. org-test-no-header-example-file-name)
  20. ".html")))
  21. ;; should not create a file with "::" appended to it's name
  22. (should-not (file-exists-p
  23. (concat org-test-no-header-example-file-name "::")))))
  24. (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-file ()
  25. "Testing export from buffers which are not visiting any file."
  26. (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*"))
  27. (should-not (get-buffer "*Org HTML Export*"))
  28. ;; export the file to HTML in a temporary buffer
  29. (org-test-in-example-file nil (org-export-as-html-to-buffer nil))
  30. ;; should create a .html buffer
  31. (should (buffer-live-p (get-buffer "*Org HTML Export*")))
  32. ;; should contain the content of the buffer
  33. (save-excursion
  34. (set-buffer (get-buffer "*Org HTML Export*"))
  35. (should (string-match (regexp-quote test-org-code-block-anchor)
  36. (buffer-string))))
  37. (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*")))
  38. (provide 'test-ob-exp)
  39. ;;; test-ob-exp.el ends here