marcinmoskala
11/13/2021, 4:48 PMTestCoroutineDispatcher
is waiting for cancelled tasks.
@Test
fun test() = runBlockingTest {
val job = launch {
launch { delay(1000) }
launch { delay(1000) }
}
delay(100)
job.cancel()
// then
advanceUntilIdle()
assertEquals(100, currentTime) // Should be true, because after 100 everything is cancelled,
// but it says expected:<100> but was:<1000>
}
I've created an issue here.Joffrey
11/13/2021, 4:50 PMdelay(100)
instead of advanceTimeBy(100)
in your test method though?marcinmoskala
11/16/2021, 10:46 AMJoffrey
11/16/2021, 11:48 AMmarcinmoskala
11/16/2021, 1:40 PM