Function: ert-set-test

ert-set-test is a byte-compiled function defined in ert.el.gz.

Signature

(ert-set-test SYMBOL DEFINITION)

Documentation

Make SYMBOL name the test DEFINITION, and return DEFINITION.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert-set-test (symbol definition)
  "Make SYMBOL name the test DEFINITION, and return DEFINITION."
  (when (eq symbol 'nil)
    ;; We disallow nil since `ert-test-at-point' and related functions
    ;; want to return a test name, but also need an out-of-band value
    ;; on failure.  Nil is the most natural out-of-band value; using 0
    ;; or "" or signaling an error would be too awkward.
    ;;
    ;; Note that nil is still a valid value for the `name' slot in
    ;; ert-test objects.  It designates an anonymous test.
    (error "Attempt to define a test named nil"))
  (when (and noninteractive (get symbol 'ert--test))
    ;; Make sure duplicated tests are discovered since the older test would
    ;; be ignored silently otherwise.
    (error "Test `%s' redefined (or loaded twice)" symbol))
  (define-symbol-prop symbol 'ert--test definition)
  definition)