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 28, 2017
1 parent 6b87e2b commit 9a7024a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
27 changes: 27 additions & 0 deletions tests/src/test/scala/cats/tests/AlternativeSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cats
package tests

class AlternativeSuite 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 }
val strings = list.collect { case Right(s) => s }
val expected = (ints, strings)

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

test("guard") {
assert(Alternative[Option].guard(true).isDefined)
assert(Alternative[Option].guard(false).isEmpty)
}
}
14 changes: 0 additions & 14 deletions tests/src/test/scala/cats/tests/MonadCombineSuite.scala

This file was deleted.

0 comments on commit 9a7024a

Please sign in to comment.