File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -265,26 +265,27 @@ type CancellationType() =
265265
266266 let cts = new CancellationTokenSource()
267267 let tcs = System.Threading.Tasks.TaskCompletionSource<_>()
268- let test () =
268+ let t =
269269 async {
270270 do ! tcs.Task |> Async.AwaitTask
271271 }
272- |> StartAsTaskProperCancel None ( Some cts.Token) :> Task
272+ |> StartAsTaskProperCancel None ( Some cts.Token)
273273
274274 // First cancel the token, then set the task as cancelled.
275275 async {
276276 do ! Async.Sleep 100
277277 cts.Cancel()
278278 do ! Async.Sleep 100
279279 tcs.TrySetException ( TimeoutException " Task timed out after token." )
280- |> ignore
280+ |> ignore
281281 } |> Async.Start
282282
283- task {
284- let! agg = Assert.ThrowsAsync< AggregateException>( test)
285- let inner = agg.InnerException
286- Assert.True( inner : ? TimeoutException , $"Excepted TimeoutException wrapped in an AggregateException , but got % A { inner } " )
287- }
283+ try
284+ let res = t.Wait( 2000 )
285+ let msg = sprintf " Excepted TimeoutException wrapped in an AggregateException, but got %A " res
286+ printfn " failure msg: %s " msg
287+ Assert.Fail ( msg)
288+ with :? AggregateException as agg -> ()
288289
289290 // Simpler regression test for https://github.com/dotnet/fsharp/issues/3254
290291 [<Fact>]
You can’t perform that action at this time.
0 commit comments