Skip to content

Instantly share code, notes, and snippets.

@aph5nt
Created March 14, 2015 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aph5nt/5dd1a866e7e2efb24bae to your computer and use it in GitHub Desktop.
Save aph5nt/5dd1a866e7e2efb24bae to your computer and use it in GitHub Desktop.
let findOk result item =
result
|> successTee (fun (obj, msgs) ->
let found = msgs |> List.toSeq |> Seq.tryFind (fun(m) -> m = item)
match found with
| Some msg -> msg |> should be (sameAs item)
| None -> failwith(sprintf "%s not found" item)
)
let findFailure result item =
result
|> failureTee (fun (msgs) ->
let found = msgs |> List.toSeq |> Seq.tryFind (fun(m) -> m = item)
match found with
| Some msg -> msg |> should be (sameAs item)
| None -> failwith(sprintf "%s not found" item)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment