Function: ert-test-result-type-p
ert-test-result-type-p is a byte-compiled function defined in
ert.el.gz.
Signature
(ert-test-result-type-p RESULT RESULT-TYPE)
Documentation
Return non-nil if RESULT matches type RESULT-TYPE.
Valid result types:
nil -- Never matches.
t -- Always matches.
:failed, :passed, :skipped -- Matches corresponding results.
(and TYPES...) -- Matches if all TYPES match.
(or TYPES...) -- Matches if some TYPES match.
(not TYPE) -- Matches if TYPE does not match.
(satisfies PREDICATE) -- Matches if PREDICATE returns true when called with
RESULT.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
;;; Test selectors.
(defun ert-test-result-type-p (result result-type)
"Return non-nil if RESULT matches type RESULT-TYPE.
Valid result types:
nil -- Never matches.
t -- Always matches.
:failed, :passed, :skipped -- Matches corresponding results.
\(and TYPES...) -- Matches if all TYPES match.
\(or TYPES...) -- Matches if some TYPES match.
\(not TYPE) -- Matches if TYPE does not match.
\(satisfies PREDICATE) -- Matches if PREDICATE returns true when called with
RESULT."
;; It would be easy to add `member' and `eql' types etc., but I
;; haven't bothered yet.
(pcase-exhaustive result-type
('nil nil)
('t t)
(:failed (ert-test-failed-p result))
(:passed (ert-test-passed-p result))
(:skipped (ert-test-skipped-p result))
(`(,operator . ,operands)
(cl-ecase operator
(and
(cl-case (length operands)
(0 t)
(t
(and (ert-test-result-type-p result (car operands))
(ert-test-result-type-p result `(and ,@(cdr operands)))))))
(or
(cl-case (length operands)
(0 nil)
(t
(or (ert-test-result-type-p result (car operands))
(ert-test-result-type-p result `(or ,@(cdr operands)))))))
(not
(cl-assert (eql (length operands) 1))
(not (ert-test-result-type-p result (car operands))))
(satisfies
(cl-assert (eql (length operands) 1))
(funcall (car operands) result))))))