Skip to content

Commit

Permalink
Merge pull request fsprojects#9 from rneatherway/master
Browse files Browse the repository at this point in the history
Allow a function to check for containment
  • Loading branch information
dmohl committed Apr 28, 2013
2 parents 51df6a9 + a4cf884 commit 98f0164
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/FsUnit.CustomMatchers/CustomMatchers.fs
Expand Up @@ -69,3 +69,10 @@ let contain x = CustomMatcher<obj>(sprintf "Contains %s" (x.ToString()),
| :? seq<_> as s -> s |> Seq.exists(fun i -> i = x)
| _ -> false)

let containf f = CustomMatcher<obj>(sprintf "Contains %s" (f.ToString()),
fun c -> match c with
| :? list<_> as l -> l |> List.exists f
| :? array<_> as a -> a |> Array.exists f
| :? seq<_> as s -> s |> Seq.exists f
| _ -> false)

0 comments on commit 98f0164

Please sign in to comment.