Conform unit test macros to naming scheme
This commit is contained in:
parent
fd11f958f9
commit
c9a878a62f
2 changed files with 12 additions and 12 deletions
|
@ -82,7 +82,7 @@ If neither is available, run all tests in all enabled modules."
|
|||
(setq body `((ert-skip nil) ,@body)))
|
||||
(when-let* ((modes (doom-enlist (plist-get plist :minor-mode))))
|
||||
(dolist (mode modes)
|
||||
(setq body `((with-minor-mode! ,mode ,@body)))))
|
||||
(setq body `((with-minor-mode!! ,mode ,@body)))))
|
||||
(when-let* ((before (plist-get plist :before)))
|
||||
(setq body `(,@before ,@body)))
|
||||
(when-let* ((after (plist-get plist :after)))
|
||||
|
@ -99,7 +99,7 @@ If neither is available, run all tests in all enabled modules."
|
|||
(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.
|
||||
|
||||
INITIAL will recognize cursor markers in the form {[0-9]}. A {0} marker marks
|
||||
|
@ -127,7 +127,7 @@ against."
|
|||
(lambda (m1 m2) (< (marker-position m1)
|
||||
(marker-position m2))))
|
||||
(when (equal (caar marker-list) "0")
|
||||
(goto-char! 0)))
|
||||
(goto-char!! 0)))
|
||||
,@body
|
||||
(let ((result-text (buffer-substring-no-properties (point-min) (point-max)))
|
||||
(point (point))
|
||||
|
@ -145,20 +145,20 @@ against."
|
|||
(should (equal expected-text result-text))
|
||||
(should same-point)))))))
|
||||
|
||||
(defmacro goto-char! (index)
|
||||
"Meant to be used with `should-buffer!'. Will move the cursor to one of the
|
||||
cursor markers. e.g. Go to marker {2} with (goto-char! 2)."
|
||||
`(goto-char (point! ,index)))
|
||||
(defmacro goto-char!! (index)
|
||||
"Meant to be used with `should-buffer!!'. Will move the cursor to one of the
|
||||
cursor markers. e.g. Go to marker {2} with (goto-char!! 2)."
|
||||
`(goto-char (point!! ,index)))
|
||||
|
||||
(defmacro point! (index)
|
||||
"Meant to be used with `should-buffer!'. Returns the position of a cursor
|
||||
marker. e.g. {2} can be retrieved with (point! 2)."
|
||||
(defmacro point!! (index)
|
||||
"Meant to be used with `should-buffer!!'. Returns the position of a cursor
|
||||
marker. e.g. {2} can be retrieved with (point!! 2)."
|
||||
`(cdr (assoc ,(cond ((numberp index) (number-to-string index))
|
||||
((symbolp index) (symbol-name index))
|
||||
((stringp index) index))
|
||||
marker-list)))
|
||||
|
||||
(defmacro with-minor-mode! (mode &rest body)
|
||||
(defmacro with-minor-mode!! (mode &rest body)
|
||||
"TODO"
|
||||
(declare (indent defun))
|
||||
`(progn (,mode +1)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;;; lang/org/test/autoload-org.el
|
||||
|
||||
(defmacro should-org-buffer!! (source expected &rest body)
|
||||
`(should-buffer! ,source ,expected
|
||||
`(should-buffer!! ,source ,expected
|
||||
(org-mode)
|
||||
,@body))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue