Skip to content

Commit

Permalink
Add async tests for ThrowInner
Browse files Browse the repository at this point in the history
  • Loading branch information
Christer van der Meeren committed Mar 4, 2024
1 parent f716790 commit f455fba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Faqt.Tests/FunctionAssertions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ module ThrowInner =
let ``Passes if throwing matching exception at any level`` (ex: exn) run = run ((fun () -> raise <| ex).Should())


[<Theory>]
[<MemberData(nameof passData)>]
let ``Passes if throwing matching exception at any level from synchronously run async code`` (ex: exn) run =
run ((fun () -> async { return raise <| ex } |> Async.RunSynchronously).Should())


[<Theory>]
[<MemberData(nameof passData)>]
let ``Passes if throwing matching exception at any level from synchronously run task code`` (ex: exn) run =
run ((fun () -> (task { return raise <| ex }).GetAwaiter().GetResult()).Should())


let failData = [
[| box null; throwInner<Exception> |]
[| Exception(); throwInner<ArgumentException> |]
Expand Down

0 comments on commit f455fba

Please sign in to comment.