[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup d5572a6 034/340: Refactoring of the cleanup code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup d5572a6 034/340: Refactoring of the cleanup code. |
Date: |
Thu, 16 Dec 2021 14:58:59 -0500 (EST) |
branch: elpa/buttercup
commit d5572a6acdcb70b16fb36c804fa984bb33382c7b
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
Refactoring of the cleanup code.
---
buttercup.el | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/buttercup.el b/buttercup.el
index 2f66314..3679ccd 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -444,12 +444,18 @@ KEYWORD can have one of the following values:
return-value)))
this-spy-function))
+(defvar buttercup--cleanup-functions nil)
+
+(defmacro buttercup--with-cleanup (&rest body)
+ `(let ((buttercup--cleanup-functions nil))
+ (unwind-protect (progn ,@body)
+ (dolist (fun buttercup--cleanup-functions)
+ (ignore-errors
+ (funcall fun))))))
+
(defun buttercup--add-cleanup (function)
- (if buttercup--current-suite
- (buttercup-after-each function)
- (setq buttercup--cleanup-forms
- (append buttercup--cleanup-forms
- (list function)))))
+ (setq buttercup--cleanup-functions
+ (cons function buttercup--cleanup-functions)))
(defun spy-calls-all (spy)
"Return the contexts of calls to SPY."
@@ -581,21 +587,16 @@ Do not change the global value.")
(funcall f))
(message "")))
-(defvar buttercup--cleanup-forms nil
- "")
-
(defun buttercup-run-spec (spec level)
- (let ((buttercup--cleanup-forms nil))
- (message "%s%s"
- (make-string (* 2 level) ?\s)
- (buttercup-spec-description spec))
- (dolist (f buttercup--before-each)
- (funcall f))
- (funcall (buttercup-spec-function spec))
- (dolist (f buttercup--cleanup-forms)
- (funcall f))
- (dolist (f buttercup--after-each)
- (funcall f))))
+ (message "%s%s"
+ (make-string (* 2 level) ?\s)
+ (buttercup-spec-description spec))
+ (buttercup--with-cleanup
+ (dolist (f buttercup--before-each)
+ (funcall f))
+ (funcall (buttercup-spec-function spec))
+ (dolist (f buttercup--after-each)
+ (funcall f))))
(defun buttercup-run-at-point ()
(let ((buttercup-suites nil)
- [nongnu] branch elpa/buttercup created (now 108d229), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e10955c 001/340: Initial commit., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 67df4b1 012/340: Remove Cask file. It's unused., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 548df0d 030/340: Spies: Other tracking properties., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b1bcedc 032/340: Add docstrings where missing., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 821cfa6 005/340: Comment separating built-in matchers from the rest., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8e30284 024/340: Disabled suites, pending specs., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 89c00aa 009/340: Makefile: Make the emacs command configurable, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7e20ff1 021/340: ROADMAP.md: New file., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 764d6aa 020/340: Tests for the it macro and buttercup-it function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d5572a6 034/340: Refactoring of the cleanup code.,
ELPA Syncer <=
- [nongnu] elpa/buttercup b75b3e9 036/340: Add a discovery test runner., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7eecb96 038/340: Remove commented-out backtrace code from buttercup.el., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3483449 045/340: Typo fix., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 84002e9 054/340: Add parent relations to specs and suites., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a7d9813 010/340: Add cl-defstruct compatibility alias., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fd70ccf 002/340: Specs are now structs., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ba40ff8 027/340: Spies: :and-return-value, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 20b87dd 031/340: Refactoring of spy-on to be more concise and DRY., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bb31c85 043/340: Edebugable., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5d369cd 007/340: Do not use emacs-snapshot from EVM, that's slow., ELPA Syncer, 2021/12/16