Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add with-expect-call2 that allows unordered calls #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kkrausse
Copy link

This is a POC from noticing restrictions of expect-call, not ready for "production".

Restructures how the lib works completely to make it more
extensible and clean. The new version allows unordered mock calls and
can allow for multiple calls of the same fn in any order. Currently the
lib is locked into ordered calls. Requiring ordered calls could be added
to this POC. So far :do :more, and :once are supported. Arg matching
also works as the previous one.

Need to add a post-run check to make sure the mocks are all called.
This should be as easy as checking the number of calls on each of the mocks.

Needs testing

It also restructures how the lib works completely to make it more
extensible and clean. The new version allows unordered mock calls and
can allow for multiple calls of the same fn in any order. Currently the
lib is locked into ordered calls. Requiring ordered calls could be added
to this POC. So far :do :more, and :once are supported. Arg matching
also works as the previous one.

Need to add a post-run check to make sure the mocks are all called.
This should be as easy as checking the number of calls on each of the mocks.
{:mocked-var `(resolve (quote ~fname))
:args args
:body-fn `(fn ~'do-body []
~@body)
Copy link
Author

@kkrausse kkrausse Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
~@body)
(match (into [] args#)
~args ~@body))

so free variables are matched with args and usable in the body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant