branch: elpa/buttercup commit 4f68f0bfcebd8ffcd852466baa71b7e6136b667b Author: Jorgen Schaefer <cont...@jorgenschaefer.de> Commit: Jorgen Schaefer <cont...@jorgenschaefer.de>
The buttercup-spec-full-name function. --- buttercup-test.el | 20 ++++++++++++++++++++ buttercup.el | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/buttercup-test.el b/buttercup-test.el index 06f7a56..574c03b 100644 --- a/buttercup-test.el +++ b/buttercup-test.el @@ -225,6 +225,26 @@ :to-equal "su1 su2")))) +(describe "The `buttercup-spec-full-name' function" + (let (su1 su2 sp1) + (before-each + (setq 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 su2 sp2)) + + (it "should return the full name of a spec without parents" + (expect (buttercup-spec-full-name sp1) + :to-equal + "sp1")) + + (it "should return the full name of a spec with parents" + (expect (buttercup-spec-full-name sp2) + :to-equal + "su1 su2 sp2")))) + ;;;;;;;;;;;;;;;;;;;; ;;; Suites: describe diff --git a/buttercup.el b/buttercup.el index 7b42d71..9012789 100644 --- a/buttercup.el +++ b/buttercup.el @@ -278,6 +278,15 @@ MATCHER is either a matcher defined with (reverse name-parts) " "))) +(defun buttercup-spec-full-name (spec) + "Return the full name of SPEC, which includes the full name of its suite." + (let ((parent (buttercup-spec-parent spec))) + (if parent + (concat (buttercup-suite-full-name parent) + " " + (buttercup-spec-description spec)) + (buttercup-spec-description spec)))) + ;;;;;;;;;;;;;;;;;;;; ;;; Suites: describe