Skip to content

Commit ed69854

Browse files
committed
ObservableBackpressureTest fixed to account for immediate onComplete
when publisher coroutine is cancelled
1 parent ba0c004 commit ed69854

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reactive/kotlinx-coroutines-rx1/src/test/kotlin/kotlinx/coroutines/experimental/rx1/ObservableBackpressureTest.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ObservableBackpressureTest : TestBase() {
3535
try {
3636
send("C") // will suspend (no more requested)
3737
} finally {
38-
expect(12)
38+
expect(13)
3939
}
4040
expectUnreached()
4141
}
@@ -55,7 +55,7 @@ class ObservableBackpressureTest : TestBase() {
5555
}
5656

5757
override fun onCompleted() {
58-
expect(13)
58+
expect(11)
5959
}
6060

6161
override fun onError(e: Throwable) {
@@ -65,8 +65,8 @@ class ObservableBackpressureTest : TestBase() {
6565
expect(4)
6666
yield() // yield to observable coroutine
6767
expect(10)
68-
sub.unsubscribe() // now unsubscribe -- shall cancel coroutine
69-
expect(11)
68+
sub.unsubscribe() // now unsubscribe -- shall cancel coroutine & immediately signal onComplete
69+
expect(12)
7070
yield() // shall perform finally in coroutine & invoke onCompleted
7171
finish(14)
7272
}

0 commit comments

Comments
 (0)