emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/buttercup 562cdb0 058/340: The buttercup-suite-full-name f


From: ELPA Syncer
Subject: [nongnu] elpa/buttercup 562cdb0 058/340: The buttercup-suite-full-name function.
Date: Thu, 16 Dec 2021 14:59:04 -0500 (EST)

branch: elpa/buttercup
commit 562cdb0393185e122bff673ff2259fa638c818b2
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>

    The buttercup-suite-full-name function.
---
 buttercup-test.el | 17 +++++++++++++++++
 buttercup.el      |  8 ++++++++
 2 files changed, 25 insertions(+)

diff --git a/buttercup-test.el b/buttercup-test.el
index d27bdf2..06f7a56 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -208,6 +208,23 @@
               :to-equal
               2))))
 
+(describe "The `buttercup-suite-full-name' function"
+  (let (su1 su2)
+    (before-each
+      (setq su1 (make-buttercup-suite :description "su1")
+            su2 (make-buttercup-suite :description "su2"))
+      (buttercup-suite-add-child su1 su2))
+
+    (it "should return the full name of a suite without parents"
+      (expect (buttercup-suite-full-name su1)
+              :to-equal
+              "su1"))
+
+    (it "should return the full name of a suite with parents"
+      (expect (buttercup-suite-full-name su2)
+              :to-equal
+              "su1 su2"))))
+
 ;;;;;;;;;;;;;;;;;;;;
 ;;; Suites: describe
 
diff --git a/buttercup.el b/buttercup.el
index a81ea6d..7b42d71 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -270,6 +270,14 @@ MATCHER is either a matcher defined with
     (apply #'+ (mapcar #'buttercup--total-specs-defined
                        (buttercup-suite-children suite-or-spec)))))
 
+(defun buttercup-suite-full-name (suite)
+  "Return the full name of SUITE, which includes the names of the parents."
+  (let ((name-parts (mapcar #'buttercup-suite-description
+                            (cons suite (buttercup-suite-parents suite)))))
+    (mapconcat #'identity
+               (reverse name-parts)
+               " ")))
+
 ;;;;;;;;;;;;;;;;;;;;
 ;;; Suites: describe
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]