From 242b703511d054ce67d04523d73749f6c7fdeadc Mon Sep 17 00:00:00 2001 From: Micah Mutrux Date: Sun, 8 Oct 2017 12:06:43 -0400 Subject: [PATCH] Break up large group of .combine() tests --- src/main/scala/catslib/Semigroup.scala | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/scala/catslib/Semigroup.scala b/src/main/scala/catslib/Semigroup.scala index 89d8866..3caec49 100644 --- a/src/main/scala/catslib/Semigroup.scala +++ b/src/main/scala/catslib/Semigroup.scala @@ -45,25 +45,27 @@ object SemigroupSection * guess how it works in the following examples: * */ - def semigroupCombine( - res0: Int, - res1: List[Int], - res2: Option[Int], - res3: Option[Int], - res4: Int) = { + def semigroupCombine(res0: Int, res1: List[Int], res2: Option[Int], res3: Option[Int]) = { import cats.implicits._ Semigroup[Int].combine(1, 2) should be(res0) Semigroup[List[Int]].combine(List(1, 2, 3), List(4, 5, 6)) should be(res1) Semigroup[Option[Int]].combine(Option(1), Option(2)) should be(res2) Semigroup[Option[Int]].combine(Option(1), None) should be(res3) + } + + /** And now try a slightly more complex combination: + */ + def semigroupCombineComplex(res0: Int) = { + import cats.implicits._ + Semigroup[Int ⇒ Int] .combine({ (x: Int) ⇒ x + 1 }, { (x: Int) ⇒ x * 10 }) - .apply(6) should be(res4) + .apply(6) should be(res0) } /** Many of these types have methods defined directly on them,