Skip to content

Commit

Permalink
Tests: MonadCombine->Alternative, add missing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
vendethiel committed Nov 23, 2017
1 parent 6b87e2b commit 3a4734e
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ package cats
package tests

class MonadCombineSuite extends CatsSuite {
test("unite") {
forAll { (list: List[Option[String]]) =>
val expected = list.collect { case Some(s) => s }

Alternative[List].unite(list) should === (expected)
}
}

test("separate") {
forAll { (list: List[Either[Int, String]]) =>
val ints = list.collect { case Left(i) => i }
Expand All @@ -11,4 +19,10 @@ class MonadCombineSuite extends CatsSuite {
Alternative[List].separate(list) should === (expected)
}
}

test("guard") {
forAll { (b: Boolean) =>
Alternative[Option].guard(b).isDefined should === (b)
}
}
}

0 comments on commit 3a4734e

Please sign in to comment.