Function: ert-reason-for-test-result

ert-reason-for-test-result is a byte-compiled function defined in ert.el.gz.

Signature

(ert-reason-for-test-result RESULT)

Documentation

Return the reason given for RESULT, as a string.

The reason is the argument given when invoking ert-fail or ert-skip. It is output using prin1 prefixed by two spaces.

If no reason was given, or for a successful RESULT, return the empty string.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert-reason-for-test-result (result)
  "Return the reason given for RESULT, as a string.

The reason is the argument given when invoking `ert-fail' or `ert-skip'.
It is output using `prin1' prefixed by two spaces.

If no reason was given, or for a successful RESULT, return the
empty string."
  (let ((reason
         (and
          (ert-test-result-with-condition-p result)
          (cadr (ert-test-result-with-condition-condition result))))
        (print-escape-newlines t)
        (print-level 6)
        (print-length 10))
    (if reason (format "  %S" reason) "")))