Fix :skip property in def-test!

This commit is contained in:
Henrik Lissner
2018-01-03 19:59:15 -05:00
parent b7d21fb256
commit 4d51a1ab09

View File

@ -76,10 +76,9 @@ If neither is available, run all tests in all enabled modules."
(declare (indent defun) (doc-string 2)) (declare (indent defun) (doc-string 2))
(let (plist) (let (plist)
(while (keywordp (car body)) (while (keywordp (car body))
(push (pop body) plist)
(push (pop body) plist)) (push (pop body) plist))
(setq plist (reverse plist)) (setq plist (reverse plist))
(when (plist-get plist :skip)
(setq body `((ert-skip nil) ,@body)))
(when-let* ((modes (doom-enlist (plist-get plist :minor-mode)))) (when-let* ((modes (doom-enlist (plist-get plist :minor-mode))))
(dolist (mode modes) (dolist (mode modes)
(setq body `((with-minor-mode!! ,mode ,@body))))) (setq body `((with-minor-mode!! ,mode ,@body)))))
@ -94,10 +93,12 @@ If neither is available, run all tests in all enabled modules."
do (setq path (replace-regexp-in-string rep with path t t)) do (setq path (replace-regexp-in-string rep with path t t))
finally return (intern (format "%s::%s" path name))) finally return (intern (format "%s::%s" path name)))
() ()
(with-temp-buffer ,(if (plist-get plist :skip)
`(ert-skip ,(plist-get plist :skip))
`(with-temp-buffer
(save-mark-and-excursion (save-mark-and-excursion
(save-window-excursion (save-window-excursion
,@body)))))) ,@body)))))))
(defmacro should-buffer!! (initial expected &rest body) (defmacro should-buffer!! (initial expected &rest body)
"Test that a buffer with INITIAL text, run BODY, then test it against EXPECTED. "Test that a buffer with INITIAL text, run BODY, then test it against EXPECTED.