[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 1c762a5 200/340: Add documentation for :var and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 1c762a5 200/340: Add documentation for :var and :var* |
Date: |
Thu, 16 Dec 2021 14:59:34 -0500 (EST) |
branch: elpa/buttercup
commit 1c762a52647c96978ad52ca136a3e891e93617ba
Author: Kevin J. Foley <kfoley15@gmail.com>
Commit: Kevin J. Foley <kfoley15@gmail.com>
Add documentation for :var and :var*
---
docs/writing-tests.md | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/docs/writing-tests.md b/docs/writing-tests.md
index c478111..3383467 100644
--- a/docs/writing-tests.md
+++ b/docs/writing-tests.md
@@ -202,6 +202,30 @@ as full sentences in traditional
(expect t :to-equal t))))
```
+### Declaring Variables
+
+The `describe` macro supports the optional `:var` and `:var*` args.
+These bind variables for the suite by passing them as a varlist to the
+`let` and `let*` form respectively.
+
+```Emacs-Lisp
+(describe "A spec using :VAR"
+ :var ((foo 1))
+ (it "has access to the variables bound in :VAR"
+ (expect foo :to-be 1)))
+
+(describe "A spec using :VAR*"
+ :var* ((foo 1)
+ (bar (1+ foo)))
+ (it "has access to the variables bound in :VAR* which can refer \
+to symbols already bound"
+ (expect bar :to-be 2)))
+```
+
+It's important to note that `lexical-binding` must be `non-nil` for
+`:var` and `:var*` to work properly. Within a test file this is
+usually set using a local file variable.
+
### Setup and Teardown
To help a test suite DRY up any duplicated setup and teardown code,
- [nongnu] elpa/buttercup 4063f55 162/340: Add function buttercup--specs, (continued)
- [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
- [nongnu] elpa/buttercup edcffde 189/340: Add start and end times to each suite or spec, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 075b318 198/340: Add support for :var*, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1c762a5 200/340: Add documentation for :var and :var*,
ELPA Syncer <=
- [nongnu] elpa/buttercup 159fe3c 203/340: Really fix the buttercup-run tests, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d2b6692 206/340: Bump version: 1.16 → 1.17, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e62ce43 207/340: test: Do not leak functions from "The Spy " test suite, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8b3cfad 214/340: Update test for new warning capture suppression behavior, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1567c03 215/340: Add emacs-26.3 to CI config, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6cf8041 229/340: Update writing-tests.md to describe new spy context structs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup c720cef 233/340: Merge pull request #146 from DarwinAwardWinner/spy-record-errors, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b2edd35 235/340: Change: (buttercup-define-matcher-for-binary-function) Add newlines, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 818c150 239/340: docs: Clarify the difference between :var and `let', ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d8ab09d 244/340: Update documentation for the --pattern option in running-tests.md, ELPA Syncer, 2021/12/16