Add Lyng deferred cancellation support
This commit is contained in:
1 parent
3e338f3d53
commit
311cf6ee44
8 files changed
+180
-66
No files matched your search
@@ -58,6 +58,30 @@ class TestCoroutines {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDeferredCancel() = runTest {
|
||||
eval(
|
||||
"""
|
||||
var reached = false
|
||||
val d = launch {
|
||||
delay(100)
|
||||
reached = true
|
||||
"ok"
|
||||
}
|
||||
|
||||
d.cancel()
|
||||
d.cancel()
|
||||
assertThrows(CancellationException) { d.await() }
|
||||
|
||||
delay(150)
|
||||
|
||||
assert(d.isCancelled)
|
||||
assert(!d.isActive)
|
||||
assert(!reached)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMutex() = runTest {
|
||||
eval(
|
||||
|
||||
Reference in new issue
Block a user