Closed radix closed 9 years ago
How about expect_parallel
?
@cyli wrote a utility in the otter codebase that's kinda close to this:
It only supports effects that wrap one other effect, not multiple, but I think something more general can be extracted (and then be used to build an expect_parallel
function).
@radix is there a common pattern to effects wrapping other effects that can be expected?
Okay, I implemented this in otter:
There should be a utility
assert_parallel
such that you can do something like this:It would allow the listed intents to be specified in any order.
This is better than the idiom of composing in
perform_parallel_async
and then just listing the effects in the top-level SequenceDispatcher for two reasons:ParallelEffects
Sometimes order actually does matter, though, since parallel() guarantees that results are returned in the same order as the passed-in effects (and this is used in practice to perform multiple heterogenous operations at the same time when they have no causality relationship). For that reason, there should also be an
assert_parallel_ordered
function that does ensure the effects are passed to the parallel in the same order that they appear in the test.assert_parallel*
doesn't sound like the greatest name, so do some more thinking about that.