Skip to content

Commit

Permalink
Add docstrings for the spy matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
snogge committed Dec 8, 2023
1 parent 25924eb commit 48a81c6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions buttercup.el
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,14 @@ UNEVALUATED-EXPR if it did not raise any signal."
thrown-signal expected-signal))))))

(buttercup-define-matcher :to-have-been-called (spy)
"Check that SPY have been called at least once."
(cl-assert (symbolp (funcall spy)))
(if (spy-calls-all (funcall spy))
t
nil))

(buttercup-define-matcher :to-have-been-called-with (spy &rest args)
"Check that SPY has been called at least once with arguments ARGS."
(setq spy (funcall spy))
(cl-assert (symbolp spy))
(setq args (mapcar #'funcall args))
Expand All @@ -745,6 +747,7 @@ UNEVALUATED-EXPR if it did not raise any signal."
t))))

(buttercup-define-matcher :to-have-been-called-times (spy number)
"Check that SPY has been called exactly NUMBER times."
(setq spy (funcall spy)
number (funcall number))
(cl-assert (symbolp spy))
Expand Down

0 comments on commit 48a81c6

Please sign in to comment.