Function: ert-font-lock-deftest

ert-font-lock-deftest is an autoloaded macro defined in ert-font-lock.el.gz.

Signature

(ert-font-lock-deftest NAME [DOCSTRING] [:expected-result RESULT-TYPE] [:tags '(TAG...)] MAJOR-MODE TEST-STR)

Documentation

Define test NAME (a symbol) using assertions from TEST-STR.

The MAJOR-MODE symbol determines the syntax and font lock of TEST-STR.

Except for the MAJOR-MODE and TEST-STR parameters, this macro accepts the same arguments and keywords as ert-deftest and is intended to be used through ert.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-font-lock.el.gz
;;;###autoload
(defmacro ert-font-lock-deftest (name &rest docstring-keys-mode-and-str)
  "Define test NAME (a symbol) using assertions from TEST-STR.

The MAJOR-MODE symbol determines the syntax and font lock of TEST-STR.

Except for the MAJOR-MODE and TEST-STR parameters, this macro accepts
the same arguments and keywords as `ert-deftest' and is intended to be
used through `ert'.

\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
[:tags \\='(TAG...)] MAJOR-MODE TEST-STR)"
  (declare (debug (&define [&name "test@" symbolp]
                           [&optional stringp]
                           [&rest keywordp sexp]
                           symbolp
                           stringp))
           (doc-string 2)
           (indent 1))
  (pcase-let ((`(,documentation ,keys ,mode ,arg)
               (ert-font-lock--parse-macro-args docstring-keys-mode-and-str)))

    `(ert-set-test ',name
                   (make-ert-test
                    :name ',name
                    ,@(when documentation
                        `(:documentation ,documentation))
                    ,@(when (map-contains-key keys :expected-result)
                        `(:expected-result-type ,(map-elt keys :expected-result)))
                    ,@(when (map-contains-key keys :tags)
                        `(:tags ,(map-elt keys :tags)))
                    :body (lambda ()
                            (ert-font-lock--test-body-str ',mode ,arg ',name))
                    :file-name ,(or (macroexp-file-name) buffer-file-name)))))