[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 06c9699 104/340: Merge pull request #58 from Fuc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 06c9699 104/340: Merge pull request #58 from Fuco1/to-equal-as-set |
Date: |
Thu, 16 Dec 2021 14:59:13 -0500 (EST) |
branch: elpa/buttercup
commit 06c9699d6a1af54c08a4a164b40b87ba4a873f31
Merge: 657acef 553ff83
Author: Jorgen Schäfer <Jorgen.Schaefer@gmail.com>
Commit: Jorgen Schäfer <Jorgen.Schaefer@gmail.com>
Merge pull request #58 from Fuco1/to-equal-as-set
Add :to-equal-as-set to compare lists as sets.
---
buttercup-compat.el | 3 +++
buttercup.el | 5 +++++
docs/writing-tests.md | 9 +++++++++
3 files changed, 17 insertions(+)
diff --git a/buttercup-compat.el b/buttercup-compat.el
index c509c68..be33d88 100644
--- a/buttercup-compat.el
+++ b/buttercup-compat.el
@@ -35,6 +35,9 @@
(when (not (fboundp 'cl-defstruct))
(defalias 'cl-defstruct 'defstruct))
+(when (not (fboundp 'cl-every))
+ (defalias 'cl-every 'every))
+
;;;;;;;;;;;;;;;;;;;;;
;; Introduced in 24.4
diff --git a/buttercup.el b/buttercup.el
index cffc182..6d5a130 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -161,6 +161,11 @@ MATCHER is either a matcher defined with
(cons t (format "Expected %S not to `equal' %S" a b))
(cons nil (format "Expected %S to `equal' %S" a b))))
+(buttercup-define-matcher :to-have-same-items-as (a b)
+ (if (cl-every (lambda (x) (member x b)) a)
+ (cons t (format "Expected %S not to have same items as %S" a b))
+ (cons nil (format "Expected %S to have same items as %S" a b))))
+
(buttercup-define-matcher :to-match (text regexp)
(if (string-match regexp text)
(cons t (format "Expected %S not to match the regexp %S"
diff --git a/docs/writing-tests.md b/docs/writing-tests.md
index 07b0dc4..b2caafb 100644
--- a/docs/writing-tests.md
+++ b/docs/writing-tests.md
@@ -103,6 +103,15 @@ that are not included below.
(bar '((a . 12) (b . 34))))
(expect foo :to-equal bar))))
+ (it "The :to-have-same-items-as matcher compares two lists as sets"
+ (let ((first (list "a" "b" "c"))
+ (second (list "c" "a" "b"))
+ (third (list "a" "c" "d")))
+ (expect first :to-have-same-items-as second)
+ (expect second :to-have-same-items-as first)
+ (expect first :not :to-have-same-items-as third)
+ (expect third :not :to-have-same-items-as second)))
+
(it "The :to-match matcher is for regular expressions"
(let ((message "foo bar baz"))
(expect message :to-match "bar")
- [nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-done, (continued)
- [nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0e94f6e 303/340: Lift buttercup-done handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f1f403b 308/340: Remove buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fce5fa5 313/340: Optionally fail when loading old elc files, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6c3bb75 318/340: Accept a list of regexes in buttercup-mark-skipped, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 9dda405 320/340: Document use with Eldev, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06201f2 335/340: Print :to-have-been-called-with args as sexp for consistency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 459bffb 282/340: test: Add color tests for buttercup-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a1c7bff 101/340: Do not ignore errors when after-each succeeds, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b120003 108/340: Merge pull request #60 from howdoicomputer/feature/windows-bin-support, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06c9699 104/340: Merge pull request #58 from Fuco1/to-equal-as-set,
ELPA Syncer <=
- [nongnu] elpa/buttercup a6d9bde 105/340: Support more emacs parameters useful for pre-test initialization, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup abf2abe 109/340: Exclude hidden files and dirs in test root, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f60ed2a 119/340: Bump version: 1.5 → 1.6, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 677d6d3 118/340: Merge pull request #70 from xendk/color-output, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d8dc80d 126/340: Bump version: 1.6 → 1.7, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b6deeff 128/340: Set Emacs 24.3 as minimum and clean outdated code (close #89), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 39c7d8c 132/340: Allow ERT "should" and similar to work with buttercup, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e8140aa 133/340: Implement configurable stack traces, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e6f97d0 136/340: Release 1.8, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e26ea54 137/340: Let spy-on :and-return-value work with lists and symbols (close #104), ELPA Syncer, 2021/12/16