Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename rangeE for clarity #3198

Merged
merged 1 commit into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,5 @@ class ReducibleNonEmptyStreamSuite extends ReducibleSuite[NonEmptyStream]("NonEm
NonEmptyStream(start, tailStart.to(endInclusive).toStream)
}

def rangeE[L, R](el: Either[L, R], els: Either[L, R]*): NonEmptyStream[Either[L, R]] =
NonEmptyStream(el, els: _*)
def fromValues[A](el: A, els: A*): NonEmptyStream[A] = NonEmptyStream(el, els: _*)
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,5 @@ class ReducibleNonEmptyLazyListSuite extends ReducibleSuite[NonEmptyLazyList]("N
def range(start: Long, endInclusive: Long): NonEmptyLazyList[Long] =
NonEmptyLazyList(start, (start + 1L).to(endInclusive): _*)

def rangeE[L, R](el: Either[L, R], els: Either[L, R]*): NonEmptyLazyList[Either[L, R]] =
NonEmptyLazyList(el, els: _*)
def fromValues[A](el: A, els: A*): NonEmptyLazyList[A] = NonEmptyLazyList(el, els: _*)
}
3 changes: 1 addition & 2 deletions tests/src/test/scala/cats/tests/NonEmptyChainSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,5 @@ class ReducibleNonEmptyChainSuite extends ReducibleSuite[NonEmptyChain]("NonEmpt
def range(start: Long, endInclusive: Long): NonEmptyChain[Long] =
NonEmptyChain(start, (start + 1L).to(endInclusive): _*)

def rangeE[L, R](el: Either[L, R], els: Either[L, R]*): NonEmptyChain[Either[L, R]] =
NonEmptyChain(el, els: _*)
def fromValues[A](el: A, els: A*): NonEmptyChain[A] = NonEmptyChain(el, els: _*)
}
3 changes: 1 addition & 2 deletions tests/src/test/scala/cats/tests/NonEmptyListSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,5 @@ class ReducibleNonEmptyListSuite extends ReducibleSuite[NonEmptyList]("NonEmptyL
NonEmptyList(start, (tailStart).to(endInclusive).toList)
}

def rangeE[L, R](el: Either[L, R], els: Either[L, R]*): NonEmptyList[Either[L, R]] =
NonEmptyList(el, List(els: _*))
def fromValues[A](el: A, els: A*): NonEmptyList[A] = NonEmptyList(el, List(els: _*))
}
3 changes: 1 addition & 2 deletions tests/src/test/scala/cats/tests/NonEmptyVectorSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,5 @@ class ReducibleNonEmptyVectorSuite extends ReducibleSuite[NonEmptyVector]("NonEm
NonEmptyVector(start, (tailStart).to(endInclusive).toVector)
}

def rangeE[L, R](el: Either[L, R], els: Either[L, R]*): NonEmptyVector[Either[L, R]] =
NonEmptyVector(el, Vector(els: _*))
def fromValues[A](el: A, els: A*): NonEmptyVector[A] = NonEmptyVector(el, Vector(els: _*))
}
6 changes: 3 additions & 3 deletions tests/src/test/scala/cats/tests/ReducibleSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ abstract class ReducibleSuite[F[_]: Reducible](name: String)(implicit ArbFInt: A
extends FoldableSuite[F](name) {

def range(start: Long, endInclusive: Long): F[Long]
def rangeE[L, R](el: Either[L, R], els: Either[L, R]*): F[Either[L, R]]
def fromValues[A](el: A, els: A*): F[A]

test(s"Reducible[$name].reduceLeftM stack safety") {
def nonzero(acc: Long, x: Long): Option[Long] =
Expand All @@ -120,13 +120,13 @@ abstract class ReducibleSuite[F[_]: Reducible](name: String)(implicit ArbFInt: A

test(s"Reducible[$name].reduceA successful case") {
val expected = 6
val actual = rangeE(1.asRight[String], 2.asRight[String], 3.asRight[String]).reduceA
val actual = fromValues(1.asRight[String], 2.asRight[String], 3.asRight[String]).reduceA
actual should ===(expected.asRight[String])
}

test(s"Reducible[$name].reduceA failure case") {
val expected = "boom!!!"
val actual = rangeE(1.asRight, "boom!!!".asLeft, 3.asRight).reduceA
val actual = fromValues(1.asRight, "boom!!!".asLeft, 3.asRight).reduceA
actual should ===(expected.asLeft[Int])
}

Expand Down