[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 46882f8 131/340: Show a message about duplicate
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 46882f8 131/340: Show a message about duplicate spec names |
Date: |
Thu, 16 Dec 2021 14:59:19 -0500 (EST) |
branch: elpa/buttercup
commit 46882f8f253186723ba744f71f4a2f5405fc06c3
Author: Ryan C. Thompson <rct@thompsonclan.org>
Commit: Jorgen Schäfer <Jorgen.Schaefer@gmail.com>
Show a message about duplicate spec names
This should be a warning, but for some reason "display-warning" is a
no-op inside of "buttercup-describe".
Fixes #77.
---
buttercup.el | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/buttercup.el b/buttercup.el
index 4389902..286f9a1 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -351,6 +351,23 @@ MATCHER is either a matcher defined with
(buttercup-spec-description spec))
(buttercup-spec-description spec))))
+(defun buttercup--full-spec-names (spec-or-suite-list)
+ "Return full names of all specs in SPEC-OR-SUITE-LIST."
+ (cl-loop
+ for x in (buttercup--specs-and-suites spec-or-suite-list)
+ if (buttercup-spec-p x)
+ collect (buttercup-spec-full-name x)))
+
+(defun buttercup--find-duplicate-spec-names (spec-or-suite-list)
+ "Return duplicate full spec names among SPEC-OR-SUITE-LIST."
+ (let ((seen '())
+ (duplicates '()))
+ (dolist (name (buttercup--full-spec-names spec-or-suite-list)
+ (nreverse duplicates))
+ (if (member name seen)
+ (push name duplicates)
+ (push name seen)))))
+
;;;;;;;;;;;;;;;;;;;;
;;; Suites: describe
@@ -385,6 +402,12 @@ form.")
(if enclosing-suite
(buttercup-suite-add-child enclosing-suite
buttercup--current-suite)
+ ;; At top level, warn about duplicate spec names
+ (let ((dups (buttercup--find-duplicate-spec-names
+ (list buttercup--current-suite))))
+ (when dups
+ (message "Found duplicate spec names in suite: %S"
+ (delete-dups dups))))
(setq buttercup-suites (append buttercup-suites
(list buttercup--current-suite))))))
- [nongnu] elpa/buttercup 79286cf 055/340: Test for the batch reporter., (continued)
- [nongnu] elpa/buttercup 79286cf 055/340: Test for the batch reporter., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 87e0c0d 073/340: Bump version: 1.0 → 1.1, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 10e0537 150/340: Manually fix bumpversion.cfg, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 18a8879 151/340: Bump version: 1.8 → 1.9, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 62c416a 164/340: Rewrite the pattern loop of buttercup-run-discover, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 636db47 172/340: Typo fixes (#126), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8034597 175/340: Replace remaining calls to obsolete buttercup-*-parents, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f57036f 180/340: Update the disabled/pending sections of writing-tests.md, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 406c41d 190/340: Print elapsed time for each spec, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 19f256e 094/340: Update copyright / license information for some details, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 46882f8 131/340: Show a message about duplicate spec names,
ELPA Syncer <=
- [nongnu] elpa/buttercup 07cf64b 140/340: Run test-buttercup.el before tests in writing-tests.md, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2edeae5 159/340: Rewrite buttercup-suite-full-name with a single loop, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4063f55 162/340: Add function buttercup--specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bf0e1da 049/340: Rename tar target to release and add compile and clean targets., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 17f3cf5 062/340: Remove error in favor of failed., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f3d6709 074/340: Use relative path when testing for dotfiles in current project, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup acccc0f 179/340: Modify xdescribe to keep all contained specs as pending, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d07dbf3 182/340: Merge pull request #129 from snogge/fix-obsolete-aliases, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 079ef3e 186/340: Bump version: 1.12 → 1.13, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1998ae3 188/340: Drop unused variable in buttercup--disable-specs, ELPA Syncer, 2021/12/16