[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup e62ce43 207/340: test: Do not leak functions fro
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup e62ce43 207/340: test: Do not leak functions from "The Spy " test suite |
Date: |
Thu, 16 Dec 2021 14:59:35 -0500 (EST) |
branch: elpa/buttercup
commit e62ce43cd30fce53d2d90f9d15f5d7dd4b7f240e
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
test: Do not leak functions from "The Spy " test suite
The (symbol-function test-function) cannot be lexically bound, but
equivalent behaviour can be acheived using before-all and after-all.
---
tests/test-buttercup.el | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 06dcce4..e99a964 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -613,16 +613,27 @@
;;; Spies
(describe "The Spy "
- (let (test-function)
+ (let (saved-test-function saved-test-command)
;; We use `before-all' here because some tests need to access the
;; same function as previous tests in order to work, so overriding
;; the function before each test would invalidate those tests.
(before-all
+ (setq saved-test-function (and (fboundp 'test-function)
+ (symbol-function 'test-function))
+ saved-test-command (and (fboundp 'test-command)
+ (symbol-function 'test-command)))
(fset 'test-function (lambda (a b)
(+ a b)))
(fset 'test-command (lambda ()
(interactive)
t)))
+ (after-all
+ (if saved-test-function
+ (fset 'test-function saved-test-function)
+ (fmakunbound 'test-function))
+ (if saved-test-command
+ (fset 'test-command saved-test-command)
+ (fmakunbound 'test-command)))
(describe "`spy-on' function"
(it "replaces a symbol's function slot"
- [nongnu] elpa/buttercup f3d6709 074/340: Use relative path when testing for dotfiles in current project, (continued)
- [nongnu] elpa/buttercup f3d6709 074/340: Use relative path when testing for dotfiles in current project, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup acccc0f 179/340: Modify xdescribe to keep all contained specs as pending, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d07dbf3 182/340: Merge pull request #129 from snogge/fix-obsolete-aliases, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 079ef3e 186/340: Bump version: 1.12 → 1.13, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1998ae3 188/340: Drop unused variable in buttercup--disable-specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup edcffde 189/340: Add start and end times to each suite or spec, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 075b318 198/340: Add support for :var*, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1c762a5 200/340: Add documentation for :var and :var*, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 159fe3c 203/340: Really fix the buttercup-run tests, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d2b6692 206/340: Bump version: 1.16 → 1.17, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e62ce43 207/340: test: Do not leak functions from "The Spy " test suite,
ELPA Syncer <=
- [nongnu] elpa/buttercup 8b3cfad 214/340: Update test for new warning capture suppression behavior, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1567c03 215/340: Add emacs-26.3 to CI config, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6cf8041 229/340: Update writing-tests.md to describe new spy context structs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c720cef 233/340: Merge pull request #146 from DarwinAwardWinner/spy-record-errors, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b2edd35 235/340: Change: (buttercup-define-matcher-for-binary-function) Add newlines, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 818c150 239/340: docs: Clarify the difference between :var and `let', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d8ab09d 244/340: Update documentation for the --pattern option in running-tests.md, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup adba24e 246/340: Bump version: 1.19 → 1.20, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e7e5d22 248/340: Add an option to immediately abort Buttercup run if a test fails, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup dcc2638 249/340: Revert "Add an option to immediately abort Buttercup run if a test fails", ELPA Syncer, 2021/12/16