Skip to content

Commit

Permalink
Unifies tests naming standard
Browse files Browse the repository at this point in the history
- Renames tests in `cats.tests` package with the "Suite" suffix,
according to typelevel#1960 and typelevel#1965.
  • Loading branch information
AlejandroME committed Oct 16, 2017
1 parent 167d5b4 commit ddb030d
Show file tree
Hide file tree
Showing 74 changed files with 117 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cats.free.FreeInvariantMonoidal
import cats.laws.discipline.{InvariantMonoidalTests, SerializableTests}
import cats.laws.discipline.SemigroupalTests.Isomorphisms
import org.scalacheck.{Arbitrary, Gen}
import cats.tests.CsvCodecInvariantMonoidalTests._
import cats.tests.CsvCodecInvariantMonoidalSuite._

class FreeInvariantMonoidalTests extends CatsSuite {
implicit def freeInvariantMonoidalArbitrary[F[_], A](implicit F: Arbitrary[F[A]], A: Arbitrary[A]): Arbitrary[FreeInvariantMonoidal[F, A]] =
Expand Down
2 changes: 1 addition & 1 deletion free/src/test/scala/cats/free/FreeTTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ trait FreeTTestsInstances {
import FreeT._
import IndexedStateT._
import cats.kernel.instances.option._
import cats.tests.IndexedStateTTests._
import cats.tests.IndexedStateTSuite._
import SemigroupalTests._

type IntState[A] = State[Int, A]
Expand Down
6 changes: 3 additions & 3 deletions tests/src/test/scala-2.11+/cats/tests/RegressionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package cats
package tests


import ExtraRegressionTests._
import ExtraRegressionSuite._

class ExtraRegressionTests extends CatsSuite {
class ExtraRegressionSuite extends CatsSuite {
/**
* Placed here to work around scala/bug#6260 on scala 2.10
*/
Expand All @@ -14,7 +14,7 @@ class ExtraRegressionTests extends CatsSuite {
}


object ExtraRegressionTests {
object ExtraRegressionSuite {
final case class First[A](getFirst: A) extends AnyVal
object First {
implicit def showInstance[A](implicit ev: Show[A]): Show[First[A]] = new Show[First[A]] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cats.laws.discipline.{InvariantMonoidalTests, InvariantTests, Serializabl
import cats.laws.discipline.eq._
import org.scalacheck.{Arbitrary, Gen}

class AlgebraInvariantTests extends CatsSuite {
class AlgebraInvariantSuite extends CatsSuite {

val intMultiplication: Monoid[Int] = new Monoid[Int] {
val empty = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tests

import cats.data.EitherT

class ApplicativeErrorCheck extends CatsSuite {
class ApplicativeErrorSuite extends CatsSuite {
val failed: Option[Int] =
(()).raiseError[Option, Int]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package tests
import cats.Applicative


class ApplicativeCheck extends CatsSuite {
class ApplicativeSuite extends CatsSuite {

test("Applicative#traverse is equivalent to Traverse#traverse") {
val f: (Int) => Option[Int] = x => Some(x + 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package tests
import cats.laws.discipline.{CategoryTests, SerializableTests}
import org.scalacheck.{Arbitrary, Gen}
import cats.arrow.Category
class AsTests extends CatsSuite {
class AsSuite extends CatsSuite {
import evidence._

def toMap[A, B, X](fa: List[X])(implicit ev: X <~< (A,B)): Map[A,B] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tests

import cats.laws.discipline.{BifoldableTests, SerializableTests}

class BifoldableTest extends CatsSuite {
class BifoldableSuite extends CatsSuite {
type EitherEither[A, B] = Either[Either[A, B], Either[A, B]]
val eitherComposeEither: Bifoldable[EitherEither] =
Bifoldable[Either].compose[Either]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package tests
import cats.Bifunctor
import cats.laws.discipline.{BifunctorTests, FunctorTests, SerializableTests}

class BifunctorTest extends CatsSuite {
class BifunctorSuite extends CatsSuite {
type Tuple2Either[A, B] = (Either[A, B], Either[A, B])
val tuple2ComposeEither: Bifunctor[Tuple2Either] =
Bifunctor[Tuple2].compose[Either]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.scalacheck.Arbitrary.arbitrary

import scala.collection.immutable.BitSet

class BitSetTests extends CatsSuite {
class BitSetSuite extends CatsSuite {
implicit val arbitraryBitSet: Arbitrary[BitSet] =
Arbitrary(arbitrary[List[Short]].map(ns => BitSet(ns.map(_ & 0xffff): _*)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tests

import cats.laws.discipline.{BitraverseTests, SerializableTests}

class BitraverseTest extends CatsSuite {
class BitraverseSuite extends CatsSuite {
type EitherTuple2[A, B] = Either[(A, B), (A, B)]
val eitherComposeTuple2: Bitraverse[EitherTuple2] =
Bitraverse[Either].compose[Tuple2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import cats.arrow.Category
import cats.laws.discipline.{MonoidKTests, SerializableTests}
import cats.laws.discipline.eq.catsLawsEqForFn1

class CategoryTest extends CatsSuite {
class CategorySuite extends CatsSuite {
val functionCategory = Category[Function1]
type Endo[A] = Function1[A, A]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import cats.laws.discipline.arbitrary._
import cats.laws.discipline.eq._
import org.scalacheck.Arbitrary

class CokleisliTests extends SlowCatsSuite {
class CokleisliSuite extends SlowCatsSuite {

implicit override val generatorDrivenConfig: PropertyCheckConfiguration =
slowCheckConfiguration.copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import cats.arrow.Compose
import cats.laws.discipline.{SemigroupKTests, SerializableTests}
import cats.laws.discipline.eq.catsLawsEqForFn1

class ComposeTest extends CatsSuite {
class ComposeSuite extends CatsSuite {
val functionCompose = Compose[Function1]
type Endo[A] = Function1[A, A]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import cats.data.{Const, NonEmptyList}
import cats.laws.discipline._
import cats.laws.discipline.arbitrary._

class ConstTests extends CatsSuite {
class ConstSuite extends CatsSuite {

implicit val iso = SemigroupalTests.Isomorphisms.invariant[Const[String, ?]](Const.catsDataTraverseForConst)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package tests
import cats.data.Const
import org.scalactic.CanEqual

class ContravariantTest extends CatsSuite {
class ContravariantSuite extends CatsSuite {

test("narrow equals contramap(identity)") {
implicit val constInst = Const.catsDataContravariantForConst[Int]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import cats.syntax.apply._
import cats.Eq
import org.scalacheck.{Arbitrary, Gen}

object CsvCodecInvariantMonoidalTests {
object CsvCodecInvariantMonoidalSuite {
type CSV = List[String]

/**
Expand Down Expand Up @@ -83,9 +83,9 @@ object CsvCodecInvariantMonoidalTests {
catsLawsEqForFn1[A, CSV].on[CsvCodec[A]](_.write) and catsLawsEqForFn1[CSV, (Option[A], CSV)].on[CsvCodec[A]](_.read)
}

class CsvCodecInvariantMonoidalTests extends CatsSuite {
class CsvCodecInvariantMonoidalSuite extends CatsSuite {
// Eveything is defined in a companion object to be serializable.
import CsvCodecInvariantMonoidalTests._
import CsvCodecInvariantMonoidalSuite._

checkAll("InvariantMonoidal[CsvCodec]", InvariantMonoidalTests[CsvCodec].invariantMonoidal[Int, Int, Int])
checkAll("InvariantMonoidal[CsvCodec]", SerializableTests.serializable(InvariantMonoidal[CsvCodec]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import cats.laws.discipline._
import cats.laws.discipline.arbitrary._
import cats.laws.discipline.eq._

class EitherKTests extends CatsSuite {
class EitherKSuite extends CatsSuite {

checkAll("EitherK[Option, Option, ?]", TraverseTests[EitherK[Option, Option, ?]].traverse[Int, Int, Int, Int, Option, Option])
checkAll("Traverse[EitherK[Option, Option, ?]]", SerializableTests.serializable(Traverse[EitherK[Option, Option, ?]]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import cats.kernel.laws.discipline.{
}
import scala.util.Try

class EitherTests extends CatsSuite {
class EitherSuite extends CatsSuite {
implicit val iso = SemigroupalTests.Isomorphisms.invariant[Either[Int, ?]]

checkAll("Either[String, Int]", MonoidLawTests[Either[String, Int]].monoid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EqTests => EqLawTests
}


class EitherTTests extends CatsSuite {
class EitherTSuite extends CatsSuite {
implicit val iso = SemigroupalTests.Isomorphisms.invariant[EitherT[ListWrapper, String, ?]](EitherT.catsDataFunctorForEitherT(ListWrapper.functor))

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.scalatest._



class EqTests extends FunSuite {
class EqSuite extends FunSuite {
{
import cats.implicits._
Invariant[Eq]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cats.laws.discipline.arbitrary._
import cats.laws.discipline._
import cats.laws.discipline.eq._

class EquivTests extends CatsSuite {
class EquivSuite extends CatsSuite {

Invariant[Equiv]
Contravariant[Equiv]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.scalacheck.Arbitrary.arbitrary
import scala.annotation.tailrec
import scala.math.min

class EvalTests extends CatsSuite {
class EvalSuite extends CatsSuite {
implicit val eqThrow: Eq[Throwable] = Eq.allEqual

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cats.tests

import cats.evidence._

class EvidenceTests extends CatsSuite {
class EvidenceSuite extends CatsSuite {

test("Is / Leibniz") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import cats.instances.all._
import cats.data._
import cats.laws.discipline.arbitrary._

abstract class FoldableCheck[F[_]: Foldable](name: String)(implicit ArbFInt: Arbitrary[F[Int]], ArbFString: Arbitrary[F[String]]) extends CatsSuite with PropertyChecks {
abstract class FoldableSuite[F[_]: Foldable](name: String)(implicit ArbFInt: Arbitrary[F[Int]], ArbFString: Arbitrary[F[String]]) extends CatsSuite with PropertyChecks {

def iterator[T](fa: F[T]): Iterator[T]

Expand Down Expand Up @@ -140,7 +140,7 @@ abstract class FoldableCheck[F[_]: Foldable](name: String)(implicit ArbFInt: Arb
}
}

class FoldableTestsAdditional extends CatsSuite {
class FoldableSuiteAdditional extends CatsSuite {

// exists method written in terms of foldRight
def contains[F[_]: Foldable, A: Eq](as: F[A], goal: A): Eval[Boolean] =
Expand Down Expand Up @@ -303,72 +303,72 @@ class FoldableTestsAdditional extends CatsSuite {
}
}

class FoldableListCheck extends FoldableCheck[List]("list") {
class FoldableListSuite extends FoldableSuite[List]("list") {
def iterator[T](list: List[T]): Iterator[T] = list.iterator
}

class FoldableVectorCheck extends FoldableCheck[Vector]("vector") {
class FoldableVectorSuite extends FoldableSuite[Vector]("vector") {
def iterator[T](vector: Vector[T]): Iterator[T] = vector.iterator
}

class FoldableSetCheck extends FoldableCheck[Set]("set") {
class FoldableSetSuite extends FoldableSuite[Set]("set") {
def iterator[T](set: Set[T]): Iterator[T] = set.iterator
}

class FoldableStreamCheck extends FoldableCheck[Stream]("stream") {
class FoldableStreamSuite extends FoldableSuite[Stream]("stream") {
def iterator[T](stream: Stream[T]): Iterator[T] = stream.iterator
}

class FoldableMapCheck extends FoldableCheck[Map[Int, ?]]("map") {
class FoldableMapSuite extends FoldableSuite[Map[Int, ?]]("map") {
def iterator[T](map: Map[Int, T]): Iterator[T] = map.valuesIterator
}

class FoldableOptionCheck extends FoldableCheck[Option]("option") {
class FoldableOptionSuite extends FoldableSuite[Option]("option") {
def iterator[T](option: Option[T]): Iterator[T] = option.iterator
}

class FoldableEitherCheck extends FoldableCheck[Either[Int, ?]]("either") {
class FoldableEitherSuite extends FoldableSuite[Either[Int, ?]]("either") {
def iterator[T](either: Either[Int, T]): Iterator[T] = either.right.toOption.iterator
}

class FoldableValidatedCheck extends FoldableCheck[Validated[String, ?]]("validated") {
class FoldableValidatedSuite extends FoldableSuite[Validated[String, ?]]("validated") {
def iterator[T](validated: Validated[String, T]): Iterator[T] = validated.toOption.iterator
}

class FoldableTryCheck extends FoldableCheck[Try]("try") {
class FoldableTrySuite extends FoldableSuite[Try]("try") {
def iterator[T](tryt: Try[T]): Iterator[T] = tryt.toOption.iterator
}

class FoldableEitherKCheck extends FoldableCheck[EitherK[Option, Option, ?]]("eitherK") {
class FoldableEitherKSuite extends FoldableSuite[EitherK[Option, Option, ?]]("eitherK") {
def iterator[T](eitherK: EitherK[Option, Option, T]) = eitherK.run.bimap(_.iterator, _.iterator).merge
}

class FoldableIorCheck extends FoldableCheck[Int Ior ?]("ior") {
class FoldableIorSuite extends FoldableSuite[Int Ior ?]("ior") {
def iterator[T](ior: Int Ior T) =
ior.fold(_ => None.iterator, b => Some(b).iterator, (_, b) => Some(b).iterator)
}

class FoldableIdCheck extends FoldableCheck[Id[?]]("id") {
class FoldableIdSuite extends FoldableSuite[Id[?]]("id") {
def iterator[T](id: Id[T]) = Some(id).iterator
}

class FoldableIdTCheck extends FoldableCheck[IdT[Option, ?]]("idT") {
class FoldableIdTSuite extends FoldableSuite[IdT[Option, ?]]("idT") {
def iterator[T](idT: IdT[Option, T]) = idT.value.iterator
}

class FoldableConstCheck extends FoldableCheck[Const[Int, ?]]("const") {
class FoldableConstSuite extends FoldableSuite[Const[Int, ?]]("const") {
def iterator[T](const: Const[Int, T]) = None.iterator
}

class FoldableTuple2Check extends FoldableCheck[(Int, ?)]("tuple2") {
class FoldableTuple2Suite extends FoldableSuite[(Int, ?)]("tuple2") {
def iterator[T](tuple: (Int, T)) = Some(tuple._2).iterator
}

class FoldableOneAndCheck extends FoldableCheck[OneAnd[List, ?]]("oneAnd") {
class FoldableOneAndSuite extends FoldableSuite[OneAnd[List, ?]]("oneAnd") {
def iterator[T](oneAnd: OneAnd[List, T]) = (oneAnd.head :: oneAnd.tail).iterator
}

class FoldableComposedCheck extends FoldableCheck[Nested[List, Option, ?]]("nested") {
class FoldableComposedSuite extends FoldableSuite[Nested[List, Option, ?]]("nested") {
def iterator[T](nested: Nested[List, Option, T]) = nested.value.collect {
case Some(t) => t
}.iterator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import cats.laws.discipline._
import cats.laws.discipline.arbitrary._
import org.scalacheck.Arbitrary

class FuncTests extends CatsSuite {
class FuncSuite extends CatsSuite {
import cats.laws.discipline.eq._
implicit def funcEq[F[_], A, B](implicit A: Arbitrary[A], FB: Eq[F[B]]): Eq[Func[F, A, B]] =
Eq.by[Func[F, A, B], A => F[B]](_.run)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cats.data.EitherK
import cats.data.NonEmptyList
import cats.laws.discipline.arbitrary._

class FunctionKTests extends CatsSuite {
class FunctionKSuite extends CatsSuite {

val listToOption = λ[FunctionK[List, Option]](_.headOption)
val listToVector = λ[FunctionK[List, Vector]](_.toVector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import cats.kernel.{CommutativeGroup, CommutativeMonoid, CommutativeSemigroup}
import cats.kernel.{Band, BoundedSemilattice, Semilattice}


class FunctionTests extends CatsSuite {
class FunctionSuite extends CatsSuite {

import Helpers._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cats
package tests

class FunctorTest extends CatsSuite {
class FunctorSuite extends CatsSuite {
test("void replaces values with unit preserving structure") {
forAll { (l: List[Int], o: Option[Int], m: Map[String, Int]) =>
l.void should === (List.fill(l.length)(()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package tests

import cats.kernel.laws.discipline.{GroupTests => GroupLawTests}

class GroupTests extends CatsSuite {
class GroupSuite extends CatsSuite {
test("combine minValue") {
Group[Int].combineN(1, Int.MinValue) should ===(Int.MinValue)
}
Expand Down
Loading

0 comments on commit ddb030d

Please sign in to comment.