Function: ert--insert-human-readable-selector

ert--insert-human-readable-selector is a byte-compiled function defined in ert.el.gz.

Signature

(ert--insert-human-readable-selector SELECTOR)

Documentation

Insert a human-readable presentation of SELECTOR into the current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert--insert-human-readable-selector (selector)
  "Insert a human-readable presentation of SELECTOR into the current buffer."
  ;; This is needed to avoid printing the (huge) contents of the
  ;; `backtrace' slot of the result objects in the
  ;; `most-recent-result' slots of test case objects in (eql ...) or
  ;; (member ...) selectors.
  (cl-labels ((rec (selector)
                ;; This code needs to match the cases in
                ;; `ert-select-tests'.
                (pcase-exhaustive selector
                  ((or
                    ;; 'nil 't :new :failed :passed :expected :unexpected
                    (pred stringp)
                    (pred symbolp))
                   selector)
                  ((pred ert-test-p)
                   (if (ert-test-name selector)
                       (make-symbol (format "<%S>" (ert-test-name selector)))
                     (make-symbol "<unnamed test>")))
                  (`(,operator . ,operands)
                   (pcase operator
                     ((or 'member 'eql 'and 'not 'or)
                      `(,operator ,@(mapcar #'rec operands)))
                     ((or 'tag 'satisfies)
                      selector))))))
    (insert (format "%S" (rec selector)))))