Skip to content

Commit

Permalink
Add lispyville-should macro
Browse files Browse the repository at this point in the history
Just a simple syntatic transformation to make test forms more readable:

Before:
(should (string= (lispyville-with "((\n  ~|(a b)))"
                   "D")
                 "|(())"))

After:
(lispyville-should ("D")
  "((\n  ~|(a b)))"
  "|(())")
  • Loading branch information
yuhan0 committed Dec 3, 2018
1 parent a806ac8 commit f35baaf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lispyville-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ character after it is not considered as part of the region."
(yank)
(goto-char (point-max)))

(defmacro lispyville-should (body before after)
"Simple syntax transformation for readability.
Body is an unquoted list of commands to run,
or a string which is automatically wrapped in a list."
(declare (indent 1))
(when (stringp body)
(setq body (list body)))
`(should (string= (lispyville-with ,before ,@body)
,after)))

;;; Operators
(ert-deftest lispyville-yank ()
(should (string= (lispyville-with "(|a)"
Expand Down

0 comments on commit f35baaf

Please sign in to comment.