From 3f5b98ef4992a88a41ecba474cbd820d1e3dd53f Mon Sep 17 00:00:00 2001 From: Denis Rosset Date: Tue, 10 Oct 2017 20:06:57 +0200 Subject: [PATCH 1/3] Harmonize naming of discipline tests in cats-kernel-laws. --- .../kernel/laws/discipline/BandTests.scala | 2 +- .../discipline/CommutativeGroupTests.scala | 2 +- .../discipline/CommutativeMonoidTests.scala | 2 +- .../CommutativeSemigroupTests.scala | 2 +- .../{EqLawTests.scala => EqTests.scala} | 8 +- .../{GroupLawTests.scala => GroupTests.scala} | 8 +- .../kernel/laws/discipline/HashTests.scala | 2 +- ...MonoidLawTests.scala => MonoidTests.scala} | 8 +- .../{OrderLawTests.scala => OrderTests.scala} | 8 +- ...LawTests.scala => PartialOrderTests.scala} | 8 +- ...oupLawTests.scala => SemigroupTests.scala} | 8 +- .../scala/cats/kernel/laws/LawTests.scala | 110 +++++++++--------- .../test/scala/cats/tests/CategoryTests.scala | 2 +- .../test/scala/cats/tests/ComposeTest.scala | 2 +- .../test/scala/cats/tests/ConstTests.scala | 10 +- .../test/scala/cats/tests/EitherKTests.scala | 2 +- .../test/scala/cats/tests/EitherTTests.scala | 10 +- .../test/scala/cats/tests/EitherTests.scala | 10 +- .../src/test/scala/cats/tests/EvalTests.scala | 9 +- .../test/scala/cats/tests/FunctionTests.scala | 16 ++- .../test/scala/cats/tests/GroupTests.scala | 2 +- .../src/test/scala/cats/tests/IdTTests.scala | 4 +- .../src/test/scala/cats/tests/IorTests.scala | 2 +- .../test/scala/cats/tests/KleisliTests.scala | 2 +- .../scala/cats/tests/NonEmptyListTests.scala | 8 +- .../cats/tests/NonEmptyVectorTests.scala | 4 +- .../test/scala/cats/tests/OneAndTests.scala | 4 +- .../test/scala/cats/tests/OptionTTests.scala | 10 +- .../test/scala/cats/tests/OrderTests.scala | 2 +- .../src/test/scala/cats/tests/SetTests.scala | 2 +- .../src/test/scala/cats/tests/TryTests.scala | 4 +- .../test/scala/cats/tests/Tuple2KTests.scala | 6 +- .../scala/cats/tests/ValidatedTests.scala | 10 +- .../test/scala/cats/tests/WriterTTests.scala | 6 +- 34 files changed, 158 insertions(+), 137 deletions(-) rename kernel-laws/src/main/scala/cats/kernel/laws/discipline/{EqLawTests.scala => EqTests.scala} (79%) rename kernel-laws/src/main/scala/cats/kernel/laws/discipline/{GroupLawTests.scala => GroupTests.scala} (71%) rename kernel-laws/src/main/scala/cats/kernel/laws/discipline/{MonoidLawTests.scala => MonoidTests.scala} (76%) rename kernel-laws/src/main/scala/cats/kernel/laws/discipline/{OrderLawTests.scala => OrderTests.scala} (74%) rename kernel-laws/src/main/scala/cats/kernel/laws/discipline/{PartialOrderLawTests.scala => PartialOrderTests.scala} (78%) rename kernel-laws/src/main/scala/cats/kernel/laws/discipline/{SemigroupLawTests.scala => SemigroupTests.scala} (75%) diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/BandTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/BandTests.scala index 213c8d8a8e..87a9941f66 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/BandTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/BandTests.scala @@ -6,7 +6,7 @@ package discipline import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll -trait BandTests[A] extends SemigroupLawTests[A] { +trait BandTests[A] extends SemigroupTests[A] { def laws: BandLaws[A] diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeGroupTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeGroupTests.scala index 7028f92007..f324fa4fe0 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeGroupTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeGroupTests.scala @@ -5,7 +5,7 @@ package discipline import org.scalacheck.{Arbitrary, Prop} -trait CommutativeGroupTests[A] extends CommutativeMonoidTests[A] with GroupLawTests[A] { +trait CommutativeGroupTests[A] extends CommutativeMonoidTests[A] with GroupTests[A] { def laws: CommutativeGroupLaws[A] def commutativeGroup(implicit arbA: Arbitrary[A], eqA: Eq[A]): RuleSet = diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeMonoidTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeMonoidTests.scala index 1e2a33eaca..95101a7900 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeMonoidTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeMonoidTests.scala @@ -5,7 +5,7 @@ package discipline import org.scalacheck.{Arbitrary, Prop} -trait CommutativeMonoidTests[A] extends CommutativeSemigroupTests[A] with MonoidLawTests[A] { +trait CommutativeMonoidTests[A] extends CommutativeSemigroupTests[A] with MonoidTests[A] { def laws: CommutativeMonoidLaws[A] def commutativeMonoid(implicit arbA: Arbitrary[A], eqA: Eq[A]): RuleSet = diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeSemigroupTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeSemigroupTests.scala index d1f4304604..2a0f97accf 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeSemigroupTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/CommutativeSemigroupTests.scala @@ -6,7 +6,7 @@ package discipline import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll -trait CommutativeSemigroupTests[A] extends SemigroupLawTests[A] { +trait CommutativeSemigroupTests[A] extends SemigroupTests[A] { def laws: CommutativeSemigroupLaws[A] diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/EqLawTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/EqTests.scala similarity index 79% rename from kernel-laws/src/main/scala/cats/kernel/laws/discipline/EqLawTests.scala rename to kernel-laws/src/main/scala/cats/kernel/laws/discipline/EqTests.scala index fbf52ae50c..b920999c9e 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/EqLawTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/EqTests.scala @@ -8,7 +8,7 @@ import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll import org.typelevel.discipline.Laws -trait EqLawTests[A] extends Laws { +trait EqTests[A] extends Laws { def laws: EqLaws[A] def eqv(implicit arbA: Arbitrary[A], arbF: Arbitrary[A => A], eqA: Eq[A]): RuleSet = @@ -21,8 +21,8 @@ trait EqLawTests[A] extends Laws { "eq transitivity" -> forAll(laws.transitivityEq _)) } -object EqLawTests { - def apply[A: Eq]: EqLawTests[A] = - new EqLawTests[A] { def laws: EqLaws[A] = EqLaws[A] } +object EqTests { + def apply[A: Eq]: EqTests[A] = + new EqTests[A] { def laws: EqLaws[A] = EqLaws[A] } } diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/GroupLawTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/GroupTests.scala similarity index 71% rename from kernel-laws/src/main/scala/cats/kernel/laws/discipline/GroupLawTests.scala rename to kernel-laws/src/main/scala/cats/kernel/laws/discipline/GroupTests.scala index c2aa7ffedb..506f860c79 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/GroupLawTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/GroupTests.scala @@ -6,7 +6,7 @@ package discipline import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll -trait GroupLawTests[A] extends MonoidLawTests[A] { +trait GroupTests[A] extends MonoidTests[A] { def laws: GroupLaws[A] @@ -20,7 +20,7 @@ trait GroupLawTests[A] extends MonoidLawTests[A] { } -object GroupLawTests { - def apply[A: Group]: GroupLawTests[A] = - new GroupLawTests[A] { def laws: GroupLaws[A] = GroupLaws[A] } +object GroupTests { + def apply[A: Group]: GroupTests[A] = + new GroupTests[A] { def laws: GroupLaws[A] = GroupLaws[A] } } diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/HashTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/HashTests.scala index c59544813b..7655993068 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/HashTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/HashTests.scala @@ -9,7 +9,7 @@ import org.scalacheck.Prop.forAll import scala.util.hashing.Hashing -trait HashTests[A] extends EqLawTests[A] { +trait HashTests[A] extends EqTests[A] { def laws: HashLaws[A] diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/MonoidLawTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/MonoidTests.scala similarity index 76% rename from kernel-laws/src/main/scala/cats/kernel/laws/discipline/MonoidLawTests.scala rename to kernel-laws/src/main/scala/cats/kernel/laws/discipline/MonoidTests.scala index 7e8a4bb7fc..f058cf8780 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/MonoidLawTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/MonoidTests.scala @@ -7,7 +7,7 @@ import cats.kernel.instances.boolean._ import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll -trait MonoidLawTests[A] extends SemigroupLawTests[A] { +trait MonoidTests[A] extends SemigroupTests[A] { def laws: MonoidLaws[A] @@ -24,7 +24,7 @@ trait MonoidLawTests[A] extends SemigroupLawTests[A] { } -object MonoidLawTests { - def apply[A: Monoid]: MonoidLawTests[A] = - new MonoidLawTests[A] { def laws: MonoidLaws[A] = MonoidLaws[A] } +object MonoidTests { + def apply[A: Monoid]: MonoidTests[A] = + new MonoidTests[A] { def laws: MonoidLaws[A] = MonoidLaws[A] } } diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/OrderLawTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/OrderTests.scala similarity index 74% rename from kernel-laws/src/main/scala/cats/kernel/laws/discipline/OrderLawTests.scala rename to kernel-laws/src/main/scala/cats/kernel/laws/discipline/OrderTests.scala index 35b5a9c9b9..58c7857f30 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/OrderLawTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/OrderTests.scala @@ -7,7 +7,7 @@ import cats.kernel.instances.boolean._ import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll -trait OrderLawTests[A] extends PartialOrderLawTests[A] { +trait OrderTests[A] extends PartialOrderTests[A] { def laws: OrderLaws[A] @@ -23,7 +23,7 @@ trait OrderLawTests[A] extends PartialOrderLawTests[A] { } -object OrderLawTests { - def apply[A: Order]: OrderLawTests[A] = - new OrderLawTests[A] { def laws: OrderLaws[A] = OrderLaws[A] } +object OrderTests { + def apply[A: Order]: OrderTests[A] = + new OrderTests[A] { def laws: OrderLaws[A] = OrderLaws[A] } } diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/PartialOrderLawTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/PartialOrderTests.scala similarity index 78% rename from kernel-laws/src/main/scala/cats/kernel/laws/discipline/PartialOrderLawTests.scala rename to kernel-laws/src/main/scala/cats/kernel/laws/discipline/PartialOrderTests.scala index 2072336850..3be02c47dd 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/PartialOrderLawTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/PartialOrderTests.scala @@ -7,7 +7,7 @@ import cats.kernel.instances.boolean._ import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll -trait PartialOrderLawTests[A] extends EqLawTests[A] { +trait PartialOrderTests[A] extends EqTests[A] { def laws: PartialOrderLaws[A] @@ -29,7 +29,7 @@ trait PartialOrderLawTests[A] extends EqLawTests[A] { } -object PartialOrderLawTests { - def apply[A: PartialOrder]: PartialOrderLawTests[A] = - new PartialOrderLawTests[A] { def laws: PartialOrderLaws[A] = PartialOrderLaws[A] } +object PartialOrderTests { + def apply[A: PartialOrder]: PartialOrderTests[A] = + new PartialOrderTests[A] { def laws: PartialOrderLaws[A] = PartialOrderLaws[A] } } diff --git a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/SemigroupLawTests.scala b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/SemigroupTests.scala similarity index 75% rename from kernel-laws/src/main/scala/cats/kernel/laws/discipline/SemigroupLawTests.scala rename to kernel-laws/src/main/scala/cats/kernel/laws/discipline/SemigroupTests.scala index 1838767b2e..ab5436d696 100644 --- a/kernel-laws/src/main/scala/cats/kernel/laws/discipline/SemigroupLawTests.scala +++ b/kernel-laws/src/main/scala/cats/kernel/laws/discipline/SemigroupTests.scala @@ -8,7 +8,7 @@ import org.scalacheck.Arbitrary import org.scalacheck.Prop.forAll import org.typelevel.discipline.Laws -trait SemigroupLawTests[A] extends Laws { +trait SemigroupTests[A] extends Laws { def laws: SemigroupLaws[A] def semigroup(implicit arbA: Arbitrary[A], eqA: Eq[A]): RuleSet = @@ -21,7 +21,7 @@ trait SemigroupLawTests[A] extends Laws { "semigroup combineAllOption" -> forAll(laws.combineAllOption _)) } -object SemigroupLawTests { - def apply[A: Semigroup]: SemigroupLawTests[A] = - new SemigroupLawTests[A] { def laws: SemigroupLaws[A] = SemigroupLaws[A] } +object SemigroupTests { + def apply[A: Semigroup]: SemigroupTests[A] = + new SemigroupTests[A] { def laws: SemigroupLaws[A] = SemigroupLaws[A] } } diff --git a/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala b/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala index bc5f011e09..1a8d704dce 100644 --- a/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala +++ b/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala @@ -80,7 +80,7 @@ object KernelCheck { } } -class LawTests extends FunSuite with Discipline { +class Tests extends FunSuite with Discipline { import KernelCheck._ @@ -95,67 +95,67 @@ class LawTests extends FunSuite with Discipline { { // needed for Cogen[Map[...]] implicit val ohe: Ordering[HasEq[Int]] = Ordering[Int].on(_.a) - checkAll("Eq[Map[String, HasEq[Int]]]", EqLawTests[Map[String, HasEq[Int]]].eqv) + checkAll("Eq[Map[String, HasEq[Int]]]", EqTests[Map[String, HasEq[Int]]].eqv) } - checkAll("Eq[List[HasEq[Int]]]", EqLawTests[List[HasEq[Int]]].eqv) - checkAll("Eq[Option[HasEq[Int]]]", EqLawTests[Option[HasEq[Int]]].eqv) - checkAll("Eq[Vector[HasEq[Int]]]", EqLawTests[Vector[HasEq[Int]]].eqv) - checkAll("Eq[Stream[HasEq[Int]]]", EqLawTests[Stream[HasEq[Int]]].eqv) - checkAll("Eq[Queue[HasEq[Int]]]", EqLawTests[Queue[HasEq[Int]]].eqv) - - checkAll("PartialOrder[Set[Int]]", PartialOrderLawTests[Set[Int]].partialOrder) - checkAll("PartialOrder[Set[Int]].reverse", PartialOrderLawTests(PartialOrder[Set[Int]].reverse).partialOrder) - checkAll("PartialOrder[Set[Int]].reverse.reverse", PartialOrderLawTests(PartialOrder[Set[Int]].reverse.reverse).partialOrder) - checkAll("PartialOrder[Option[HasPartialOrder[Int]]]", PartialOrderLawTests[Option[HasPartialOrder[Int]]].partialOrder) - checkAll("PartialOrder[List[HasPartialOrder[Int]]]", PartialOrderLawTests[List[HasPartialOrder[Int]]].partialOrder) - checkAll("PartialOrder[Vector[HasPartialOrder[Int]]]", PartialOrderLawTests[Vector[HasPartialOrder[Int]]].partialOrder) - checkAll("PartialOrder[Stream[HasPartialOrder[Int]]]", PartialOrderLawTests[Stream[HasPartialOrder[Int]]].partialOrder) - checkAll("PartialOrder[Queue[HasPartialOrder[Int]]]", PartialOrderLawTests[Queue[HasPartialOrder[Int]]].partialOrder) - checkAll("Semilattice.asMeetPartialOrder[Set[Int]]", PartialOrderLawTests(Semilattice.asMeetPartialOrder[Set[Int]]).partialOrder) - checkAll("Semilattice.asJoinPartialOrder[Set[Int]]", PartialOrderLawTests(Semilattice.asJoinPartialOrder[Set[Int]]).partialOrder) - - checkAll("Order[Unit]", OrderLawTests[Unit].order) - checkAll("Order[Boolean]", OrderLawTests[Boolean].order) - checkAll("Order[String]", OrderLawTests[String].order) - checkAll("Order[Symbol]", OrderLawTests[Symbol].order) - checkAll("Order[Byte]", OrderLawTests[Byte].order) - checkAll("Order[Short]", OrderLawTests[Short].order) - checkAll("Order[Char]", OrderLawTests[Char].order) - checkAll("Order[Int]", OrderLawTests[Int].order) - checkAll("Order[Long]", OrderLawTests[Long].order) - checkAll("PartialOrder[BitSet]", PartialOrderLawTests[BitSet].partialOrder) - checkAll("Order[BigInt]", OrderLawTests[BigInt].order) - checkAll("Order[Duration]", OrderLawTests[Duration].order) - checkAll("Order[UUID]", OrderLawTests[UUID].order) - checkAll("Order[List[Int]]", OrderLawTests[List[Int]] .order) - checkAll("Order[Option[String]]", OrderLawTests[Option[String]].order) - checkAll("Order[List[String]", OrderLawTests[List[String]].order) - checkAll("Order[Vector[Int]]", OrderLawTests[Vector[Int]].order) - checkAll("Order[Stream[Int]]", OrderLawTests[Stream[Int]].order) - checkAll("Order[Queue[Int]]", OrderLawTests[Queue[Int]].order) - checkAll("fromOrdering[Int]", OrderLawTests(Order.fromOrdering[Int]).order) - checkAll("Order[Int].reverse", OrderLawTests(Order[Int].reverse).order) - checkAll("Order[Int].reverse.reverse", OrderLawTests(Order[Int].reverse.reverse).order) - - checkAll("Monoid[String]", MonoidLawTests[String].monoid) + checkAll("Eq[List[HasEq[Int]]]", EqTests[List[HasEq[Int]]].eqv) + checkAll("Eq[Option[HasEq[Int]]]", EqTests[Option[HasEq[Int]]].eqv) + checkAll("Eq[Vector[HasEq[Int]]]", EqTests[Vector[HasEq[Int]]].eqv) + checkAll("Eq[Stream[HasEq[Int]]]", EqTests[Stream[HasEq[Int]]].eqv) + checkAll("Eq[Queue[HasEq[Int]]]", EqTests[Queue[HasEq[Int]]].eqv) + + checkAll("PartialOrder[Set[Int]]", PartialOrderTests[Set[Int]].partialOrder) + checkAll("PartialOrder[Set[Int]].reverse", PartialOrderTests(PartialOrder[Set[Int]].reverse).partialOrder) + checkAll("PartialOrder[Set[Int]].reverse.reverse", PartialOrderTests(PartialOrder[Set[Int]].reverse.reverse).partialOrder) + checkAll("PartialOrder[Option[HasPartialOrder[Int]]]", PartialOrderTests[Option[HasPartialOrder[Int]]].partialOrder) + checkAll("PartialOrder[List[HasPartialOrder[Int]]]", PartialOrderTests[List[HasPartialOrder[Int]]].partialOrder) + checkAll("PartialOrder[Vector[HasPartialOrder[Int]]]", PartialOrderTests[Vector[HasPartialOrder[Int]]].partialOrder) + checkAll("PartialOrder[Stream[HasPartialOrder[Int]]]", PartialOrderTests[Stream[HasPartialOrder[Int]]].partialOrder) + checkAll("PartialOrder[Queue[HasPartialOrder[Int]]]", PartialOrderTests[Queue[HasPartialOrder[Int]]].partialOrder) + checkAll("Semilattice.asMeetPartialOrder[Set[Int]]", PartialOrderTests(Semilattice.asMeetPartialOrder[Set[Int]]).partialOrder) + checkAll("Semilattice.asJoinPartialOrder[Set[Int]]", PartialOrderTests(Semilattice.asJoinPartialOrder[Set[Int]]).partialOrder) + + checkAll("Order[Unit]", OrderTests[Unit].order) + checkAll("Order[Boolean]", OrderTests[Boolean].order) + checkAll("Order[String]", OrderTests[String].order) + checkAll("Order[Symbol]", OrderTests[Symbol].order) + checkAll("Order[Byte]", OrderTests[Byte].order) + checkAll("Order[Short]", OrderTests[Short].order) + checkAll("Order[Char]", OrderTests[Char].order) + checkAll("Order[Int]", OrderTests[Int].order) + checkAll("Order[Long]", OrderTests[Long].order) + checkAll("PartialOrder[BitSet]", PartialOrderTests[BitSet].partialOrder) + checkAll("Order[BigInt]", OrderTests[BigInt].order) + checkAll("Order[Duration]", OrderTests[Duration].order) + checkAll("Order[UUID]", OrderTests[UUID].order) + checkAll("Order[List[Int]]", OrderTests[List[Int]] .order) + checkAll("Order[Option[String]]", OrderTests[Option[String]].order) + checkAll("Order[List[String]", OrderTests[List[String]].order) + checkAll("Order[Vector[Int]]", OrderTests[Vector[Int]].order) + checkAll("Order[Stream[Int]]", OrderTests[Stream[Int]].order) + checkAll("Order[Queue[Int]]", OrderTests[Queue[Int]].order) + checkAll("fromOrdering[Int]", OrderTests(Order.fromOrdering[Int]).order) + checkAll("Order[Int].reverse", OrderTests(Order[Int].reverse).order) + checkAll("Order[Int].reverse.reverse", OrderTests(Order[Int].reverse.reverse).order) + + checkAll("Monoid[String]", MonoidTests[String].monoid) checkAll("Monoid[String]", SerializableTests.serializable(Monoid[String])) - checkAll("Monoid[Option[Int]]", MonoidLawTests[Option[Int]].monoid) + checkAll("Monoid[Option[Int]]", MonoidTests[Option[Int]].monoid) checkAll("Monoid[Option[Int]]", SerializableTests.serializable(Monoid[String])) - checkAll("Monoid[Option[String]]", MonoidLawTests[Option[String]].monoid) + checkAll("Monoid[Option[String]]", MonoidTests[Option[String]].monoid) checkAll("Monoid[Option[String]]", SerializableTests.serializable(Monoid[String])) - checkAll("Monoid[List[Int]]", MonoidLawTests[List[Int]].monoid) + checkAll("Monoid[List[Int]]", MonoidTests[List[Int]].monoid) checkAll("Monoid[List[Int]]", SerializableTests.serializable(Monoid[List[Int]])) - checkAll("Monoid[Vector[Int]]", MonoidLawTests[Vector[Int]].monoid) + checkAll("Monoid[Vector[Int]]", MonoidTests[Vector[Int]].monoid) checkAll("Monoid[Vector[Int]]", SerializableTests.serializable(Monoid[Vector[Int]])) - checkAll("Monoid[Stream[Int]]", MonoidLawTests[Stream[Int]].monoid) + checkAll("Monoid[Stream[Int]]", MonoidTests[Stream[Int]].monoid) checkAll("Monoid[Stream[Int]]", SerializableTests.serializable(Monoid[Stream[Int]])) - checkAll("Monoid[List[String]]", MonoidLawTests[List[String]].monoid) + checkAll("Monoid[List[String]]", MonoidTests[List[String]].monoid) checkAll("Monoid[List[String]]", SerializableTests.serializable(Monoid[List[String]])) - checkAll("Monoid[Map[String, Int]]", MonoidLawTests[Map[String, Int]].monoid) + checkAll("Monoid[Map[String, Int]]", MonoidTests[Map[String, Int]].monoid) checkAll("Monoid[Map[String, Int]]", SerializableTests.serializable(Monoid[Map[String, Int]])) - checkAll("Monoid[Queue[Int]]", MonoidLawTests[Queue[Int]].monoid) + checkAll("Monoid[Queue[Int]]", MonoidTests[Queue[Int]].monoid) checkAll("Monoid[Queue[Int]]", SerializableTests.serializable(Monoid[Queue[Int]])) checkAll("BoundedSemilattice[BitSet]", BoundedSemilatticeTests[BitSet].boundedSemilattice) @@ -216,7 +216,7 @@ class LawTests extends FunSuite with Discipline { // default Arbitrary[BigDecimal] is a bit too intense :/ implicit val arbBigDecimal: Arbitrary[BigDecimal] = Arbitrary(arbitrary[Double].map(n => BigDecimal(n.toString))) - checkAll("Order[BigDecimal]", OrderLawTests[BigDecimal].order) + checkAll("Order[BigDecimal]", OrderTests[BigDecimal].order) checkAll("CommutativeGroup[BigDecimal]", CommutativeGroupTests[BigDecimal].commutativeGroup) checkAll("CommutativeGroup[BigDecimal]", SerializableTests.serializable(CommutativeGroup[BigDecimal])) } @@ -238,7 +238,7 @@ class LawTests extends FunSuite with Discipline { else Double.NaN } - checkAll("subsetPartialOrder[Int]", PartialOrderLawTests(subsetPartialOrder[Int]).partialOrder) + checkAll("subsetPartialOrder[Int]", PartialOrderTests(subsetPartialOrder[Int]).partialOrder) implicit val arbitraryComparison: Arbitrary[Comparison] = Arbitrary(Gen.oneOf(Comparison.GreaterThan, Comparison.EqualTo, Comparison.LessThan)) @@ -246,7 +246,7 @@ class LawTests extends FunSuite with Discipline { implicit val cogenComparison: Cogen[Comparison] = Cogen[Int].contramap(_.toInt) - checkAll("Eq[Comparison]", EqLawTests[Comparison].eqv) + checkAll("Eq[Comparison]", EqTests[Comparison].eqv) test("comparison") { val order = Order[Int] @@ -326,7 +326,7 @@ class LawTests extends FunSuite with Discipline { } implicit val monoidOrderN = Order.whenEqualMonoid[N] - checkAll("Monoid[Order[N]]", MonoidLawTests[Order[N]].monoid) + checkAll("Monoid[Order[N]]", MonoidTests[Order[N]].monoid) checkAll("Band[Order[N]]", BandTests[Order[N]].band) { diff --git a/tests/src/test/scala/cats/tests/CategoryTests.scala b/tests/src/test/scala/cats/tests/CategoryTests.scala index 923e82184a..9c571600af 100644 --- a/tests/src/test/scala/cats/tests/CategoryTests.scala +++ b/tests/src/test/scala/cats/tests/CategoryTests.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.discipline.{MonoidLawTests} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests} import cats.arrow.Category import cats.laws.discipline.{MonoidKTests, SerializableTests} diff --git a/tests/src/test/scala/cats/tests/ComposeTest.scala b/tests/src/test/scala/cats/tests/ComposeTest.scala index 0d0413ed5d..1434642093 100644 --- a/tests/src/test/scala/cats/tests/ComposeTest.scala +++ b/tests/src/test/scala/cats/tests/ComposeTest.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.discipline.{SemigroupLawTests} +import cats.kernel.laws.discipline.{SemigroupTests => SemigroupLawTests} import cats.arrow.Compose import cats.laws.discipline.{SemigroupKTests, SerializableTests} diff --git a/tests/src/test/scala/cats/tests/ConstTests.scala b/tests/src/test/scala/cats/tests/ConstTests.scala index 7eb43fa952..b42a19d852 100644 --- a/tests/src/test/scala/cats/tests/ConstTests.scala +++ b/tests/src/test/scala/cats/tests/ConstTests.scala @@ -3,11 +3,11 @@ package tests import cats.kernel.laws.discipline.{ - MonoidLawTests, - SemigroupLawTests, - OrderLawTests, - PartialOrderLawTests, - EqLawTests + MonoidTests => MonoidLawTests, + SemigroupTests => SemigroupLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + EqTests => EqLawTests } import cats.Contravariant import cats.data.{Const, NonEmptyList} diff --git a/tests/src/test/scala/cats/tests/EitherKTests.scala b/tests/src/test/scala/cats/tests/EitherKTests.scala index 112ec09234..fc0afa918a 100644 --- a/tests/src/test/scala/cats/tests/EitherKTests.scala +++ b/tests/src/test/scala/cats/tests/EitherKTests.scala @@ -1,7 +1,7 @@ package cats.tests import cats._ -import cats.kernel.laws.discipline.{EqLawTests} +import cats.kernel.laws.discipline.{EqTests => EqLawTests} import cats.data.EitherK import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ diff --git a/tests/src/test/scala/cats/tests/EitherTTests.scala b/tests/src/test/scala/cats/tests/EitherTTests.scala index 3c167e048d..e1070b6656 100644 --- a/tests/src/test/scala/cats/tests/EitherTTests.scala +++ b/tests/src/test/scala/cats/tests/EitherTTests.scala @@ -7,11 +7,11 @@ import cats.data.EitherT import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.kernel.laws.discipline.{ -MonoidLawTests, -SemigroupLawTests, -OrderLawTests, -PartialOrderLawTests, -EqLawTests +MonoidTests => MonoidLawTests, +SemigroupTests => SemigroupLawTests, +OrderTests => OrderLawTests, +PartialOrderTests => PartialOrderLawTests, +EqTests => EqLawTests } diff --git a/tests/src/test/scala/cats/tests/EitherTests.scala b/tests/src/test/scala/cats/tests/EitherTests.scala index 72da1d6024..91a05b581e 100644 --- a/tests/src/test/scala/cats/tests/EitherTests.scala +++ b/tests/src/test/scala/cats/tests/EitherTests.scala @@ -4,11 +4,11 @@ package tests import cats.data.{ EitherT, Validated } import cats.laws.discipline._ import cats.kernel.laws.discipline.{ - MonoidLawTests, - SemigroupLawTests, - OrderLawTests, - PartialOrderLawTests, - EqLawTests + MonoidTests => MonoidLawTests, + SemigroupTests => SemigroupLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + EqTests => EqLawTests } import scala.util.Try diff --git a/tests/src/test/scala/cats/tests/EvalTests.scala b/tests/src/test/scala/cats/tests/EvalTests.scala index 86ff9bee15..11a5b8dce5 100644 --- a/tests/src/test/scala/cats/tests/EvalTests.scala +++ b/tests/src/test/scala/cats/tests/EvalTests.scala @@ -4,7 +4,14 @@ package tests import cats.laws.ComonadLaws import cats.laws.discipline.{BimonadTests, CartesianTests, ReducibleTests, SerializableTests} import cats.laws.discipline.arbitrary._ -import cats.kernel.laws.discipline._ +import cats.kernel.laws.discipline.{ + EqTests => EqLawTests, + GroupTests => GroupLawTests, + MonoidTests => MonoidLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + SemigroupTests => SemigroupLawTests +} import org.scalacheck.{Arbitrary, Cogen, Gen} import org.scalacheck.Arbitrary.arbitrary import scala.annotation.tailrec diff --git a/tests/src/test/scala/cats/tests/FunctionTests.scala b/tests/src/test/scala/cats/tests/FunctionTests.scala index 36db548603..553b13a18a 100644 --- a/tests/src/test/scala/cats/tests/FunctionTests.scala +++ b/tests/src/test/scala/cats/tests/FunctionTests.scala @@ -3,7 +3,21 @@ package tests import cats.arrow.{Choice, CommutativeArrow} import cats.kernel.laws.HashLaws -import cats.kernel.laws.discipline.{SerializableTests, _} +import cats.kernel.laws.discipline.{ + BandTests, + BoundedSemilatticeTests, + CommutativeGroupTests, + CommutativeMonoidTests, + CommutativeSemigroupTests, + EqTests => EqLawTests, + GroupTests => GroupLawTests, + MonoidTests => MonoidLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + SemigroupTests => SemigroupLawTests, + SemilatticeTests, + SerializableTests +} import cats.laws.discipline._ import cats.laws.discipline.eq._ import cats.laws.discipline.arbitrary._ diff --git a/tests/src/test/scala/cats/tests/GroupTests.scala b/tests/src/test/scala/cats/tests/GroupTests.scala index e3f4339649..8ba012e322 100644 --- a/tests/src/test/scala/cats/tests/GroupTests.scala +++ b/tests/src/test/scala/cats/tests/GroupTests.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.discipline.{GroupLawTests} +import cats.kernel.laws.discipline.{GroupTests => GroupLawTests} class GroupTests extends CatsSuite { test("combine minValue") { diff --git a/tests/src/test/scala/cats/tests/IdTTests.scala b/tests/src/test/scala/cats/tests/IdTTests.scala index 1a2016f4fb..9457af40bb 100644 --- a/tests/src/test/scala/cats/tests/IdTTests.scala +++ b/tests/src/test/scala/cats/tests/IdTTests.scala @@ -3,8 +3,8 @@ package tests import cats.data.{IdT, NonEmptyList} import cats.kernel.laws.discipline.{ - OrderLawTests, - EqLawTests + OrderTests => OrderLawTests, + EqTests => EqLawTests } import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ diff --git a/tests/src/test/scala/cats/tests/IorTests.scala b/tests/src/test/scala/cats/tests/IorTests.scala index c8e4415e45..6362dba694 100644 --- a/tests/src/test/scala/cats/tests/IorTests.scala +++ b/tests/src/test/scala/cats/tests/IorTests.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.discipline.{SemigroupLawTests} +import cats.kernel.laws.discipline.{SemigroupTests => SemigroupLawTests} import cats.laws.discipline.{BifunctorTests, CartesianTests, MonadErrorTests, SerializableTests, TraverseTests} import cats.data.{Ior, NonEmptyList, EitherT} import cats.laws.discipline.arbitrary._ diff --git a/tests/src/test/scala/cats/tests/KleisliTests.scala b/tests/src/test/scala/cats/tests/KleisliTests.scala index c032a9a425..fc4cf9def6 100644 --- a/tests/src/test/scala/cats/tests/KleisliTests.scala +++ b/tests/src/test/scala/cats/tests/KleisliTests.scala @@ -8,7 +8,7 @@ import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.laws.discipline.eq._ import org.scalacheck.Arbitrary -import cats.kernel.laws.discipline.{MonoidLawTests, SemigroupLawTests} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests, SemigroupTests => SemigroupLawTests} import cats.laws.discipline.{SemigroupKTests, MonoidKTests} class KleisliTests extends CatsSuite { diff --git a/tests/src/test/scala/cats/tests/NonEmptyListTests.scala b/tests/src/test/scala/cats/tests/NonEmptyListTests.scala index bc8c773d3d..2e1497dcc0 100644 --- a/tests/src/test/scala/cats/tests/NonEmptyListTests.scala +++ b/tests/src/test/scala/cats/tests/NonEmptyListTests.scala @@ -2,10 +2,10 @@ package cats package tests import cats.kernel.laws.discipline.{ - SemigroupLawTests, - OrderLawTests, - PartialOrderLawTests, - EqLawTests + SemigroupTests => SemigroupLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + EqTests => EqLawTests } import cats.data.{NonEmptyList, NonEmptyVector} diff --git a/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala b/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala index 6db3ffb5bc..93b3284d34 100644 --- a/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala +++ b/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala @@ -4,8 +4,8 @@ package tests import catalysts.Platform import cats.kernel.laws.discipline.{ - SemigroupLawTests, - EqLawTests + SemigroupTests => SemigroupLawTests, + EqTests => EqLawTests } import cats.data.NonEmptyVector diff --git a/tests/src/test/scala/cats/tests/OneAndTests.scala b/tests/src/test/scala/cats/tests/OneAndTests.scala index f3028f861e..20216ede47 100644 --- a/tests/src/test/scala/cats/tests/OneAndTests.scala +++ b/tests/src/test/scala/cats/tests/OneAndTests.scala @@ -2,8 +2,8 @@ package cats package tests import cats.kernel.laws.discipline.{ - SemigroupLawTests, - EqLawTests + SemigroupTests => SemigroupLawTests, + EqTests => EqLawTests } import cats.instances.stream._ diff --git a/tests/src/test/scala/cats/tests/OptionTTests.scala b/tests/src/test/scala/cats/tests/OptionTTests.scala index abf4db2907..6a29a0f8fc 100644 --- a/tests/src/test/scala/cats/tests/OptionTTests.scala +++ b/tests/src/test/scala/cats/tests/OptionTTests.scala @@ -3,11 +3,11 @@ package tests import cats.data.OptionT import cats.kernel.laws.discipline.{ - MonoidLawTests, - SemigroupLawTests, - OrderLawTests, - PartialOrderLawTests, - EqLawTests + MonoidTests => MonoidLawTests, + SemigroupTests => SemigroupLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + EqTests => EqLawTests } import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ diff --git a/tests/src/test/scala/cats/tests/OrderTests.scala b/tests/src/test/scala/cats/tests/OrderTests.scala index 1ff7638e46..450bb8b429 100644 --- a/tests/src/test/scala/cats/tests/OrderTests.scala +++ b/tests/src/test/scala/cats/tests/OrderTests.scala @@ -2,7 +2,7 @@ package cats package tests -import cats.kernel.laws.discipline.{OrderLawTests} +import cats.kernel.laws.discipline.{OrderTests => OrderLawTests} class OrderTests extends CatsSuite { { diff --git a/tests/src/test/scala/cats/tests/SetTests.scala b/tests/src/test/scala/cats/tests/SetTests.scala index ba6b62d4d4..2703f6ec5a 100644 --- a/tests/src/test/scala/cats/tests/SetTests.scala +++ b/tests/src/test/scala/cats/tests/SetTests.scala @@ -2,7 +2,7 @@ package cats package tests import cats.laws.discipline.{FoldableTests, MonoidKTests, SerializableTests} -import cats.kernel.laws.discipline.{MonoidLawTests} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests} class SetTests extends CatsSuite { checkAll("Set[Int]", MonoidLawTests[Set[Int]].monoid) diff --git a/tests/src/test/scala/cats/tests/TryTests.scala b/tests/src/test/scala/cats/tests/TryTests.scala index b4ff873382..558c80cfd2 100644 --- a/tests/src/test/scala/cats/tests/TryTests.scala +++ b/tests/src/test/scala/cats/tests/TryTests.scala @@ -2,8 +2,8 @@ package cats package tests import cats.kernel.laws.discipline.{ - SemigroupLawTests, - MonoidLawTests + SemigroupTests => SemigroupLawTests, + MonoidTests => MonoidLawTests } import cats.laws.{ApplicativeLaws, CoflatMapLaws, FlatMapLaws, MonadLaws} import cats.laws.discipline._ diff --git a/tests/src/test/scala/cats/tests/Tuple2KTests.scala b/tests/src/test/scala/cats/tests/Tuple2KTests.scala index d207c66f57..c3b5b32103 100644 --- a/tests/src/test/scala/cats/tests/Tuple2KTests.scala +++ b/tests/src/test/scala/cats/tests/Tuple2KTests.scala @@ -7,9 +7,9 @@ import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.laws.discipline.eq._ import cats.kernel.laws.discipline.{ - OrderLawTests, - PartialOrderLawTests, - EqLawTests + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + EqTests => EqLawTests } class Tuple2KTests extends CatsSuite { diff --git a/tests/src/test/scala/cats/tests/ValidatedTests.scala b/tests/src/test/scala/cats/tests/ValidatedTests.scala index 8a10682a1f..0a8dab1f6a 100644 --- a/tests/src/test/scala/cats/tests/ValidatedTests.scala +++ b/tests/src/test/scala/cats/tests/ValidatedTests.scala @@ -8,11 +8,11 @@ import org.scalacheck.Arbitrary._ import cats.laws.discipline.SemigroupKTests import cats.laws.discipline.arbitrary._ import cats.kernel.laws.discipline.{ - MonoidLawTests, - SemigroupLawTests, - OrderLawTests, - PartialOrderLawTests, - EqLawTests + MonoidTests => MonoidLawTests, + SemigroupTests => SemigroupLawTests, + OrderTests => OrderLawTests, + PartialOrderTests => PartialOrderLawTests, + EqTests => EqLawTests } import scala.util.Try diff --git a/tests/src/test/scala/cats/tests/WriterTTests.scala b/tests/src/test/scala/cats/tests/WriterTTests.scala index 321e8d8aed..116ab1426c 100644 --- a/tests/src/test/scala/cats/tests/WriterTTests.scala +++ b/tests/src/test/scala/cats/tests/WriterTTests.scala @@ -8,9 +8,9 @@ import cats.laws.discipline.arbitrary._ import cats.laws.discipline.eq._ import cats.kernel.laws.discipline.{ - MonoidLawTests, - SemigroupLawTests, - EqLawTests + MonoidTests => MonoidLawTests, + SemigroupTests => SemigroupLawTests, + EqTests => EqLawTests } class WriterTTests extends CatsSuite { From 917b870faf2dcb1511a67c1b4a49a12ad6c697d9 Mon Sep 17 00:00:00 2001 From: Denis Rosset Date: Wed, 11 Oct 2017 12:59:50 +0200 Subject: [PATCH 2/3] Corrected tests specialized for JS and JVM targets. --- js/src/test/scala/cats/tests/FutureTests.scala | 2 +- jvm/src/test/scala/cats/tests/FutureTests.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/test/scala/cats/tests/FutureTests.scala b/js/src/test/scala/cats/tests/FutureTests.scala index 574759537c..1fd1829b0e 100644 --- a/js/src/test/scala/cats/tests/FutureTests.scala +++ b/js/src/test/scala/cats/tests/FutureTests.scala @@ -2,7 +2,7 @@ package cats package js package tests -import cats.kernel.laws.discipline.{MonoidLawTests, SemigroupLawTests} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests, SemigroupTests => SemigroupLawTests} import cats.laws.discipline._ import cats.js.instances.Await import cats.js.instances.future.futureComonad diff --git a/jvm/src/test/scala/cats/tests/FutureTests.scala b/jvm/src/test/scala/cats/tests/FutureTests.scala index 2610fbb679..795b69c196 100644 --- a/jvm/src/test/scala/cats/tests/FutureTests.scala +++ b/jvm/src/test/scala/cats/tests/FutureTests.scala @@ -2,7 +2,7 @@ package cats package jvm package tests -import cats.kernel.laws.discipline.{MonoidLawTests, SemigroupLawTests} +import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests, SemigroupTests => SemigroupLawTests} import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.tests.{CatsSuite, ListWrapper} From 0acdb10bda5dae6a4d82baa3a77c0afa5bfdf601 Mon Sep 17 00:00:00 2001 From: Denis Rosset Date: Thu, 12 Oct 2017 16:41:36 +0200 Subject: [PATCH 3/3] Corrected tutorial. --- docs/src/main/tut/typeclasses/lawtesting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/main/tut/typeclasses/lawtesting.md b/docs/src/main/tut/typeclasses/lawtesting.md index 56eea32d89..34b9f70893 100644 --- a/docs/src/main/tut/typeclasses/lawtesting.md +++ b/docs/src/main/tut/typeclasses/lawtesting.md @@ -133,10 +133,10 @@ Then we can again test the instance inside our class extending `CatsSuite`: ```tut:book import cats.laws.discipline.FunctorTests -import cats.kernel.laws.discipline.SemigroupLawTests +import cats.kernel.laws.discipline.SemigroupTests class TreeLawTests extends CatsSuite { - checkAll("Tree[Int].SemigroupLaws", SemigroupLawTests[Tree[Int]].semigroup) + checkAll("Tree[Int].SemigroupLaws", SemigroupTests[Tree[Int]].semigroup) checkAll("Tree.FunctorLaws", FunctorTests[Tree].functor[Int, Int, String]) } ```