[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 8e30284 024/340: Disabled suites, pending specs.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 8e30284 024/340: Disabled suites, pending specs. |
Date: |
Thu, 16 Dec 2021 14:58:57 -0500 (EST) |
branch: elpa/buttercup
commit 8e3028403c7da8fac277cefaee2a866841989b0e
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
Disabled suites, pending specs.
---
README.md | 35 +++++++++++++++++++++++++++++++++++
ROADMAP.md | 9 +++++++++
buttercup-test.el | 34 ++++++++++++++++++++++++++++++++++
buttercup.el | 31 +++++++++++++++++++++++++++++++
4 files changed, 109 insertions(+)
diff --git a/README.md b/README.md
index db8149b..32c36d5 100644
--- a/README.md
+++ b/README.md
@@ -272,6 +272,41 @@ walks through the `after-each` functions similarly.
(expect foo :to-equal bar))))))
```
+## Disabling Suites
+
+Suites and specs can be disabled with the `xdescribe` and `xit`
+macros, respectively. These suites and any specs inside them are
+skipped when run and thus their results will not appear in the
+results.
+
+```Lisp
+(xdescribe "A spec"
+ (let (foo)
+ (before-each
+ (setq foo 0)
+ (setq foo (1+ foo)))
+
+ (it "is just a function, so it can contain any code"
+ (expect foo :to-equal 1))))
+```
+
+## Pending Specs
+
+Pending specs do not run.
+
+Any spec declared with `xit` is marked as pending.
+
+Any spec declared without a function body will also be marked as
+pending in results.
+
+```Lisp
+(describe "Pending specs"
+ (xit "can be declared using `xit'"
+ (expect t :to-be nil))
+
+ (it "can be declared with `it' but without a body"))
+```
+
## Test Runners
Evaluating `describe` forms just stores the suites. You need to use a
diff --git a/ROADMAP.md b/ROADMAP.md
index 9431264..ddd76a7 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -50,6 +50,15 @@ Example code:
# Version 1.1: The Missing Features
+## Pending Specs
+
+The following phrases were left out from `introduction.js`, and should
+be implemented still:
+
+> Pending specs do not run, _but their names will show up in the results as
pending._
+
+> And if you call the function `pending` anywhere in the spec body, no matter
the expectations, the spec will be marked pending. A string passed to pending
will be treated as a reason and displayed when the suite finishes.
+
## Return of the Backtrace
Suite execution should catch errors and include a backtrace in the
diff --git a/buttercup-test.el b/buttercup-test.el
index b3e4cb9..1f33e54 100644
--- a/buttercup-test.el
+++ b/buttercup-test.el
@@ -290,3 +290,37 @@
(expect (buttercup-suite-after-all suite)
:to-equal
(list 23)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Disabled Suites: xdescribe
+
+(describe "The `xdescribe' macro"
+ (it "expands directly to a function call"
+ (expect (macroexpand '(xdescribe "bla bla" (+ 1 1)))
+ :to-equal
+ '(buttercup-xdescribe "bla bla" (lambda () (+ 1 1))))))
+
+(describe "The `buttercup-xdescribe' function"
+ (it "should be a no-op"
+ (expect (lambda ()
+ (buttercup-xdescribe
+ "bla bla"
+ (lambda () (error "should not happen"))))
+ :not :to-throw)))
+
+;;;;;;;;;;;;;;;;;;;;;;
+;;; Pending Specs: xit
+
+(describe "The `xit' macro"
+ (it "expands directly to a function call"
+ (expect (macroexpand '(xit "bla bla" (+ 1 1)))
+ :to-equal
+ '(buttercup-xit "bla bla" (lambda () (+ 1 1))))))
+
+(describe "The `buttercup-xit' function"
+ (it "should be a no-op"
+ (expect (lambda ()
+ (buttercup-xit
+ "bla bla"
+ (lambda () (error "should not happen"))))
+ :not :to-throw)))
diff --git a/buttercup.el b/buttercup.el
index f0b2b7f..bb400ad 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -330,6 +330,37 @@ form.")
(append (buttercup-suite-after-all buttercup--current-suite)
(list function))))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Disabled Suites: xdescribe
+
+(defmacro xdescribe (description &rest body)
+ "Like `describe', but mark the suite as disabled.
+
+A disabled suite is not run."
+ (declare (indent 1))
+ `(buttercup-xdescribe ,description (lambda () ,@body)))
+
+(defun buttercup-xdescribe (description function)
+ "Like `buttercup-describe', but mark the suite as disabled.
+
+A disabled suite is not run."
+ nil)
+
+;;;;;;;;;;;;;;;;;;;;;;
+;;; Pending Specs: xit
+
+(defmacro xit (description &rest body)
+ "Like `it', but mark the spec as disabled.
+
+A disabled spec is not run."
+ (declare (indent 1))
+ `(buttercup-xit ,description (lambda () ,@body)))
+
+(defun buttercup-xit (description function)
+ "Like `buttercup-it', but mark the spec as disabled.
+
+A disabled spec is not run."
+ nil)
;; (let* ((buttercup--descriptions (cons description
;; buttercup--descriptions))
- [nongnu] branch elpa/buttercup created (now 108d229), ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup e10955c 001/340: Initial commit., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 67df4b1 012/340: Remove Cask file. It's unused., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 548df0d 030/340: Spies: Other tracking properties., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b1bcedc 032/340: Add docstrings where missing., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 821cfa6 005/340: Comment separating built-in matchers from the rest., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8e30284 024/340: Disabled suites, pending specs.,
ELPA Syncer <=
- [nongnu] elpa/buttercup 89c00aa 009/340: Makefile: Make the emacs command configurable, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7e20ff1 021/340: ROADMAP.md: New file., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 764d6aa 020/340: Tests for the it macro and buttercup-it function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d5572a6 034/340: Refactoring of the cleanup code., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b75b3e9 036/340: Add a discovery test runner., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 7eecb96 038/340: Remove commented-out backtrace code from buttercup.el., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3483449 045/340: Typo fix., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 84002e9 054/340: Add parent relations to specs and suites., ELPA Syncer, 2021/12/16
- [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