From f35baaf59bb0e4e6f2fcced878955c65be1f8c1e Mon Sep 17 00:00:00 2001 From: yuhan0 Date: Tue, 20 Nov 2018 15:20:27 +0800 Subject: [PATCH] Add lispyville-should macro 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)))" "|(())") --- lispyville-test.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lispyville-test.el b/lispyville-test.el index c7b1821..ee5627b 100644 --- a/lispyville-test.el +++ b/lispyville-test.el @@ -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)"