Function: ert-results-pop-to-should-forms-for-test-at-point

ert-results-pop-to-should-forms-for-test-at-point is an interactive and byte-compiled function defined in ert.el.gz.

Signature

(ert-results-pop-to-should-forms-for-test-at-point)

Documentation

Display the list of should forms executed during the test at point.

To be used in the ERT results buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert-results-pop-to-should-forms-for-test-at-point ()
  "Display the list of `should' forms executed during the test at point.

To be used in the ERT results buffer."
  (interactive nil ert-results-mode)
  (let* ((test (ert--results-test-at-point-no-redefinition t))
         (stats ert--results-stats)
         (pos (ert--stats-test-pos stats test))
         (result (aref (ert--stats-test-results stats) pos)))
    (let ((buffer (get-buffer-create "*ERT list of should forms*")))
      (pop-to-buffer buffer)
      (let ((inhibit-read-only t))
        (buffer-disable-undo)
        (erase-buffer)
        (ert-simple-view-mode)
        (if (null (ert-test-result-should-forms result))
            (insert "\n(No should forms during this test.)\n")
          (cl-loop for form-description
                   in (ert-test-result-should-forms result)
                   for i from 1 do
                   (insert "\n")
                   (insert (format "%s: " i))
                   (let ((begin (point)))
                     (ert--pp-with-indentation-and-newline form-description)
                     (ert--make-xrefs-region begin (point)))))
        (goto-char (point-min))
        (insert (substitute-command-keys
                 "`should' forms executed during test `"))
        (ert-insert-test-name-button (ert-test-name test))
        (insert (substitute-command-keys "':\n"))
        (insert "\n")
        (insert (concat "(Values are shallow copies and may have "
                        "looked different during the test if they\n"
                        "have been modified destructively.)\n"))
        (forward-line 1)))))