File tree 1 file changed +35
-0
lines changed
kotlinx-coroutines-core/native/test
1 file changed +35
-0
lines changed 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.native.concurrent.*
9
+ import kotlin.test.*
10
+
11
+ class WorkerTest : TestBase () {
12
+
13
+ @Test
14
+ fun testLaunchInWorker () {
15
+ val worker = Worker .start()
16
+ worker.execute(TransferMode .SAFE , { }) {
17
+ runBlocking {
18
+ launch { }.join()
19
+ delay(1 )
20
+ }
21
+ }.result
22
+ }
23
+
24
+ @Test
25
+ fun testLaunchInWorkerTroughGlobalScope () {
26
+ val worker = Worker .start()
27
+ worker.execute(TransferMode .SAFE , { }) {
28
+ runBlocking {
29
+ CoroutineScope (EmptyCoroutineContext ).launch {
30
+ delay(1 )
31
+ }.join()
32
+ }
33
+ }.result
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments