Skip to content

Commit 58246ca

Browse files
committed
PublisherBackpressureTest fixed to account for immediate onComplete
when publisher coroutine is cancelled
1 parent 1b9cbf4 commit 58246ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reactive/kotlinx-coroutines-reactive/src/test/kotlin/kotlinx/coroutines/experimental/reactive/PublisherBackpressureTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class PublisherBackpressureTest : TestBase() {
3636
try {
3737
send("C") // will suspend (no more requested)
3838
} finally {
39-
expect(12)
39+
expect(13)
4040
}
4141
expectUnreached()
4242
}
@@ -58,7 +58,7 @@ class PublisherBackpressureTest : TestBase() {
5858
}
5959

6060
override fun onComplete() {
61-
expect(13)
61+
expect(11)
6262
}
6363

6464
override fun onError(e: Throwable) {
@@ -68,8 +68,8 @@ class PublisherBackpressureTest : TestBase() {
6868
expect(4)
6969
yield() // yield to observable coroutine
7070
expect(10)
71-
sub!!.cancel() // now unsubscribe -- shall cancel coroutine
72-
expect(11)
71+
sub!!.cancel() // now unsubscribe -- shall cancel coroutine & immediately signal onComplete
72+
expect(12)
7373
yield() // shall perform finally in coroutine & report onComplete
7474
finish(14)
7575
}

0 commit comments

Comments
 (0)