org-test-with-temp-text allows variable inputs holding strings

* testing/org-test.el (org-test-with-temp-text): Allow variable inputs
  holding strings.
This commit is contained in:
Eric Schulte 2011-09-20 09:01:11 -06:00
parent a7d89a80fb
commit ded9f87ebc
1 changed files with 10 additions and 11 deletions

View File

@ -166,17 +166,16 @@ files."
mode holding TEXT. If the string \"<point>\" appears in TEXT mode holding TEXT. If the string \"<point>\" appears in TEXT
then remove it and place the point there before running BODY." then remove it and place the point there before running BODY."
(declare (indent 1)) (declare (indent 1))
(let ((inside-text (if (stringp text) text (eval text))))
`(with-temp-buffer `(with-temp-buffer
(org-mode) (org-mode)
,(let ((point (string-match (regexp-quote "<point>") text))) ,(let ((point (string-match (regexp-quote "<point>") inside-text)))
(if point (if point
`(progn `(progn (insert `(replace-match "" nil nil inside-text))
(insert `(replace-match "" nil nil text))
(goto-char ,(match-beginning 0))) (goto-char ,(match-beginning 0)))
`(progn `(progn (insert ,inside-text)
(insert ,text)
(goto-char (point-min))))) (goto-char (point-min)))))
,@body)) ,@body)))
;;; Navigation Functions ;;; Navigation Functions