timrijckaert
11/14/2018, 9:53 AM@Test
fun channelEmissionsTest() {
fun CoroutineScope.produceInts(amount: Int = 10): ReceiveChannel<Int> =
produce {
(0..amount).onEach {
offer(it)
}
}
GlobalScope.launch(Dispatchers.Unconfined) {
val list = produceInts().toList()
assertEquals(11, list.size)
}
}
Exception in thread "main @coroutine#1" java.lang.AssertionError: expected:<11> but was:<1>