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 returning to support multiple results for function invocation. #12

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

Conversation

phmeier-nubank
Copy link

@phmeier-nubank phmeier-nubank commented Mar 7, 2024

This follows the suggestion in #10. Excerpt from the docs:

returning

If you want to return different values for each invocation, use mockfn.macros/returning.
Note that if the function will return nil afer all provided results are consumed.

(testing "providing - cause function non referential"
    (mfn/providing [(one-fn :argument-1) (mfn/returning :result-1 :result-2 )]
                   (is (= :result-1 (one-fn :argument-1)))
                   (is (= :result-2 (one-fn :argument-1)))
                   (is (nil? (one-fn :argument-1)))))

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

Successfully merging this pull request may close these issues.

1 participant