File tree 2 files changed +12
-0
lines changed
kotlinx-coroutines-core/common
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,7 @@ private fun <T> Flow<T>.timeoutInternal(
394
394
value.onSuccess {
395
395
downStream.emit(it)
396
396
}.onClosed {
397
+ it?.let { throw it }
397
398
return @onReceiveCatching false
398
399
}
399
400
return @onReceiveCatching true
Original file line number Diff line number Diff line change @@ -237,6 +237,17 @@ class TimeoutTest : TestBase() {
237
237
testImmediateTimeout(- 1 .seconds)
238
238
}
239
239
240
+ @Test
241
+ fun testClosing () = runTest {
242
+ assertFailsWith<TestException > {
243
+ channelFlow<Int > { close(TestException ()) }
244
+ .timeout(Duration .INFINITE )
245
+ .collect {
246
+ expectUnreached()
247
+ }
248
+ }
249
+ }
250
+
240
251
private fun testImmediateTimeout (timeout : Duration ) {
241
252
expect(1 )
242
253
val flow = emptyFlow<Int >().timeout(timeout)
You can’t perform that action at this time.
0 commit comments