Function: ert-run-or-rerun-test
ert-run-or-rerun-test is a byte-compiled function defined in
ert.el.gz.
Signature
(ert-run-or-rerun-test STATS TEST LISTENER)
Documentation
Run the single test TEST and record the result using STATS and LISTENER.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert-run-or-rerun-test (stats test listener)
;; checkdoc-order: nil
"Run the single test TEST and record the result using STATS and LISTENER."
(let ((ert--current-run-stats stats)
(pos (ert--stats-test-pos stats test)))
(ert--stats-set-test-and-result stats pos test nil)
;; Call listener after setting/before resetting
;; (ert--stats-current-test stats); the listener might refresh the
;; mode line display, and if the value is not set yet/any more
;; during this refresh, the mode line will flicker unnecessarily.
(setf (ert--stats-current-test stats) test)
(funcall listener 'test-started stats test)
(setf (ert-test-most-recent-result test) nil)
(setf (aref (ert--stats-test-start-times stats) pos) (current-time))
(unwind-protect
(ert-run-test test)
(setf (aref (ert--stats-test-end-times stats) pos) (current-time))
(let ((result (ert-test-most-recent-result test)))
(setf (ert-test-result-duration result)
(float-time
(time-subtract
(aref (ert--stats-test-end-times stats) pos)
(aref (ert--stats-test-start-times stats) pos))))
(ert--stats-set-test-and-result stats pos test result)
(funcall listener 'test-ended stats test result))
(setf (ert--stats-current-test stats) nil))))