org-habit-streaks/test/test-helper.el
2015-06-11 18:16:32 -04:00

20 lines
607 B
EmacsLisp

(require 'f)
(defvar org-habit-streaks-test-path
(f-dirname (f-this-file)))
(defvar org-habit-streaks-code-path
(f-parent org-habit-streaks-test-path))
(defvar org-habit-streaks-sandbox-path
(f-expand "sandbox" org-habit-streaks-test-path))
(require 'org-habit-streaks (f-expand "org-habit-streaks.el" org-habit-streaks-code-path))
(defmacro with-sandbox (&rest body)
"Evaluate BODY in an empty temporary directory."
`(let ((default-directory root-sandbox-path))
(when (f-dir? root-sandbox-path)
(f-delete root-sandbox-path :force))
(f-mkdir root-sandbox-path)
,@body))