Uh oh!
There was an error while loading. Please reload this page.
Change cancellation test to not depend on how AwaitTask works - #7467
Conversation
Frassle
commented
Aug 29, 2019
@matthid I think this test is still testing what you intended it to. |
matthid
commented
Aug 29, 2019
No, the test was exactly how I intended it ;) |
This test is to check that when an Async is started as a Task (via StartAsTask) that when cancelled the Task isn't immediately marked as cancelled but instead waits for the underlying Async to finish (normally via cancellation)
5b96759 to
75500f1CompareBit sad that it tested both the behaviour of StartAsTask and AwaitTask in the same test. How about now, split into two tests, does that still test what you intended? |
matthid
commented
Aug 29, 2019
Yes I think they do, though testing those two primitives together is probably fine as they are often used together as well. In any case increasing test coverage is a good thing. |
| let innerTcs = new TaskCompletionSource<unit>() | ||
| let a = innerTcs.Task |> Async.AwaitTask | ||
| Async.StartWithContinuations(a, tcs.SetResult, tcs.SetException, ignore >> tcs.SetCanceled, cts.Token) |
There was a problem hiding this comment.
This looks a bit bogus to me you await the task here and use setresult as continuation. But if the task finished setresult is already called and the continuation will throw
There was a problem hiding this comment.
Ah you have two tcs so this is basically just StartAsTask or very similar
There was a problem hiding this comment.
tcs vs innerTcs, this is setting the tcs result, while the task that we AwaitTask on is from innerTcs.
KevinRansom
commented
Sep 1, 2019
@Frassle, I'm not sure I understand what benefits, this test change achieves. Are you sure you wish to perservere with this PR? |
Prompted by comments on #7357 (which is a PR to fix #2127). It was pointed out that That use of |
KevinRansom
left a comment
There was a problem hiding this comment.
Thanks for this contribution.
Kevin
…#7467) * Change cancellation test to not depend on how AwaitTask works This test is to check that when an Async is started as a Task (via StartAsTask) that when cancelled the Task isn't immediately marked as cancelled but instead waits for the underlying Async to finish (normally via cancellation) * Add test that AwaitTask ignore async cancellation
This test is to check that when an Async is started as a Task (via
StartAsTask) that when cancelled the Task isn't immediately marked as
cancelled but instead waits for the underlying Async to finish (normally
via cancellation)
Prompted from comments on #7357.