Function: ert-with-test-buffer

ert-with-test-buffer is a macro defined in ert-x.el.gz.

Signature

(ert-with-test-buffer (&key ((:name NAME-FORM) nil)) &body BODY)

Documentation

Create a test buffer and run BODY in that buffer.

To be used in ERT tests. If BODY finishes successfully, the test buffer is killed; if there is an error, the test buffer is kept around for further inspection. Its name is derived from the name of the test and the result of NAME-FORM.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-x.el.gz
(cl-defmacro ert-with-test-buffer ((&key ((:name name-form)))
                                   &body body)
  "Create a test buffer and run BODY in that buffer.

To be used in ERT tests.  If BODY finishes successfully, the test
buffer is killed; if there is an error, the test buffer is kept
around for further inspection.  Its name is derived from
the name of the test and the result of NAME-FORM."
  (declare (debug ((":name" form) def-body))
           (indent 1))
  `(ert--call-with-test-buffer ,name-form (lambda () ,@body)))