summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-10-04 09:21:24 -0600
committerEric Schulte <schulte.eric@gmail.com>2010-10-05 11:54:48 -0600
commitd6143f1e7aab7c9fe610f63625ee77d5314c65dd (patch)
tree17567cb6f4bf48817800568d88051cf1800e6c9e
parent49b22bb57e540b6008f5fb2889d82a31bc17bb70 (diff)
downloadorg-mode-d6143f1e7aab7c9fe610f63625ee77d5314c65dd.tar.gz
added a test ensuring that export works from buffers which aren't visiting files
-rw-r--r--testing/lisp/test-ob-exp.el16
-rw-r--r--testing/lisp/test-ob.el8
-rw-r--r--testing/org-test.el3
3 files changed, 22 insertions, 5 deletions
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 87c2b7a..b71b200 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -18,7 +18,6 @@
;;; Tests
(ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-headers ()
"Testing export without any headlines in the org-mode file."
-
(org-test-in-example-file org-test-no-header-example-file-name
;; export the file to html
(org-export-as-html nil)
@@ -31,6 +30,21 @@
(should-not (file-exists-p
(concat org-test-no-header-example-file-name "::")))))
+(ert-deftest test-ob-exp/org-babel-exp-src-blocks/w-no-file ()
+ "Testing export from buffers which are not visiting any file."
+ (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*"))
+ (should-not (get-buffer "*Org HTML Export*"))
+ ;; export the file to HTML in a temporary buffer
+ (org-test-in-example-file nil (org-export-as-html-to-buffer nil))
+ ;; should create a .html buffer
+ (should (buffer-live-p (get-buffer "*Org HTML Export*")))
+ ;; should contain the content of the buffer
+ (save-excursion
+ (set-buffer (get-buffer "*Org HTML Export*"))
+ (should (string-match (regexp-quote test-org-code-block-anchor)
+ (buffer-string))))
+ (when (get-buffer "*Org HTML Export*") (kill-buffer "*Org HTML Export*")))
+
(provide 'test-ob-exp)
;;; test-ob-exp.el ends here
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 9425f01..d433692 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -15,18 +15,18 @@
(require 'org-test)
(ert-deftest test-org-babel-get-src-block-info-language ()
- (org-test-at-marker nil "94839181-184f-4ff4-a72f-94214df6f5ba"
+ (org-test-at-marker nil test-org-code-block-anchor
(let ((info (org-babel-get-src-block-info)))
(should (string= "emacs-lisp" (nth 0 info))))))
(ert-deftest test-org-babel-get-src-block-info-body ()
- (org-test-at-marker nil "94839181-184f-4ff4-a72f-94214df6f5ba"
+ (org-test-at-marker nil test-org-code-block-anchor
(let ((info (org-babel-get-src-block-info)))
- (should (string-match (regexp-quote "94839181-184f-4ff4-a72f-94214df6f5ba")
+ (should (string-match (regexp-quote test-org-code-block-anchor)
(nth 1 info))))))
(ert-deftest test-org-babel-get-src-block-info-tangle ()
- (org-test-at-marker nil "94839181-184f-4ff4-a72f-94214df6f5ba"
+ (org-test-at-marker nil test-org-code-block-anchor
(let ((info (org-babel-get-src-block-info)))
(should (string= "no" (cdr (assoc :tangle (nth 2 info))))))))
diff --git a/testing/org-test.el b/testing/org-test.el
index 66a2f44..9d1b5a6 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -62,6 +62,9 @@ org-test searches this directory up the directory tree.")
(defconst org-test-no-header-example-file-name
(expand-file-name "example-file-no-header.org" org-test-dir))
+(defconst test-org-code-block-anchor
+ "94839181-184f-4ff4-a72f-94214df6f5ba")
+
;;; Functions for writing tests