Subject: Re: bug#50629: 28.0.50; hard to debug an uncaught error with ert

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 27 Aug 2022 16:29:04 +0200

Gerd Möllmann <[email-masked]> writes:

> That's what I meant with macrology.  Please macroexpand and look at
> what's actually executed.

This is what macroexpand-all says is executed:

(progn
  (ert-set-test
   'f
   (record 'ert-test 'f
	   nil #'(lambda ()
		   (defalias 'foo #'(lambda ()
				      (bar)))
		   (defalias 'bar #'(lambda ()
				      (zot)))
		   (let* ((fn-573 #'equal)
			  (args-574 (condition-case err (let ( foo)
							  (list 42 (foo)))
				      (error (progn
					       (setq fn-573 #'signal)
					       (list (car err) (cdr err)))))))
		     (let ((value-575 'ert-form-evaluation-aborted-576))
		       (let ( form-description-577)
			 (if (unwind-protect (setq value-575 (apply fn-573 args-574))
			       (setq form-description-577
				     (nconc (list '(should (equal 42 (foo))))
					    (list :form
						  (cons fn-573 args-574))
					    (if (eql value-575
						     'ert-form-evaluation-aborted-576) ()
					      (list :value value-575))
					    (if (eql value-575
						     'ert-form-evaluation-aborted-576) ()
					      (let* ((-explainer- (and t (ert--get-explainer 'equal))))
						(if -explainer- (list :explanation
								      (apply
								       -explainer-
								       args-574))
						  nil)))))
			       (ert--signal-should-execution form-description-577)) ()
			   (ert-fail form-description-577)))
		       value-575)))
	   nil
	   ':passed
	   'nil
	   nil))
  'f)

The foo->bar->zot calling sequence is preserved.