mirror of
https://github.com/Smaug123/unofficial-nunit-runner
synced 2025-10-14 21:18:40 +00:00
Rename from the rather bland "TestRunner" (#61)
This commit is contained in:
30
WoofWare.NUnitTestRunner.Lib/Result.fs
Normal file
30
WoofWare.NUnitTestRunner.Lib/Result.fs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace WoofWare.NUnitTestRunner
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module internal Result =
|
||||
|
||||
let inline getError<'r, 'e> (r : Result<'r, 'e>) : 'e option =
|
||||
match r with
|
||||
| Ok _ -> None
|
||||
| Error e -> Some e
|
||||
|
||||
let get<'r, 'e> (r : Result<'r, 'e>) : 'r option =
|
||||
match r with
|
||||
| Ok r -> Some r
|
||||
| Error _ -> None
|
||||
|
||||
let allOkOrError<'o, 'e> (a : Result<'o, 'e> list) : Result<'o list, 'o list * 'e list> =
|
||||
let oks = ResizeArray ()
|
||||
let errors = ResizeArray ()
|
||||
|
||||
for i in a do
|
||||
match i with
|
||||
| Error e -> errors.Add e
|
||||
| Ok o -> oks.Add o
|
||||
|
||||
let oks = oks |> Seq.toList
|
||||
|
||||
if errors.Count = 0 then
|
||||
Ok oks
|
||||
else
|
||||
Error (oks, Seq.toList errors)
|
Reference in New Issue
Block a user