branch: elpa/buttercup
commit dacfacc652c4c0f5e0d26e08b3a7b5c91fe8e2f9
Author: Ola Nilsson <[email protected]>
Commit: Ola Nilsson <[email protected]>
Recognize buttercup--mark-stackframe in buttercup--enclosed-expr
---
buttercup.el | 4 ++++
tests/test-buttercup.el | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/buttercup.el b/buttercup.el
index 17264b1..4321817 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -56,7 +56,9 @@
The function MUST have one of the following forms:
\(lambda () EXPR)
+\(lambda () (buttercup--mark-stackframe) EXPR)
\(closure (ENVLIST) () EXPR)
+\(closure (ENVLIST) () (buttercup--mark-stackframe) EXPR)
\(lambda () (quote EXPR) EXPR)
\(closure (ENVLIST) () (quote EXPR) EXPR)
@@ -65,12 +67,14 @@ forms are useful if EXPR is a macro call, in which case the
`quote' ensures access to the un-expanded form."
(pcase fun
(`(closure ,(pred listp) nil ,expr) expr)
+ (`(closure ,(pred listp) nil (buttercup--mark-stackframe) ,expr) expr)
(`(closure ,(pred listp) nil (quote ,expr) . ,_rest) expr)
(`(closure ,(pred listp) nil ,_expr . ,(pred identity))
(error "Closure contains multiple expressions: %S" fun))
(`(closure ,(pred listp) ,(pred identity) . ,(pred identity))
(error "Closure has nonempty arglist: %S" fun))
(`(lambda nil ,expr) expr)
+ (`(lambda nil (buttercup--mark-stackframe) ,expr) expr)
(`(lambda nil (quote ,expr) . ,_rest) expr)
(`(lambda nil ,_expr . ,(pred identity))
(error "Function contains multiple expressions: %S" fun))
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index 19cc1a4..9455e49 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -136,8 +136,10 @@ text properties using `ansi-color-apply'."
(expect (length expansion) :to-equal 4)
(expect (nth 0 expansion) :to-be 'buttercup-expect)
(expect (functionp (nth 1 expansion)))
+ (expect (buttercup--wrapper-fun-p (nth 1 expansion)))
(expect (nth 2 expansion) :to-be :to-equal)
- (expect (functionp (nth 3 expansion)))))
+ (expect (functionp (nth 3 expansion)))
+ (expect (buttercup--wrapper-fun-p (nth 3 expansion)))))
(it "with no matcher should use `:to-be-truthy' as the matcher"
(let ((expansion (macroexpand '(expect (equal (+ 1 1) 2)))))