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
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

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)
(save-mark-and-excursion `(ert-skip ,(plist-get plist :skip))
(save-window-excursion `(with-temp-buffer
,@body)))))) (save-mark-and-excursion
(save-window-excursion
,@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.