File tree 1 file changed +15
-1
lines changed
kotlinx-coroutines-core/common/test/flow/operators
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2
+ * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
3
*/
4
4
5
5
package kotlinx.coroutines.flow
@@ -238,6 +238,20 @@ abstract class CombineTestBase : TestBase() {
238
238
assertFailsWith<CancellationException >(flow)
239
239
finish(7 )
240
240
}
241
+
242
+ @Test
243
+ fun testCancelledCombine () = runTest {
244
+ coroutineScope {
245
+ val flow = flow {
246
+ emit(Unit ) // emit to buffer
247
+ cancel() // now cancel
248
+ }
249
+ flow.combineLatest(flow) { u, _ -> u }.collect {
250
+ // should not be reached, because cancelled before it runs
251
+ expectUnreached()
252
+ }
253
+ }
254
+ }
241
255
}
242
256
243
257
class CombineTest : CombineTestBase () {
You can’t perform that action at this time.
0 commit comments