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 AssertExpectationsInOrder #1082

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

Conversation

apexskier
Copy link

Summary

This adds a function to assert mock calls in order.

Changes

I've added all the test cases I can think of and tried to design the edge cases around repeatability and optionality to make sense with the rest of the package.

AssertExpectationsInOrder asserts that everything specified with On and Return was in fact called as expected in the order expected. Expectations set up for a specific number of times must be called that number of times before the next call to the mock is made. If optional, they do not need to be called the full number of times. Expectation with no specific limit must be called at least once unless optional.

Motivation

My one concern is about the v2 work - I hope this can fit into v1 with minimal pain on the maintainers side.

Related issues

This adds a function to assert mock calls in order, resolving stretchr#741. I've
added all the test cases I can think of and tried to design the edge
cases around repeatability and optionality to make sense with the rest
of the package.

My one concern is about the v2 work - I hope this can fit into v1 with
minimal pain on the maintainers side.

> AssertExpectationsInOrder asserts that everything specified with On and Return
was in fact called as expected in the order expected. Expectations set up for
a specific number of times must be called that number of times before the next
call to the mock is made. If optional, they do not need to be called the full
number of times. Expectation with no specific limit must be called at least
once unless optional.
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.

assert mock calls in order
1 participant