From 64dc81aa5507d8c8374a8a0ddd7e404473f25916 Mon Sep 17 00:00:00 2001 From: Ola Nilsson Date: Fri, 8 Mar 2024 00:44:51 +0100 Subject: [PATCH] Do not print stacktraces for certain file load errors The stacktraces for buttercup-dynamic-binding-error and end-of-file are not interesting. --- buttercup.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buttercup.el b/buttercup.el index 15806da..8b93e29 100644 --- a/buttercup.el +++ b/buttercup.el @@ -1531,7 +1531,7 @@ current directory." (setq args (cdr args))))) (setq command-line-args-left nil) (setq failed-files-suite (make-buttercup-suite - :description "File failed to load completely: ")) + :description "File failed to load correctly:")) (dolist (dir (or dirs '("."))) (dolist (file (directory-files-recursively dir "\\`test-.*\\.el\\'\\|-tests?\\.el\\'")) @@ -1554,9 +1554,12 @@ spec and add it to FAILURE-SUITE." (cl-destructuring-bind (status description stack) (buttercup--funcall #'load file nil t) (when (eq status 'failed) + (if (memq (caadr description) + '(buttercup-dynamic-binding-error end-of-file)) + (setq stack nil) ;; Skip all of stack until load is called (while (not (eq (nth 1 (car stack)) 'load)) - (pop stack)) + (pop stack))) (buttercup-suite-add-child failure-suite (make-buttercup-spec