blob: c872b6a53d633dcb10eb25609fea93620659e7d7 [file] [log] [blame]
Vsevolod Tolstopyatov993c1922020-10-19 03:01:50 -07001/*
2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4package kotlinx.coroutines.debug
5
6import kotlinx.coroutines.*
7import org.junit.Test
8import kotlin.test.*
9
10class LazyCoroutineTest : DebugTestBase() {
11
12 @Test
13 fun testLazyCompletedCoroutine() = runTest {
14 val job = launch(start = CoroutineStart.LAZY) {}
15 job.invokeOnCompletion { expect(2) }
16 expect(1)
17 job.cancelAndJoin()
18 expect(3)
19 assertEquals(1, DebugProbes.dumpCoroutinesInfo().size) // Outer runBlocking
20 verifyPartialDump(1, "BlockingCoroutine{Active}")
21 finish(4)
22 }
23}