[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup dde8651 290/340: Add new function buttercup--spe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup dde8651 290/340: Add new function buttercup--spec-mark-pending and use it |
Date: |
Thu, 16 Dec 2021 14:59:52 -0500 (EST) |
branch: elpa/buttercup
commit dde8651cf2ca5364f3caaf8b515ac7a7dcd79e40
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
Add new function buttercup--spec-mark-pending and use it
The purpose of the new function is to create one place to set specs as
pending in a well defined way.
---
buttercup.el | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/buttercup.el b/buttercup.el
index 535aa05..1d369e3 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -801,6 +801,18 @@ The indentaion is two spaces per parent."
(let ((level (length (buttercup-suite-or-spec-parents suite-or-spec))))
(concat (make-string (* 2 level) ?\s) (buttercup-suite-or-spec-description
suite-or-spec))))
+(defun buttercup--spec-mark-pending (spec description &optional
description-for-now)
+ "Mark SPEC as pending with DESCRIPTION.
+If DESCRIPTION-FOR-NOW is non nil, set the spec
+`pending-description' to that value for now, it will be reset to
+DESCRIPTION when the spec is run. Return SPEC."
+ (setf (buttercup-spec-function spec)
+ (lambda () (signal 'buttercup-pending description))
+ (buttercup-spec-status spec) 'pending)
+ (when description-for-now
+ (setf (buttercup-spec-failure-description spec) description-for-now))
+ spec)
+
;;;;;;;;;;;;;;;;;;;;
;;; Suites: describe
@@ -1022,15 +1034,8 @@ A disabled spec is not run.
DESCRIPTION has the same meaning as in `xit'. FUNCTION is
ignored. Return the created spec object."
(declare (indent 1))
- (ignore function)
- (let ((spec (buttercup-it description
- (lambda ()
- (signal 'buttercup-pending "PENDING")))))
- (setf (buttercup-spec-status spec)
- 'pending
- (buttercup-spec-failure-description spec)
- "")
- spec))
+ (let ((spec (buttercup-it description (or function #'ignore))))
+ (buttercup--spec-mark-pending spec "PENDING" "")))
;;;;;;;;;
;;; Spies
@@ -1389,9 +1394,7 @@ SUITES is a list of suites. PATTERNS is a list of
regexps."
(unless (cl-dolist (p patterns)
(when (string-match p spec-full-name)
(cl-return t)))
- (setf (buttercup-spec-function spec)
- (lambda () (signal 'buttercup-pending "SKIPPED"))
- (buttercup-spec-status spec) 'pending)))))
+ (buttercup--spec-mark-pending spec "SKIPPED")))))
;;;###autoload
(defun buttercup-run-markdown-buffer (&rest markdown-buffers)
- [nongnu] elpa/buttercup c83ba7d 268/340: Extract function buttercup-elapsed-time-string, (continued)
- [nongnu] elpa/buttercup c83ba7d 268/340: Extract function buttercup-elapsed-time-string, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 38cfa6f 270/340: Fix spy-on on Emacs 24.3 for symbols that are not fbound, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 81bfed4 272/340: test: Add utility function send-string-to-ansi-buffer, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup cf4eee8 274/340: test: Verify output in the "The batch reporter" suite, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4159111 275/340: test: Verify full line for reporter spec-done tests, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fbb790b 278/340: test: Add tests for buttercup-started and buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d563e18 281/340: test: Add color tests for suite-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b910b71 285/340: Extract buttercup--indented-description from the batch reporters, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e71a40f 287/340: Make sure carriage movement characters are not colorized, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a22fc29 288/340: Bump version: 1.21 → 1.22, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup dde8651 290/340: Add new function buttercup--spec-mark-pending and use it,
ELPA Syncer <=
- [nongnu] elpa/buttercup c59110b 291/340: test: Extend with-local-buttercup with some key arguments, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d443ecb 293/340: Clarify patterns in bin/buttercup, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4d1acb8 294/340: test: Rewrite buttercup-run tests using spies, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 37223e4 296/340: actions: Run actions on push for all branches, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 50c7fc2 297/340: Switch to pcase in spec-done case of buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup dd32cc7 298/340: test: Fix "should color-print pending spec count in default color", ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0debeec 299/340: test: Use with-local-buttercup in more tests, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b3acf50 304/340: Lift spec-started handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 24a7bb9 306/340: Extract buttercup-reporter-batch--print-spec-done-line, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c9addd5 307/340: Lift spec-done handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16