Skip to content

Conversation

@rlipscombe
Copy link
Contributor

When testing some non-deterministic code, I needed something that would
wait for a function to be called with [1, 2, 3], but not necessarily
all at once, and not necessarily in that order.

That is: m:f([1]), m:f([2]), m:f([3]) is just as valid as m:f([1, 2]),
m:f([3]), and as valid as m:f([2]), m:f([3, 1]), and so on.

So: invent a way for meck to update what it's waiting for as the
history is built. By accumulating state as the calls happen, we can
check that the function is called with the correct arguments, whatever
the order.

This is called a 'condition'.

This is a re-written version of PR #253, with that feedback addressed (hopefully).

 When testing some non-deterministic code, I needed something that would
 wait for a function to be called with [1, 2, 3], but not necessarily
 all at once, and not necessarily in that order.

 That is: m:f([1]), m:f([2]), m:f([3]) is just as valid as m:f([1, 2]),
 m:f([3]), and as valid as m:f([2]), m:f([3, 1]), and so on.

 So: invent a way for meck to update what it's waiting for as the
 history is built. By accumulating state as the calls happen, we can
 check that the function is called with the correct arguments, whatever
 the order.

 This is called a 'condition'.

 Doc comment updates to follow in a later commit.
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