-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: MonadCombine->Alternative, add missing ones
- Loading branch information
1 parent
6b87e2b
commit 9a7024a
Showing
2 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.