Skip to content

Instantly share code, notes, and snippets.

@blacktaxi
Created July 5, 2015 00:26
Show Gist options
  • Save blacktaxi/7322ee95a51ac4eb39aa to your computer and use it in GitHub Desktop.
Save blacktaxi/7322ee95a51ac4eb39aa to your computer and use it in GitHub Desktop.
Poor man's complex pattern matching in F# tests
let shouldMatch f x =
try f x |> ignore
with :? MatchFailureException as e ->
failwithf "Did not expect %A" x
[<Test>]
let ``something should something`` () =
some "complicated" (funct "call")
|> shouldMatch (function | This (That _) _ And (These "things") -> ())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment