aboutsummaryrefslogtreecommitdiffstats
path: root/reactive/kotlinx-coroutines-reactive/test/CancelledParentAttachTest.kt
blob: 1db10b278d04ffcce776a47cc34ba6fdefbd47c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.coroutines.reactive

import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import org.junit.*


class CancelledParentAttachTest : TestBase() {;

    @Test
    fun testFlow() = runTest {
        val f = flowOf(1, 2, 3).cancellable()
        val j = Job().also { it.cancel() }
        f.asPublisher(j).asFlow().collect()
    }

}