[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 3637e3d 015/340: Add more extensive matcher test
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 3637e3d 015/340: Add more extensive matcher tests to the README. |
Date: |
Thu, 16 Dec 2021 14:58:56 -0500 (EST) |
branch: elpa/buttercup
commit 3637e3d16bf3de29718beb25ba6a55a4cd337f1d
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
Add more extensive matcher tests to the README.
---
README.md | 21 ++++++++++++++++-----
buttercup-test.el | 28 +++++++++++++++-------------
2 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index ac773d9..6d3d202 100644
--- a/README.md
+++ b/README.md
@@ -137,11 +137,22 @@ that are not included below.
(expect pi :not :to-be-close-to e 2)
(expect pi :to-be-close-to e 0)))
- (it "The :to-throw matcher is for testing if a function throws an exception"
- (let ((foo (lambda () (+ 1 2)))
- (bar (lambda () (+ a 1))))
- (expect foo :not :to-throw)
- (expect bar :to-throw))))
+ (describe "The :to-throw matcher"
+ (it "is for testing if a function throws an exception"
+ (let ((foo (lambda () (+ 1 2)))
+ (bar (lambda () (+ a 1))))
+ (expect foo :not :to-throw)
+ (expect bar :to-throw)))
+ (it "accepts a symbol to check for the signal thrown"
+ (let ((foo (lambda () (/ 1 0)))
+ (bar (lambda () (+ a 1))))
+ (expect foo :not :to-throw 'void-variable)
+ (expect bar :to-throw 'void-variable)))
+ (it "optionally matches arguments to signals"
+ (let ((foo (lambda () (+ a 1)))
+ (bar (lambda () (+ a 1))))
+ (expect foo :not :to-throw 'void-variable '(b))
+ (expect bar :to-throw 'void-variable '(a))))))
```
## Spies
diff --git a/buttercup-test.el b/buttercup-test.el
index 7e4ae99..ba9b266 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -107,20 +107,22 @@
(it "should create a matcher usable by apply-matcher"
(expect (buttercup--apply-matcher :test-matcher '(1 2))
:to-equal
+ 3)))
+
+(describe "The `buttercup--apply-matcher'"
+ (it "should work with functions"
+ (expect (buttercup--apply-matcher #'+ '(1 2))
+ :to-equal
3))
- (describe "The `buttercup--apply-matcher'"
- (it "should work with functions"
- (expect (buttercup--apply-matcher #'+ '(1 2))
- :to-equal
- 3))
+ (it "should work with matchers"
+ (expect (buttercup--apply-matcher :test-matcher '(1 2))
+ :to-equal
+ 3))
- (it "should work with matchers"
- (expect (buttercup--apply-matcher :test-matcher '(1 2))
- :to-equal
- 3))
+ (it "should fail if the matcher is not defined"
+ (expect (lambda ()
+ (buttercup--apply-matcher :not-defined '(1 2)))
+ :to-throw)))
- (it "should fail if the matcher is not defined"
- (expect (lambda ()
- (buttercup--apply-matcher :not-defined '(1 2)))
- :to-throw))))
+;; Built-in matchers are tested in README.md
- [nongnu] elpa/buttercup a7d9813 010/340: Add cl-defstruct compatibility alias., (continued)
- [nongnu] elpa/buttercup a7d9813 010/340: Add cl-defstruct compatibility alias., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fd70ccf 002/340: Specs are now structs., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ba40ff8 027/340: Spies: :and-return-value, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 20b87dd 031/340: Refactoring of spy-on to be more concise and DRY., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bb31c85 043/340: Edebugable., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5d369cd 007/340: Do not use emacs-snapshot from EVM, that's slow., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 07b1ee6 008/340: Add compatibility definition for define-error, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7cdb219 028/340: Spies: :and-call-fake, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5db449f 025/340: Spies, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d580e5c 011/340: Add build status badge., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3637e3d 015/340: Add more extensive matcher tests to the README.,
ELPA Syncer <=
- [nongnu] elpa/buttercup a277b0e 022/340: Setup and teardown: before-each, after-each, before-all, after-all, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1882d6f 013/340: Comment cleanup. Also, make elisp lexically scoped., ELPA Syncer, 2021/12/16
- [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