File tree 2 files changed +29
-1
lines changed
native/kotlinx-coroutines-core-native
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import kotlin.coroutines.*
8
8
import kotlinx.coroutines.internal.*
9
9
10
10
private fun takeEventLoop (): EventLoopImpl =
11
- ThreadLocalEventLoop .currentOrNull() as EventLoopImpl ? :
11
+ ThreadLocalEventLoop .currentOrNull() as ? EventLoopImpl ? :
12
12
error(" There is no event loop. Use runBlocking { ... } to start one." )
13
13
14
14
internal object DefaultExecutor : CoroutineDispatcher(), Delay {
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
+ */
4
+
5
+ package kotlinx.coroutines
6
+
7
+ import kotlin.coroutines.*
8
+ import kotlin.test.Test
9
+ import kotlin.test.assertTrue
10
+
11
+ class DelayExceptionTest {
12
+ private object Dispatcher : CoroutineDispatcher() {
13
+ override fun isDispatchNeeded (context : CoroutineContext ): Boolean = true
14
+ override fun dispatch (context : CoroutineContext , block : Runnable ) { block.run () }
15
+ }
16
+
17
+ private lateinit var exception: Throwable
18
+
19
+
20
+ @Test
21
+ fun testThrowsTce () {
22
+ CoroutineScope (Dispatcher + CoroutineExceptionHandler { _, e -> exception = e }).launch {
23
+ delay(10 )
24
+ }
25
+
26
+ assertTrue(exception is IllegalStateException )
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments