Function: ert-run-test
ert-run-test is a byte-compiled function defined in ert.el.gz.
Signature
(ert-run-test ERT-TEST)
Documentation
Run ERT-TEST.
Returns the result and stores it in ERT-TEST's most-recent-result slot.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert-run-test (ert-test)
"Run ERT-TEST.
Returns the result and stores it in ERT-TEST's `most-recent-result' slot."
(setf (ert-test-most-recent-result ert-test) nil)
(cl-block error
(let ((begin-marker
(with-current-buffer (messages-buffer)
(point-max-marker))))
(unwind-protect
(let ((info (make-ert--test-execution-info
:test ert-test
:result
(make-ert-test-aborted-with-non-local-exit)
:exit-continuation (lambda ()
(cl-return-from error nil))))
(should-form-accu (list)))
(unwind-protect
(let ((ert--should-execution-observer
(lambda (form-description)
(push form-description should-form-accu)))
(message-log-max t)
(ert--running-tests (cons ert-test ert--running-tests)))
(ert--run-test-internal info))
(let ((result (ert--test-execution-info-result info)))
(setf (ert-test-result-messages result)
(with-current-buffer (messages-buffer)
(buffer-substring begin-marker (point-max))))
(ert--force-message-log-buffer-truncation)
(setq should-form-accu (nreverse should-form-accu))
(setf (ert-test-result-should-forms result)
should-form-accu)
(setf (ert-test-most-recent-result ert-test) result))))
(set-marker begin-marker nil))))
(ert-test-most-recent-result ert-test))