Skip to content

Commit 6fdd858

Browse files
committed
test: Fix flows that emit Units
1 parent 1cccec4 commit 6fdd858

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

krpc/krpc-test/src/commonMain/kotlin/kotlinx/rpc/krpc/test/KrpcTestService.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ interface KrpcTestService : RemoteService {
113113

114114
suspend fun krpc173()
115115

116+
fun unitFlow(): Flow<Unit>
117+
116118
val plainFlowOfInts : Flow<Int>
117119

118120
val plainFlowOfFlowsOfInts : Flow<Flow<Int>>

krpc/krpc-test/src/commonMain/kotlin/kotlinx/rpc/krpc/test/KrpcTestServiceBackend.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ class KrpcTestServiceBackend(override val coroutineContext: CoroutineContext) :
282282
doWork()
283283
}
284284

285+
override fun unitFlow(): Flow<Unit> {
286+
return flow {
287+
emit(Unit)
288+
}
289+
}
290+
285291
override val plainFlowOfInts: Flow<Int> = plainFlow { it }
286292

287293
override val plainFlowOfFlowsOfInts: Flow<Flow<Int>> = plainFlow { plainFlow { i -> i } }

krpc/krpc-test/src/commonMain/kotlin/kotlinx/rpc/krpc/test/KrpcTransportTestBase.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,11 @@ abstract class KrpcTransportTestBase {
569569
assertEquals(Unit, client.krpc173())
570570
}
571571

572+
@Test
573+
fun testUnitFlow() = runTest {
574+
assertEquals(Unit, client.unitFlow().toList().single())
575+
}
576+
572577
@Test
573578
fun testPlainFlowOfInts() = runTest {
574579
val flow = client.plainFlowOfInts.toList()

0 commit comments

Comments
 (0)