Add Deferred.joinAll helper
This commit is contained in:
1 parent
402b8bb1b3
commit
c9eb3df93d
2 files changed
+29
No files matched your search
@@ -120,6 +120,25 @@ class TestCoroutines {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testJoinAll() = runTest {
|
||||
eval(
|
||||
"""
|
||||
val replies = (1..6).map { n ->
|
||||
launch {
|
||||
delay((7 - n) * 5)
|
||||
"done:${'$'}n"
|
||||
}
|
||||
}.joinAll()
|
||||
|
||||
assertEquals(
|
||||
["done:1", "done:2", "done:3", "done:4", "done:5", "done:6"],
|
||||
replies
|
||||
)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testFlows() = runTest {
|
||||
eval("""
|
||||
|
||||
Reference in new issue
Block a user