add failing test case for an async proc with children in its finally block

This commit is contained in:
gmega 2023-11-28 18:43:22 -03:00
parent 1d5d02cfa4
commit ade1f3018e
No known key found for this signature in database
GPG Key ID: FFD8DAF00660270F

View File

@ -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")
]