[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 77f0c74 122/340: Fix :to-have-same-items-as (fix
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 77f0c74 122/340: Fix :to-have-same-items-as (fix #80) |
Date: |
Thu, 16 Dec 2021 14:59:17 -0500 (EST) |
branch: elpa/buttercup
commit 77f0c74537dd4f5d80e40f64673ff8b671a7c762
Author: Damien Cassou <damien@cassou.me>
Commit: Damien Cassou <damien@cassou.me>
Fix :to-have-same-items-as (fix #80)
---
buttercup-compat.el | 3 +++
buttercup.el | 3 ++-
docs/writing-tests.md | 7 +++++--
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/buttercup-compat.el b/buttercup-compat.el
index be33d88..fa9725a 100644
--- a/buttercup-compat.el
+++ b/buttercup-compat.el
@@ -38,6 +38,9 @@
(when (not (fboundp 'cl-every))
(defalias 'cl-every 'every))
+(when (not (fboundp 'cl-subsetp))
+ (defalias 'cl-subsetp 'subsetp))
+
;;;;;;;;;;;;;;;;;;;;;
;; Introduced in 24.4
diff --git a/buttercup.el b/buttercup.el
index 62f0d98..84414b5 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -162,7 +162,8 @@ MATCHER is either a matcher defined with
(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)
+ (if (and (cl-subsetp a b :test #'equal)
+ (cl-subsetp b a :test #'equal))
(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))))
diff --git a/docs/writing-tests.md b/docs/writing-tests.md
index b2caafb..8b965cd 100644
--- a/docs/writing-tests.md
+++ b/docs/writing-tests.md
@@ -106,11 +106,14 @@ that are not included below.
(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")))
+ (third (list "a" "c" "d"))
+ (fourth (list "a" "b")))
(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)))
+ (expect third :not :to-have-same-items-as second)
+ (expect first :not :to-have-same-items-as fourth)
+ (expect fourth :not :to-have-same-items-as first)))
(it "The :to-match matcher is for regular expressions"
(let ((message "foo bar baz"))
- [nongnu] elpa/buttercup ba8cd05 106/340: Merge pull request #59 from immerrr/add-other-emacs-params, (continued)
- [nongnu] elpa/buttercup ba8cd05 106/340: Merge pull request #59 from immerrr/add-other-emacs-params, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 07c525e 116/340: Merge pull request #68 from ebpa/report-load-errors, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 11f072f 123/340: Merge pull request #81 from DamienCassou/fix-to-have-same-items-as, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 562cdb0 058/340: The buttercup-suite-full-name function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d264da3 075/340: Merge pull request #17 from Fuco1/master, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8c486e6 067/340: Move print settings to the batch reporter where they belong., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0f3eb63 078/340: Show actual function arguments when a spy fails., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 357e73b 085/340: Remove debug message, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 68692d9 113/340: Update Travis configuration instructions, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 54696b0 124/340: Merge pull request #78 from Fuco1/feature/buttercup-minor-mode, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 77f0c74 122/340: Fix :to-have-same-items-as (fix #80),
ELPA Syncer <=
- [nongnu] elpa/buttercup 20ec520 145/340: Rename functions and arguments for closure manipulation, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5d1f338 146/340: Move let-binding outside loop for efficiency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7fa79c4 048/340: Expand and improve the package commentary., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 4f68f0b 059/340: The buttercup-spec-full-name function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ef7b730 063/340: Various improvements of the batch reporter., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a55a638 064/340: More and better tests for the batch reporter., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c7df9f6 069/340: Add 24.5., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0c5cc32 057/340: The buttercup-suites-total-specs-defined function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ea8effb 095/340: Add the :var argument to describe, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 23472e9 099/340: :to-match: Show correct error messages, ELPA Syncer, 2021/12/16