RBusarow / Dispatch

Automatic CoroutineDispatcher injection and extensions for kotlinx.coroutines

Home Page:https://rbusarow.github.io/Dispatch/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make testProvided's lambda extend TestProvidedCoroutineScope

RBusarow opened this issue · comments

Currently testProvided's lambda receives a TestCoroutineScope. This gives the extra functionality from TestCoroutineDispatcher. TestProvidedCoroutineScope implements TestCoroutineScope.

TestProvidedCoroutineScope doesn't offer any new functionality by way of properties or functions, and the benefits from DispatcherProvider don't require that it's declared as any specific type. So there are two benefits of receiving a TestProvidedCoroutineScope over an ordinary TestCoroutineScope:

  1. The Dispatch version implements all specific CoroutineScope types, so it can be used as an argument regardless of the parameter type.
  2. Any future addition to the scope's API would then require this change, so doing it now is future-proofing.