Created
January 12, 2020 00:03
-
-
Save RBusarow/173a743b86b490689fc58729aebc6317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalCoroutinesApi | |
interface TestPolymorphicCoroutineScope : TestCoroutineScope, | |
DefaultCoroutineScope, | |
IOCoroutineScope, | |
MainCoroutineScope, | |
MainImmediateCoroutineScope, | |
UnconfinedCoroutineScope | |
@ExperimentalCoroutinesApi | |
private class TestPolymorphicCoroutineScopeImpl( | |
context: CoroutineContext = EmptyCoroutineContext | |
) : TestPolymorphicCoroutineScope, | |
// delegates all functionality to TestCoroutineScope | |
// uses the TestCoroutineScope factory function | |
// to inject the TestCoroutineDispatcher and TestCoroutineExceptionHandler into the context | |
TestCoroutineScope by TestCoroutineScope(context) | |
@ExperimentalCoroutinesApi | |
fun TestPolymorphicCoroutineScope( | |
context: CoroutineContext = EmptyCoroutineContext | |
): TestPolymorphicCoroutineScope = TestPolymorphicCoroutineScopeImpl( | |
context = context + dispatcher | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment