Function: ert--expand-should
ert--expand-should is a byte-compiled function defined in ert.el.gz.
Signature
(ert--expand-should WHOLE FORM INNER-EXPANDER)
Documentation
Helper function for the should macro and its variants.
Analyzes FORM and returns an expression that has the same semantics under evaluation but records additional debugging information.
INNER-EXPANDER should be a function and is called with two
arguments: INNER-FORM and FORM-DESCRIPTION-FORM, where INNER-FORM
is an expression equivalent to FORM, and FORM-DESCRIPTION-FORM is
an expression that returns a description of FORM. INNER-EXPANDER
should return code that calls INNER-FORM and performs the checks
and error signaling specific to the particular variant of
should. The code that INNER-EXPANDER returns must not call
FORM-DESCRIPTION-FORM before it has called INNER-FORM.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert.el.gz
(defun ert--expand-should (whole form inner-expander)
"Helper function for the `should' macro and its variants.
Analyzes FORM and returns an expression that has the same
semantics under evaluation but records additional debugging
information.
INNER-EXPANDER should be a function and is called with two
arguments: INNER-FORM and FORM-DESCRIPTION-FORM, where INNER-FORM
is an expression equivalent to FORM, and FORM-DESCRIPTION-FORM is
an expression that returns a description of FORM. INNER-EXPANDER
should return code that calls INNER-FORM and performs the checks
and error signaling specific to the particular variant of
`should'. The code that INNER-EXPANDER returns must not call
FORM-DESCRIPTION-FORM before it has called INNER-FORM."
(ert--expand-should-1
whole form
(lambda (inner-form form-description-form value-var)
(let ((form-description (gensym "form-description-")))
`(let (,form-description)
,(funcall inner-expander
`(unwind-protect
,inner-form
(setq ,form-description ,form-description-form)
(ert--signal-should-execution ,form-description))
`,form-description
value-var))))))