Function: ert--run-test-internal

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

Signature

(ert--run-test-internal TEST-EXECUTION-INFO)

Documentation

Low-level function to run a test according to TEST-EXECUTION-INFO.

This mainly sets up debugger-related bindings.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert--run-test-internal (test-execution-info)
  "Low-level function to run a test according to TEST-EXECUTION-INFO.

This mainly sets up debugger-related bindings."
  (setf (ert--test-execution-info-next-debugger test-execution-info) debugger
        (ert--test-execution-info-ert-debug-on-error test-execution-info)
        ert-debug-on-error)
  (catch 'ert--pass
    ;; For now, each test gets its own temp buffer and its own
    ;; window excursion, just to be safe.  If this turns out to be
    ;; too expensive, we can remove it.
    (with-temp-buffer
      (save-window-excursion
        ;; FIXME: Use `signal-hook-function' instead of `debugger' to
        ;; handle ert errors. Once that's done, remove
        ;; `ert--should-signal-hook'.  See Bug#24402 and Bug#11218 for
        ;; details.
        (let ((debugger (lambda (&rest args)
                          (ert--run-test-debugger test-execution-info
                                                  args)))
              (debug-on-error t)
              ;; Don't infloop if the error being called is erroring
              ;; out, and we have `debug-on-error' bound to nil inside
              ;; the test.
              (backtrace-on-error-noninteractive nil)
              (debug-on-quit t)
              ;; FIXME: Do we need to store the old binding of this
              ;; and consider it in `ert--run-test-debugger'?
              (debug-ignored-errors nil)
              (ert--infos '()))
          (funcall (ert-test-body (ert--test-execution-info-test
                                   test-execution-info))))))
    (ert-pass))
  (setf (ert--test-execution-info-result test-execution-info)
        (make-ert-test-passed))
  nil)