[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 0c5cc32 057/340: The buttercup-suites-total-spec
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 0c5cc32 057/340: The buttercup-suites-total-specs-defined function. |
Date: |
Thu, 16 Dec 2021 14:59:04 -0500 (EST) |
branch: elpa/buttercup
commit 0c5cc3251442d69b1d7edcb443120ad09451e698
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
The buttercup-suites-total-specs-defined function.
---
buttercup-test.el | 21 +++++++++++++++++++--
buttercup.el | 22 ++++++++++++++++++++--
2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/buttercup-test.el b/buttercup-test.el
index 22b750c..d27bdf2 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -133,8 +133,8 @@
;; Are tested in README.md
-;;;;;;;;;;;;;;;;;;;;
-;;; Suites: describe
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Suite and spec data structures
(describe "The `buttercup-suite-add-child' function"
(it "should add an element at the end of the list"
@@ -194,6 +194,23 @@
:to-equal
(list parent grandparent)))))
+(describe "The `buttercup-suites-total-specs-defined' function"
+ (it "should return the number of specs in a list of suites"
+ (let ((su1 (make-buttercup-suite :description "su1"))
+ (su2 (make-buttercup-suite :description "su2"))
+ (sp1 (make-buttercup-spec :description "sp1"))
+ (sp2 (make-buttercup-spec :description "sp2")))
+ (buttercup-suite-add-child su1 su2)
+ (buttercup-suite-add-child su1 sp1)
+ (buttercup-suite-add-child su2 sp2)
+
+ (expect (buttercup-suites-total-specs-defined (list su1))
+ :to-equal
+ 2))))
+
+;;;;;;;;;;;;;;;;;;;;
+;;; Suites: describe
+
(describe "The `describe' macro"
(it "should expand to a simple call to the describe function"
(expect (macroexpand '(describe "description" (+ 1 1)))
diff --git a/buttercup.el b/buttercup.el
index 2791e6b..a81ea6d 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -211,8 +211,8 @@ MATCHER is either a matcher defined with
(t
(cons t (format "Expected %S not to throw an error" function)))))))
-;;;;;;;;;;;;;;;;;;;;
-;;; Suites: describe
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Suite and spec data structures
(cl-defstruct buttercup-suite
description
@@ -255,6 +255,24 @@ MATCHER is either a matcher defined with
(buttercup-suite-parents (buttercup-spec-parent spec)))
nil))
+(defun buttercup-suites-total-specs-defined (suite-list)
+ "Return the number of specs defined in all suites in SUITE-LIST."
+ (let ((nspecs 0))
+ (dolist (suite suite-list)
+ (setq nspecs (+ nspecs
+ (buttercup--total-specs-defined suite))))
+ nspecs))
+
+(defun buttercup--total-specs-defined (suite-or-spec)
+ "Return the number of specs defined in SUITE-OR-SPEC and its children."
+ (if (buttercup-spec-p suite-or-spec)
+ 1
+ (apply #'+ (mapcar #'buttercup--total-specs-defined
+ (buttercup-suite-children suite-or-spec)))))
+
+;;;;;;;;;;;;;;;;;;;;
+;;; Suites: describe
+
(defvar buttercup-suites nil
"The list of all currently defined Buttercup suites.")
- [nongnu] elpa/buttercup 68692d9 113/340: Update Travis configuration instructions, (continued)
- [nongnu] elpa/buttercup 68692d9 113/340: Update Travis configuration instructions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 54696b0 124/340: Merge pull request #78 from Fuco1/feature/buttercup-minor-mode, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 77f0c74 122/340: Fix :to-have-same-items-as (fix #80), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 20ec520 145/340: Rename functions and arguments for closure manipulation, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5d1f338 146/340: Move let-binding outside loop for efficiency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7fa79c4 048/340: Expand and improve the package commentary., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4f68f0b 059/340: The buttercup-spec-full-name function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ef7b730 063/340: Various improvements of the batch reporter., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a55a638 064/340: More and better tests for the batch reporter., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c7df9f6 069/340: Add 24.5., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0c5cc32 057/340: The buttercup-suites-total-specs-defined function.,
ELPA Syncer <=
- [nongnu] elpa/buttercup ea8effb 095/340: Add the :var argument to describe, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 23472e9 099/340: :to-match: Show correct error messages, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup cc52444 107/340: feature/windows-bin-support: support for windows, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3ef90b4 100/340: :to-match: Don't switch t/nil!, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ab2a558 111/340: Add projectile integration info to Readme, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0124cc4 129/340: Signal an error when ":to-throw" is used on a non-function (#97), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 31e765b 142/340: Do not suppress errors while loading test files, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bc13b53 183/340: Merge pull request #133 from snogge/fix-specs-in-pending-suites, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ca3ba8e 185/340: Merge pull request #130 from snogge/travis-update, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d6cf530 072/340: Clean up the interactive reporter., ELPA Syncer, 2021/12/16