[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 77d1dac 017/340: Test buttercup-suite-add-child.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 77d1dac 017/340: Test buttercup-suite-add-child. |
Date: |
Thu, 16 Dec 2021 14:58:56 -0500 (EST) |
branch: elpa/buttercup
commit 77d1dac2ba612a8dff735937951d12044562c2b3
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
Test buttercup-suite-add-child.
This was renamed from buttercup-suite-add-nested, and the relevant
field in buttercup-suite was renamed as well.
---
buttercup-test.el | 19 +++++++++++++++++++
buttercup.el | 25 ++++++++++++-------------
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/buttercup-test.el b/buttercup-test.el
index ba9b266..c31d2f6 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -126,3 +126,22 @@
:to-throw)))
;; Built-in matchers are tested in README.md
+
+(describe "The `buttercup-suite-add-child' function"
+ (it "should add an element at the end of the list"
+ (let ((suite (make-buttercup-suite :children '(1 2 3))))
+
+ (buttercup-suite-add-child suite 4)
+
+ (expect (buttercup-suite-children suite)
+ :to-equal
+ '(1 2 3 4))))
+
+ (it "should add an element even if the list is empty"
+ (let ((suite (make-buttercup-suite :children nil)))
+
+ (buttercup-suite-add-child suite 23)
+
+ (expect (buttercup-suite-children suite)
+ :to-equal
+ '(23)))))
diff --git a/buttercup.el b/buttercup.el
index 7628897..c482539 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -232,13 +232,12 @@ MATCHER is either a matcher defined with
(cl-defstruct buttercup-suite
description
- nested
- specs)
+ children)
-(defun buttercup-suite-add-nested (parent child)
- "Add a CHILD suite as a nested suite to a PARENT suite."
- (setf (buttercup-suite-nested parent)
- (append (buttercup-suite-nested parent)
+(defun buttercup-suite-add-child (parent child)
+ "Add a CHILD suite to a PARENT suite."
+ (setf (buttercup-suite-children parent)
+ (append (buttercup-suite-children parent)
(list child))))
(defvar buttercup-suites nil
@@ -262,8 +261,8 @@ form.")
:description description)))
(funcall body-function)
(if enclosing-suite
- (buttercup-suite-add-nested enclosing-suite
- buttercup--current-suite)
+ (buttercup-suite-add-child enclosing-suite
+ buttercup--current-suite)
(setq buttercup-suites (append buttercup-suites
(list buttercup--current-suite))))))
@@ -283,10 +282,10 @@ form.")
"Function to handle an `it' form."
(when (not description)
(error "`it' has to be called from within a `describe' form."))
- (buttercup-suite-add-nested buttercup--current-suite
- (make-buttercup-spec
- :description description
- :function body-function)))
+ (buttercup-suite-add-child buttercup--current-suite
+ (make-buttercup-spec
+ :description description
+ :function body-function)))
;; (let* ((buttercup--descriptions (cons description
;; buttercup--descriptions))
@@ -331,7 +330,7 @@ form.")
(let* ((level (or level 0))
(indent (make-string (* 2 level) ?\s)))
(message "%s%s" indent (buttercup-suite-description suite))
- (dolist (sub (buttercup-suite-nested suite))
+ (dolist (sub (buttercup-suite-children suite))
(cond
((buttercup-suite-p sub)
(buttercup-run-suite sub (1+ level)))
- [nongnu] elpa/buttercup c5a9f26 003/340: Add first set of unit tests., (continued)
- [nongnu] elpa/buttercup c5a9f26 003/340: Add first set of unit tests., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 36522b9 006/340: Add .travis.yml, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f44e65d 004/340: Unit tests for define-matcher and apply-matcher., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d3cd12a 019/340: Tests for the buttercup-describe function, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3772ad5 014/340: Use eval-region instead of eval-buffer., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8aa87c8 026/340: Spy :and-call-through, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 683614d 018/340: Tests for the describe macro., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0221830 023/340: Remove setup and teardown from ROADMAP.md., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 695e444 016/340: buttercup-markdown-runner: Use setq, not setq-local., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7526198 029/340: Spies: :and-throw-error, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 77d1dac 017/340: Test buttercup-suite-add-child.,
ELPA Syncer <=
- [nongnu] elpa/buttercup c1abc2a 033/340: Refactoring of spy context accessors., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f314737 035/340: ROADMAP.md: Remove spies section, as it is done., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4bd24e7 037/340: ROADMAP cleanup., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 55b87ec 039/340: Removed ROADMAP.md. This is now tracked in issues., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 993ddda 040/340: Add .gitignore, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1dcd2cd 041/340: Prepare release, add bumpversion and pkg.el, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f046eef 042/340: Bump version: 0.1 → 1.0, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 537b729 044/340: Merge pull request #6 from myeffort/master, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bcaa087 046/340: Add buttercup executable to run buttercup tests more easily., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7250873 047/340: Rename patch to minor in bumpversion.cfg, ELPA Syncer, 2021/12/16