mirror of
https://github.com/logos-storage/nim-chronos.git
synced 2026-01-07 16:03:09 +00:00
add failing test case for an async proc with children in its finally block
This commit is contained in:
parent
1d5d02cfa4
commit
ade1f3018e
@ -107,4 +107,28 @@ suite "profiler hooks test suite":
|
||||
SimpleEvent(state: ExtendedFutureState.Running, procedure: "withChildren"),
|
||||
SimpleEvent(state: ExtendedFutureState.Running, procedure: "segment 2"),
|
||||
SimpleEvent(state: ExtendedFutureState.Completed, procedure: "withChildren"),
|
||||
]
|
||||
]
|
||||
|
||||
test "should not say a future is completed before children in finally blocks are run":
|
||||
skip()
|
||||
when false:
|
||||
# TODO: chronos allows completed futures to generate children in their
|
||||
# finally blocks. This causes a set of transitions that break our state
|
||||
# machine.
|
||||
proc withFinally(): Future[void] {.async.} =
|
||||
try:
|
||||
return
|
||||
finally:
|
||||
await sleepAsync(10.milliseconds)
|
||||
|
||||
waitFor withFinally()
|
||||
|
||||
check recording == @[
|
||||
SimpleEvent(state: Pending, procedure: "withFinally"),
|
||||
SimpleEvent(state: ExtendedFutureState.Running, procedure: "withFinally"),
|
||||
SimpleEvent(state: ExtendedFutureState.Pending, procedure: "chronos.sleepAsync(Duration)"),
|
||||
SimpleEvent(state: ExtendedFutureState.Paused, procedure: "withFinally"),
|
||||
SimpleEvent(state: ExtendedFutureState.Completed, procedure: "chronos.sleepAsync(Duration)"),
|
||||
SimpleEvent(state: ExtendedFutureState.Running, procedure: "withFinally"),
|
||||
SimpleEvent(state: ExtendedFutureState.Completed, procedure: "withFinally")
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user