[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 25bc00d 273/340: test: Set up suite "The batch r
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 25bc00d 273/340: test: Set up suite "The batch reporter" to use fake terminal |
Date: |
Thu, 16 Dec 2021 14:59:49 -0500 (EST) |
branch: elpa/buttercup
commit 25bc00d99a08c95569461e259366997d16b9ab07
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
test: Set up suite "The batch reporter" to use fake terminal
Use a spy to mock send-string-to-terminal with
send-string-to-ansi-buffer, storing output in a temporary buffer. The
temporary buffer is created and killed in the before-each and
after-each blocks.
---
tests/test-buttercup.el | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 2719a37..f926287 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -1066,14 +1066,27 @@ text properties using `ansi-color-apply'."
;;; Reporters
(describe "The batch reporter"
+ :var (print-buffer)
(let (parent-suite child-suite spec)
(before-each
(setq parent-suite (make-buttercup-suite :description "parent-suite")
child-suite (make-buttercup-suite :description "child-suite")
- spec (make-buttercup-spec :description "spec"))
+ spec (make-buttercup-spec :description "spec")
+ print-buffer (generate-new-buffer "*btrcp-reporter-test*"))
(buttercup-suite-add-child parent-suite child-suite)
(buttercup-suite-add-child child-suite spec)
- (spy-on 'buttercup--print))
+ (spy-on 'buttercup--print)
+ (spy-on 'send-string-to-terminal :and-call-fake
+ (apply-partially #'send-string-to-ansi-buffer print-buffer))
+ ;; Convenience function
+ (spy-on 'buttercup-output :and-call-fake
+ (lambda ()
+ "Return the text of print-buffer."
+ (with-current-buffer print-buffer
+ (buffer-string)))))
+ (after-each
+ (kill-buffer print-buffer)
+ (setq print-buffer nil))
(describe "on the buttercup-started event"
(it "should emit the number of specs"
- [nongnu] elpa/buttercup 246ddd7 218/340: Merge pull request #152 from DarwinAwardWinner/suppress-warning-redirect, (continued)
- [nongnu] elpa/buttercup 246ddd7 218/340: Merge pull request #152 from DarwinAwardWinner/suppress-warning-redirect, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9408a72 220/340: Merge pull request #154 from DarwinAwardWinner/test-emacs-26.3, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 26e2ded 222/340: Rename some innacurate references to "fake" functions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9b87afc 234/340: Merge branch 'snogge/spy-context-tweaks', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d8b596c 240/340: Merge branch 'doc-improve', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 243b71f 245/340: Merge branch 'spy-scope-error', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f3c2b00 261/340: test: Move with-local-buttercup to top of file, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0dbd474 263/340: Bump version: 1.20 → 1.21, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1c9c82f 265/340: Fixed misspelling in the documentation, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 360953b 266/340: test: Only run tests found in the tests/ directory, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 25bc00d 273/340: test: Set up suite "The batch reporter" to use fake terminal,
ELPA Syncer <=
- [nongnu] elpa/buttercup 5c9f80d 279/340: test: Add color tests for buttercup-suite-started and -done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0e94f6e 303/340: Lift buttercup-done handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f1f403b 308/340: Remove buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fce5fa5 313/340: Optionally fail when loading old elc files, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6c3bb75 318/340: Accept a list of regexes in buttercup-mark-skipped, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9dda405 320/340: Document use with Eldev, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06201f2 335/340: Print :to-have-been-called-with args as sexp for consistency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 459bffb 282/340: test: Add color tests for buttercup-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a1c7bff 101/340: Do not ignore errors when after-each succeeds, ELPA Syncer, 2021/12/16