test-ob-exp.el 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. (require 'org-test-ob-consts)
  11. ;;; Tests
  12. (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers ()
  13. "Testing export without any headlines in the org-mode file."
  14. (let ((html-file (concat (file-name-sans-extension org-test-no-heading-file)
  15. ".html")))
  16. (when (file-exists-p html-file) (delete-file html-file))
  17. (org-test-in-example-file org-test-no-heading-file
  18. ;; export the file to html
  19. (org-export-as-html nil))
  20. ;; should create a .html file
  21. (should (file-exists-p html-file))
  22. ;; should not create a file with "::" appended to it's name
  23. (should-not (file-exists-p (concat org-test-no-heading-file "::")))
  24. (when (file-exists-p html-file) (delete-file html-file))))
  25. (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-file ()
  26. "Testing export from buffers which are not visiting any file."
  27. (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*"))
  28. (should-not (get-buffer "*Org HTML Export*"))
  29. ;; export the file to HTML in a temporary buffer
  30. (org-test-in-example-file nil (org-export-as-html-to-buffer nil))
  31. ;; should create a .html buffer
  32. (should (buffer-live-p (get-buffer "*Org HTML Export*")))
  33. ;; should contain the content of the buffer
  34. (save-excursion
  35. (set-buffer (get-buffer "*Org HTML Export*"))
  36. (should (string-match (regexp-quote org-test-file-ob-anchor)
  37. (buffer-string))))
  38. (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*")))
  39. (ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers ()
  40. "Testing export without any headlines in the org-mode file."
  41. (let ((html-file (concat (file-name-sans-extension
  42. org-test-link-in-heading-file)
  43. ".html")))
  44. (when (file-exists-p html-file) (delete-file html-file))
  45. (org-test-in-example-file org-test-link-in-heading-file
  46. ;; export the file to html
  47. (org-export-as-html nil))
  48. ;; should create a .html file
  49. (should (file-exists-p html-file))
  50. ;; should not create a file with "::" appended to it's name
  51. (should-not (file-exists-p (concat org-test-link-in-heading-file "::")))
  52. (when (file-exists-p html-file) (delete-file html-file))))
  53. (provide 'test-ob-exp)
  54. ;;; test-ob-exp.el ends here