Skip to content

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

Draft
kkrausse wants to merge 1 commit into
ekataglobal:masterfrom
kkrausse:refactor
Draft

add with-expect-call2 that allows unordered calls#1
kkrausse wants to merge 1 commit into
ekataglobal:masterfrom
kkrausse:refactor

Conversation

@kkrausse

Copy link
Copy Markdown

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)

@kkrausse kkrausse Jan 27, 2022

Copy link
Copy Markdown
Author

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