diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-23 23:55:41 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-23 23:55:41 +0000 |
commit | ffe1b7dc19f3fbe1bc4a5f4f1e28c64cd68c5371 (patch) | |
tree | 747e5be83c6e6a2e2d9a164ebd03c5e45e6ec952 /kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt | |
parent | 2bbecd60d31b5d0b48847f67e741018f5ae7aa07 (diff) | |
parent | 531d55eaeac09ad6cde55687ef802d4235040985 (diff) | |
download | platform_external_kotlinx.coroutines-ffe1b7dc19f3fbe1bc4a5f4f1e28c64cd68c5371.tar.gz platform_external_kotlinx.coroutines-ffe1b7dc19f3fbe1bc4a5f4f1e28c64cd68c5371.tar.bz2 platform_external_kotlinx.coroutines-ffe1b7dc19f3fbe1bc4a5f4f1e28c64cd68c5371.zip |
Snap for 7668063 from 531d55eaeac09ad6cde55687ef802d4235040985 to simpleperf-releasesimpleperf-release
Change-Id: I844c9c61f2e31a265c36a483e1509e0e08c508d6
Diffstat (limited to 'kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt')
-rw-r--r-- | kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt b/kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt index d2ef3d26..ae05fb8d 100644 --- a/kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt +++ b/kotlinx-coroutines-core/common/test/channels/ChannelUndeliveredElementFailureTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package kotlinx.coroutines.channels @@ -70,36 +70,10 @@ class ChannelUndeliveredElementFailureTest : TestBase() { } @Test - fun testReceiveOrNullCancelledFail() = runTest(unhandled = shouldBeUnhandled) { + fun testReceiveCatchingCancelledFail() = runTest(unhandled = shouldBeUnhandled) { val channel = Channel(onUndeliveredElement = onCancelFail) val job = launch(start = CoroutineStart.UNDISPATCHED) { - channel.receiveOrNull() - expectUnreached() // will be cancelled before it dispatches - } - channel.send(item) - job.cancel() - } - - @Test - fun testReceiveOrNullSelectCancelledFail() = runTest(unhandled = shouldBeUnhandled) { - val channel = Channel(onUndeliveredElement = onCancelFail) - val job = launch(start = CoroutineStart.UNDISPATCHED) { - select<Unit> { - channel.onReceiveOrNull { - expectUnreached() - } - } - expectUnreached() // will be cancelled before it dispatches - } - channel.send(item) - job.cancel() - } - - @Test - fun testReceiveOrClosedCancelledFail() = runTest(unhandled = shouldBeUnhandled) { - val channel = Channel(onUndeliveredElement = onCancelFail) - val job = launch(start = CoroutineStart.UNDISPATCHED) { - channel.receiveOrClosed() + channel.receiveCatching() expectUnreached() // will be cancelled before it dispatches } channel.send(item) @@ -111,7 +85,7 @@ class ChannelUndeliveredElementFailureTest : TestBase() { val channel = Channel(onUndeliveredElement = onCancelFail) val job = launch(start = CoroutineStart.UNDISPATCHED) { select<Unit> { - channel.onReceiveOrClosed { + channel.onReceiveCatching { expectUnreached() } } @@ -140,4 +114,4 @@ class ChannelUndeliveredElementFailureTest : TestBase() { expectUnreached() } -}
\ No newline at end of file +} |