Hide or show inline Common Lisp tests written with the
testiere
testing library. M-x testiere-toggle command that collapses or
reveals the #+testiere sections.
This is how the code looks with testiere:
(defun add3 (x y z)
"Adds three numbers"
#+testiere
(:tests
(= 6 (add3 1 2 3))
(:fails (add3 "hey"))
(:fails (add3 1 2)))
(+ x y z))and this is how it looks toggled via M-x testiere-toggle:
(defun add3 (x y z)
"Adds three numbers"
#+testiere ...
(+ x y z))- Works from anywhere inside a supported
def*form (defun,defmethod,deftype,defclass,defstruct) or from the header line itself
(use-package testiere-mode
:vc (:fetcher github :repo "dotemacs/testiere-mode.el"))- Open a Common Lisp buffer that contains inline tests wrapped in a
#+testiereblock. - Place point either on the header line or anywhere inside the surrounding
defun,defmethod,deftype,defclass, ordefstructform. - Run
M-x testiere-toggle(or invoke thetestiere-toggle-testsalias). The block will collapse into a friendly comment-like overlay. - Call the command again to reveal the tests. Repeated invocations cycle between the hidden and visible states.
Attach the command to a convenient key in the Lisp modes you use most:
(with-eval-after-load 'lisp-mode
(define-key lisp-mode-map (kbd "C-c t") #'testiere-toggle))
(with-eval-after-load 'slime
(define-key slime-mode-map (kbd "C-c t") #'testiere-toggle))
(with-eval-after-load 'sly
(define-key sly-mode-map (kbd "C-c t") #'testiere-toggle))