summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-11-18 11:29:47 -0700
committerEric Schulte <schulte.eric@gmail.com>2011-11-18 11:30:59 -0700
commit1f206ed477bfee0993ee755161658a0649af3b78 (patch)
tree084fafceff2302b5e7b002a71b5437f583e4944f
parente28e1038c405439eb5dd656ab9b0adb9ae706272 (diff)
downloadorg-mode-1f206ed4.tar.gz
new testing macro for in-file execution with temp text
* testing/org-test.el (org-test-with-temp-text-in-file): A new testing macros for temp-text tests which require a file name (e.g., for export).
-rw-r--r--testing/org-test.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/org-test.el b/testing/org-test.el
index 81063b1..6c11bf3 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -180,6 +180,7 @@ files."
(goto-char (point-min))
(re-search-forward (regexp-quote ,marker))
,@body))
+(def-edebug-spec org-test-at-marker (form form body))
(defmacro org-test-with-temp-text (text &rest body)
"Run body in a temporary buffer with Org-mode as the active
@@ -197,6 +198,23 @@ otherwise place the point at the beginning of the inserted text."
`(progn (insert ,inside-text)
(goto-char (point-min)))))
,@body)))
+(def-edebug-spec org-test-with-temp-text (form body))
+
+(defmacro org-test-with-temp-text-in-file (text &rest body)
+ "Run body in a temporary file buffer with Org-mode as the active mode."
+ (declare (indent 1))
+ (let ((file (make-temp-file "org-test"))
+ (inside-text (if (stringp text) text (eval text)))
+ (results (gensym)))
+ `(let ((kill-buffer-query-functions nil) ,results)
+ (with-temp-file ,file (insert ,inside-text))
+ (find-file ,file)
+ (org-mode)
+ (setq ,results ,@body)
+ (save-buffer) (kill-buffer)
+ (delete-file ,file)
+ ,results)))
+(def-edebug-spec org-test-with-temp-text-in-file (form body))
;;; Navigation Functions