Turbine question: what's the difference between `e...
# coroutines
s
Turbine question: what's the difference between
expectNoEvents()
and
ensureAllEventsConsumed()
?
From the API doc:
• `expectNoEvents()`: Assert that there are no unconsumed events which have already been received.
• `ensureAllEventsConsumed()`: Assert that all events that have occurred so far on this ReceiveTurbine have been consumed.
That sounds like the same words in a different order, unless I'm missing something
k
Sorry, but I don't see
ensureAllEventsConsumed
listed here? https://cashapp.github.io/turbine/docs/1.x/-turbine/app.cash.turbine/index.html
Which version are you using?
(They're member functions, not extensions, so they don't show up in the navigation sidebar)
👍 1
k
They definitely seem slightly different but the docs are very similar. I'm not sure. Maybe cross post into #C5HT9AL7Q?
s
Thanks, didn't know about that channel 👍
r
Looking at the code I only see two very subtle differences: • ensureAllEventsConsumed respects cancelAndIgnoreRemainingEvents to treat ignored events as consumed • ensureAllEventsConsumed includes all events in the failure message whereas expectNoEvents only includes the first. This might be useful or noisy depending on how many events you have
Also of interest is that prior to this refactor, ensureAllEventsConsumed was an internal API, not part of the public interface. It's not entirely obvious whether this change was intentional
s
Thanks! @jw do you have any more insight?
j
Not off the top of my head. You can file an issue and I can look when I have time, or maybe Bill will
🙇 1