diff --git a/core/jvm/src/test/scala/org/scalacheck/ArbitrarySpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/ArbitrarySpecification.scala similarity index 91% rename from core/jvm/src/test/scala/org/scalacheck/ArbitrarySpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/ArbitrarySpecification.scala index 6249fced..8253d754 100644 --- a/core/jvm/src/test/scala/org/scalacheck/ArbitrarySpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/ArbitrarySpecification.scala @@ -7,12 +7,13 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests import java.util.concurrent.TimeUnit -import Prop._ -import Arbitrary._ +import org.scalacheck.{Arbitrary, Gen, Prop, Properties} +import org.scalacheck.Prop._ +import org.scalacheck.Arbitrary._ object ArbitrarySpecification extends Properties("Arbitrary") { val genOptionUnits = diff --git a/core/jvm/src/test/scala/org/scalacheck/ChooseSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/ChooseSpecification.scala similarity index 98% rename from core/jvm/src/test/scala/org/scalacheck/ChooseSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/ChooseSpecification.scala index f3e28f4b..7f5f156a 100644 --- a/core/jvm/src/test/scala/org/scalacheck/ChooseSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/ChooseSpecification.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests import java.time._ import java.time.temporal.ChronoUnit @@ -16,7 +16,8 @@ import scala.util.Failure import scala.util.Success import scala.util.Try -import Gen._ +import org.scalacheck.{Arbitrary, Gen, Prop, Properties} +import org.scalacheck.Gen._ object ChooseSpecification extends Properties("Choose") with time.OrderingVersionSpecific { diff --git a/core/jvm/src/test/scala/org/scalacheck/CogenSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/CogenSpecification.scala similarity index 98% rename from core/jvm/src/test/scala/org/scalacheck/CogenSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/CogenSpecification.scala index 7446e727..631e586b 100644 --- a/core/jvm/src/test/scala/org/scalacheck/CogenSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/CogenSpecification.scala @@ -7,11 +7,11 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests +import org.scalacheck.{Arbitrary, Cogen, Prop, Properties} import org.scalacheck.Arbitrary.arbitrary import org.scalacheck.Gen.listOfN -import org.scalacheck.GenSpecification.arbSeed import org.scalacheck.Prop.forAll import org.scalacheck.rng.Seed @@ -22,6 +22,7 @@ import scala.collection.immutable.SortedSet import scala.concurrent.duration.Duration import scala.concurrent.duration.FiniteDuration import scala.util.Try +import GenSpecification.arbSeed import ScalaVersionSpecific._ object CogenSpecification extends Properties("Cogen") { diff --git a/core/jvm/src/test/scala/org/scalacheck/GenSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/GenSpecification.scala similarity index 98% rename from core/jvm/src/test/scala/org/scalacheck/GenSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/GenSpecification.scala index 45a9dace..4fb2a6d8 100644 --- a/core/jvm/src/test/scala/org/scalacheck/GenSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/GenSpecification.scala @@ -7,17 +7,18 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests import scala.util.Failure import scala.util.Success import scala.util.Try -import rng.Seed -import Gen._ -import Prop.{forAll, forAllNoShrink, someFailing, noneFailing, sizedProp, secure, propBoolean} -import Arbitrary._ -import Shrink._ +import org.scalacheck.{Arbitrary, Cogen, Gen, Prop, Properties} +import org.scalacheck.rng.Seed +import org.scalacheck.Gen._ +import org.scalacheck.Prop.{forAll, forAllNoShrink, someFailing, noneFailing, sizedProp, secure, propBoolean} +import org.scalacheck.Arbitrary._ +import org.scalacheck.Shrink._ object GenSpecification extends Properties("Gen") with GenSpecificationVersionSpecific { @@ -574,7 +575,7 @@ object GenSpecification extends Properties("Gen") with GenSpecificationVersionSp forAllNoShrink(Gen.choose(1000000, 2000000)) { n => var i = 0 var sum = 0d - var seed = rng.Seed(n.toLong) + var seed = Seed(n.toLong) while (i < n) { val (d, s1) = seed.double sum += d @@ -590,7 +591,7 @@ object GenSpecification extends Properties("Gen") with GenSpecificationVersionSp forAllNoShrink(Gen.choose(1000000, 2000000)) { n => var i = 0 var sum = 0d - var seed = rng.Seed(n.toLong) + var seed = Seed(n.toLong) while (i < n) { val (l, s1) = seed.long sum += math.abs(l).toDouble * scale diff --git a/core/jvm/src/test/scala/org/scalacheck/LazyPropertiesSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/LazyPropertiesSpecification.scala similarity index 89% rename from core/jvm/src/test/scala/org/scalacheck/LazyPropertiesSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/LazyPropertiesSpecification.scala index 613a4db5..9d198369 100644 --- a/core/jvm/src/test/scala/org/scalacheck/LazyPropertiesSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/LazyPropertiesSpecification.scala @@ -7,7 +7,9 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests + +import org.scalacheck.{Prop, Properties} object LazyPropertiesSpecification extends Properties("Properties.lazy registration") { diff --git a/core/jvm/src/test/scala/org/scalacheck/PropertyFilterSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/PropertyFilterSpecification.scala similarity index 95% rename from core/jvm/src/test/scala/org/scalacheck/PropertyFilterSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/PropertyFilterSpecification.scala index 091c72d4..e6f538b8 100644 --- a/core/jvm/src/test/scala/org/scalacheck/PropertyFilterSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/PropertyFilterSpecification.scala @@ -7,9 +7,10 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests -import Prop.propBoolean +import org.scalacheck.{Gen, Prop, Properties, Test} +import org.scalacheck.Prop.propBoolean object PropertyFilterSampleSpecification extends Properties("PropertyFilterSample") { diff --git a/core/jvm/src/test/scala/org/scalacheck/SerializabilitySpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/SerializabilitySpecification.scala similarity index 94% rename from core/jvm/src/test/scala/org/scalacheck/SerializabilitySpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/SerializabilitySpecification.scala index 9f7bf080..67f6b0fc 100644 --- a/core/jvm/src/test/scala/org/scalacheck/SerializabilitySpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/SerializabilitySpecification.scala @@ -7,13 +7,15 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests import org.apache.commons.lang3.SerializationUtils import java.io.Serializable -import util.SerializableCanBuildFroms._ +import org.scalacheck.{Arbitrary, Cogen, Gen, Properties, Shrink} +import org.scalacheck.rng.Seed +import org.scalacheck.util.SerializableCanBuildFroms._ object SerializabilitySpecification extends Properties("Serializability") { @@ -156,7 +158,7 @@ object SerializabilitySpecification extends Properties("Serializability") { serializableShrink[List[(String, Int)]]("List[(String,Int)]") property("Seed(1L)") = { - serializable(rng.Seed(1L)) + serializable(Seed(1L)) } } diff --git a/core/jvm/src/test/scala/org/scalacheck/ShrinkSpecificationJVM.scala b/core/jvm/src/test/scala/scalacheck/tests/ShrinkSpecificationJVM.scala similarity index 87% rename from core/jvm/src/test/scala/org/scalacheck/ShrinkSpecificationJVM.scala rename to core/jvm/src/test/scala/scalacheck/tests/ShrinkSpecificationJVM.scala index e8449cde..764cf2e0 100644 --- a/core/jvm/src/test/scala/org/scalacheck/ShrinkSpecificationJVM.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/ShrinkSpecificationJVM.scala @@ -7,10 +7,11 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests -import Prop.{forAll, propBoolean} -import Shrink.shrink +import org.scalacheck.Properties +import org.scalacheck.Prop.{forAll, propBoolean} +import org.scalacheck.Shrink.shrink import ShrinkSpecification.shrinkClosure /** @todo diff --git a/core/jvm/src/test/scala/org/scalacheck/TestAll.scala b/core/jvm/src/test/scala/scalacheck/tests/TestAll.scala similarity index 90% rename from core/jvm/src/test/scala/org/scalacheck/TestAll.scala rename to core/jvm/src/test/scala/scalacheck/tests/TestAll.scala index ae017e2d..02103812 100644 --- a/core/jvm/src/test/scala/org/scalacheck/TestAll.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/TestAll.scala @@ -7,7 +7,9 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests + +import org.scalacheck.Properties object TestAll { object ScalaCheckSpecification extends Properties("ScalaCheck") { diff --git a/core/jvm/src/test/scala/org/scalacheck/TestSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/TestSpecification.scala similarity index 91% rename from core/jvm/src/test/scala/org/scalacheck/TestSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/TestSpecification.scala index 77f55b74..14513c9e 100644 --- a/core/jvm/src/test/scala/org/scalacheck/TestSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/TestSpecification.scala @@ -7,12 +7,14 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests -import Gen._ -import Prop._ -import Test._ -import Arbitrary._ +import org.scalacheck.{Gen, Prop, Properties, Shrink, Test} +import org.scalacheck.Gen._ +import org.scalacheck.Prop._ +import org.scalacheck.Test._ +import org.scalacheck.Arbitrary._ +import org.scalacheck.rng.Seed object TestSpecification extends Properties("Test") { @@ -146,8 +148,8 @@ object TestSpecification extends Properties("Test") { property("Properties.overrideParameters overrides Test.Parameters") = { - val seed0 = rng.Seed.fromBase64("aaaaa_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get - val seed1 = rng.Seed.fromBase64("zzzzz_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get + val seed0 = Seed.fromBase64("aaaaa_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get + val seed1 = Seed.fromBase64("zzzzz_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get val myProps = new Properties("MyProps") { override def overrideParameters(prms: Test.Parameters): Test.Parameters = @@ -168,7 +170,7 @@ object TestSpecification extends Properties("Test") { } property("initialSeed is used and then updated") = { - val seed = rng.Seed.fromBase64("aaaaa_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get + val seed = Seed.fromBase64("aaaaa_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get val gen = Gen.choose(Int.MinValue, Int.MaxValue) val expected = gen(Gen.Parameters.default, seed).get @@ -191,7 +193,7 @@ object TestSpecification extends Properties("Test") { } property("initialSeed is used and then updated when varying RNG spins") = { - val seed = rng.Seed.fromBase64("aaaaa_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get + val seed = Seed.fromBase64("aaaaa_mr05Z_DCbd2PyUolC0h93iH1MQwIdnH2UuI4L=").get val gen = Gen.choose(Int.MinValue, Int.MaxValue) val expected = gen(Gen.Parameters.default, seed).get diff --git a/core/jvm/src/test/scala/org/scalacheck/commands/CommandsShrinkSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/commands/CommandsShrinkSpecification.scala similarity index 98% rename from core/jvm/src/test/scala/org/scalacheck/commands/CommandsShrinkSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/commands/CommandsShrinkSpecification.scala index 910e1236..f5e869b4 100644 --- a/core/jvm/src/test/scala/org/scalacheck/commands/CommandsShrinkSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/commands/CommandsShrinkSpecification.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.commands +package scalacheck.tests.commands import org.scalacheck.Arbitrary import org.scalacheck.Gen @@ -15,6 +15,7 @@ import org.scalacheck.Prop import org.scalacheck.Prop.forAll import org.scalacheck.Properties import org.scalacheck.Shrink +import org.scalacheck.commands.Commands import org.scalacheck.rng.Seed import scala.reflect.ClassTag diff --git a/core/jvm/src/test/scala/org/scalacheck/commands/CommandsSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/commands/CommandsSpecification.scala/CommandsSpecification.scala similarity index 97% rename from core/jvm/src/test/scala/org/scalacheck/commands/CommandsSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/commands/CommandsSpecification.scala/CommandsSpecification.scala index 0bd7309d..d3aa5bb8 100644 --- a/core/jvm/src/test/scala/org/scalacheck/commands/CommandsSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/commands/CommandsSpecification.scala/CommandsSpecification.scala @@ -7,9 +7,10 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.commands +package scalacheck.tests.commands import org.scalacheck._ +import org.scalacheck.commands._ object CommandsSpecification extends Properties("Commands") { diff --git a/core/jvm/src/test/scala/org/scalacheck/examples/IntMapSpec.scala b/core/jvm/src/test/scala/scalacheck/tests/examples/IntMapSpec.scala similarity index 98% rename from core/jvm/src/test/scala/org/scalacheck/examples/IntMapSpec.scala rename to core/jvm/src/test/scala/scalacheck/tests/examples/IntMapSpec.scala index 86d6c281..be3fa077 100644 --- a/core/jvm/src/test/scala/org/scalacheck/examples/IntMapSpec.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/examples/IntMapSpec.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests import org.scalacheck.Prop.AnyOperators import org.scalacheck.Prop.forAll diff --git a/core/jvm/src/test/scala/org/scalacheck/examples/StringUtils.scala b/core/jvm/src/test/scala/scalacheck/tests/examples/StringUtils.scala similarity index 98% rename from core/jvm/src/test/scala/org/scalacheck/examples/StringUtils.scala rename to core/jvm/src/test/scala/scalacheck/tests/examples/StringUtils.scala index 0ac49ad2..da8a6cb2 100644 --- a/core/jvm/src/test/scala/org/scalacheck/examples/StringUtils.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/examples/StringUtils.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.example +package scalacheck.tests.example import org.scalacheck._ diff --git a/core/jvm/src/test/scala/org/scalacheck/rng/SeedSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/rng/SeedSpecification.scala similarity index 91% rename from core/jvm/src/test/scala/org/scalacheck/rng/SeedSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/rng/SeedSpecification.scala index a26b95cb..a6b0b8f6 100644 --- a/core/jvm/src/test/scala/org/scalacheck/rng/SeedSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/rng/SeedSpecification.scala @@ -7,13 +7,15 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests package rng import scala.util.Try -import Prop.forAll -import Arbitrary.arbitrary +import org.scalacheck.{Arbitrary, Gen, Prop, Properties} +import org.scalacheck.rng.Seed +import org.scalacheck.Prop.forAll +import org.scalacheck.Arbitrary.arbitrary object SeedSpecification extends Properties("Seed") { diff --git a/core/jvm/src/test/scala/org/scalacheck/time/ShrinkSpecification.scala b/core/jvm/src/test/scala/scalacheck/tests/time/ShrinkSpecification.scala similarity index 95% rename from core/jvm/src/test/scala/org/scalacheck/time/ShrinkSpecification.scala rename to core/jvm/src/test/scala/scalacheck/tests/time/ShrinkSpecification.scala index fe362cb0..b3e96e76 100644 --- a/core/jvm/src/test/scala/org/scalacheck/time/ShrinkSpecification.scala +++ b/core/jvm/src/test/scala/scalacheck/tests/time/ShrinkSpecification.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.time +package scalacheck.tests.time import org.scalacheck.Prop._ import org.scalacheck.Shrink._ diff --git a/core/shared/src/main/scala-2.12-/org/scalacheck/ScalaVersionSpecific.scala b/core/shared/src/main/scala-2.12-/org/scalacheck/ScalaVersionSpecific.scala index 7cdcb298..26e1035b 100644 --- a/core/shared/src/main/scala-2.12-/org/scalacheck/ScalaVersionSpecific.scala +++ b/core/shared/src/main/scala-2.12-/org/scalacheck/ScalaVersionSpecific.scala @@ -16,9 +16,6 @@ import scala.collection.TraversableOnce private[scalacheck] object ScalaVersionSpecific { def toLazyList[T](i: TraversableOnce[T]) = i.toStream - type LazyList[+A] = Stream[A] - val LazyList = Stream - implicit class StreamExt[+A](val s: Stream[A]) extends AnyVal { def lazyAppendedAll[B >: A](rest: => TraversableOnce[B]): Stream[B] = s.append(rest) } @@ -33,9 +30,4 @@ private[scalacheck] object ScalaVersionSpecific { private[scalacheck] trait GenVersionSpecific private[scalacheck] trait CogenVersionSpecific -// Used in tests -private[scalacheck] trait GenSpecificationVersionSpecific { - def infiniteLazyList[T](g: => Gen[T]): Gen[Stream[T]] = Gen.infiniteStream(g) -} - private[scalacheck] trait ShrinkVersionSpecific diff --git a/core/shared/src/main/scala-2.13+/org/scalacheck/ScalaVersionSpecific.scala b/core/shared/src/main/scala-2.13+/org/scalacheck/ScalaVersionSpecific.scala index ab7bc499..296c5d50 100644 --- a/core/shared/src/main/scala-2.13+/org/scalacheck/ScalaVersionSpecific.scala +++ b/core/shared/src/main/scala-2.13+/org/scalacheck/ScalaVersionSpecific.scala @@ -32,8 +32,6 @@ private[scalacheck] trait GenVersionSpecific { } } -private[scalacheck] trait GenSpecificationVersionSpecific - private[scalacheck] trait CogenVersionSpecific { implicit def cogenLazyList[A: Cogen]: Cogen[LazyList[A]] = Cogen.it(_.iterator) diff --git a/core/shared/src/main/scala/org/scalacheck/Prop.scala b/core/shared/src/main/scala/org/scalacheck/Prop.scala index dedb1ec8..30a9b235 100644 --- a/core/shared/src/main/scala/org/scalacheck/Prop.scala +++ b/core/shared/src/main/scala/org/scalacheck/Prop.scala @@ -23,7 +23,7 @@ sealed class PropFromFun(f: Gen.Parameters => Prop.Result) extends Prop { @Platform.EnableReflectiveInstantiation sealed abstract class Prop extends Serializable { self => - import Prop.{Result, True, False, Undecided, provedToTrue, mergeRes} + import Prop.{Exception, Proof, Result, True, False, Undecided, provedToTrue, mergeRes} def apply(prms: Gen.Parameters): Result @@ -148,21 +148,44 @@ sealed abstract class Prop extends Serializable { self => override def toString = "Prop" + private[scalacheck] def labelImpl1(l: String) = map(_.label(l)) + + /** Put a label on the property to make test reports clearer */ + private[scalacheck] def label(l: String) = labelImpl1(l) + /** Put a label on the property to make test reports clearer */ - def label(l: String) = map(_.label(l)) + private[scalacheck] def :|(l: String) = labelImpl1(l) /** Put a label on the property to make test reports clearer */ - def :|(l: String) = label(l) + private[scalacheck] def |:(l: String) = labelImpl1(l) /** Put a label on the property to make test reports clearer */ - def |:(l: String) = label(l) + private[scalacheck] def :|(l: Symbol) = labelImpl1(l.name) + + /** Put a label on the property to make test reports clearer */ + private[scalacheck] def |:(l: Symbol) = labelImpl1(l.name) + + private[scalacheck] def labelImpl2(l: => String) = + map(r => + r.status match { + case False | Exception(_) => r.label(l) + case Proof | True | Undecided => r + }) /** Put a label on the property to make test reports clearer */ - def :|(l: Symbol) = label(l.name) + def label(l: => String) = labelImpl2(l) /** Put a label on the property to make test reports clearer */ - def |:(l: Symbol) = label(l.name) + def :|(l: => String) = labelImpl2(l) + /** Put a label on the property to make test reports clearer */ + def |:(l: => String) = labelImpl2(l) + + /** Put a label on the property to make test reports clearer */ + def :|(l: => Symbol)(implicit d: DummyImplicit) = labelImpl2(l.name) + + /** Put a label on the property to make test reports clearer */ + def |:(l: => Symbol)(implicit d: DummyImplicit) = labelImpl2(l.name) } object Prop { @@ -341,16 +364,16 @@ object Prop { def ==>(p: => Prop) = Prop(b) ==> p /** See the documentation for [[org.scalacheck.Prop]] */ - def :|(l: String) = Prop(b) :| l + def :|(l: String) = Prop(b).labelImpl1(l) /** See the documentation for [[org.scalacheck.Prop]] */ - def |:(l: String) = l |: Prop(b) + def |:(l: String) = Prop(b).labelImpl1(l) /** See the documentation for [[org.scalacheck.Prop]] */ - def :|(l: Symbol) = Prop(b) :| l + def :|(l: Symbol) = Prop(b).labelImpl1(l.name) /** See the documentation for [[org.scalacheck.Prop]] */ - def |:(l: Symbol) = l |: Prop(b) + def |:(l: Symbol) = Prop(b).labelImpl1(l.name) } /** Implicit method that makes a number of property operators on values of type `Any` available in the current scope. @@ -399,7 +422,7 @@ object Prop { */ def ?=[T](x: T, y: T)(implicit pp: T => Pretty): Prop = if (x == y) proved - else falsified :| { + else falsified.labelImpl2 { val exp = Pretty.pretty[T](y, Pretty.Params(0)) val act = Pretty.pretty[T](x, Pretty.Params(0)) "Expected " + exp + " but got " + act diff --git a/core/shared/src/main/scala/org/scalacheck/commands/Commands.scala b/core/shared/src/main/scala/org/scalacheck/commands/Commands.scala index 4891dd8f..057ebca0 100644 --- a/core/shared/src/main/scala/org/scalacheck/commands/Commands.scala +++ b/core/shared/src/main/scala/org/scalacheck/commands/Commands.scala @@ -364,13 +364,13 @@ trait Commands { try { val (p1, s, rs1) = runSeqCmds(sut, as.s, as.seqCmds) val l1 = s"Initial State:\n ${as.s}\nSequential Commands:\n${prettyCmdsRes(as.seqCmds zip rs1, maxLength)}" - if (as.parCmds.isEmpty) p1 :| l1 + if (as.parCmds.isEmpty) p1.labelImpl2(l1) else propAnd( - p1.flatMap { r => if (!r.success) finalize; Prop(_ => r) } :| l1, { + p1.flatMap { r => if (!r.success) finalize; Prop(_ => r) }.labelImpl2(l1), { try { val (p2, rs2) = runParCmds(sut, s, as.parCmds) val l2 = rs2.map(prettyCmdsRes(_, maxLength)).mkString("\n\n") - p2 :| l1 :| s"Parallel Commands (starting in state = ${s})\n$l2" + p2.labelImpl2(l1).labelImpl2(s"Parallel Commands (starting in state = ${s})\n$l2") } finally finalize } ) diff --git a/core/shared/src/test/scala-2.12-/scalacheck/tests/ScalaVersionSpecific.scala b/core/shared/src/test/scala-2.12-/scalacheck/tests/ScalaVersionSpecific.scala new file mode 100644 index 00000000..4275ce1f --- /dev/null +++ b/core/shared/src/test/scala-2.12-/scalacheck/tests/ScalaVersionSpecific.scala @@ -0,0 +1,23 @@ +/* + * ScalaCheck + * Copyright (c) 2007-2021 Rickard Nilsson. All rights reserved. + * http://www.scalacheck.org + * + * This software is released under the terms of the Revised BSD License. + * There is NO WARRANTY. See the file LICENSE for the full text. + */ + +package scalacheck.tests + +import scala.collection.immutable.Stream + +import org.scalacheck.Gen + +private[tests] object ScalaVersionSpecific { + type LazyList[+A] = Stream[A] + val LazyList = Stream +} + +private[tests] trait GenSpecificationVersionSpecific { + def infiniteLazyList[T](g: => Gen[T]): Gen[Stream[T]] = Gen.infiniteStream(g) +} diff --git a/core/shared/src/test/scala-2.12-/org/scalacheck/time/OrderingVersionSpecific.scala b/core/shared/src/test/scala-2.12-/scalacheck/tests/time/OrderingVersionSpecific.scala similarity index 96% rename from core/shared/src/test/scala-2.12-/org/scalacheck/time/OrderingVersionSpecific.scala rename to core/shared/src/test/scala-2.12-/scalacheck/tests/time/OrderingVersionSpecific.scala index 9e1c2933..2c3e298d 100644 --- a/core/shared/src/test/scala-2.12-/org/scalacheck/time/OrderingVersionSpecific.scala +++ b/core/shared/src/test/scala-2.12-/scalacheck/tests/time/OrderingVersionSpecific.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.time +package scalacheck.tests.time import java.time._ import java.time.chrono._ diff --git a/core/shared/src/test/scala-2.13+/scalacheck/tests/ScalaVersionSpecific.scala b/core/shared/src/test/scala-2.13+/scalacheck/tests/ScalaVersionSpecific.scala new file mode 100644 index 00000000..ad71f7f7 --- /dev/null +++ b/core/shared/src/test/scala-2.13+/scalacheck/tests/ScalaVersionSpecific.scala @@ -0,0 +1,14 @@ +/* + * ScalaCheck + * Copyright (c) 2007-2021 Rickard Nilsson. All rights reserved. + * http://www.scalacheck.org + * + * This software is released under the terms of the Revised BSD License. + * There is NO WARRANTY. See the file LICENSE for the full text. + */ + +package scalacheck.tests + +private[tests] object ScalaVersionSpecific + +private[tests] trait GenSpecificationVersionSpecific diff --git a/core/shared/src/test/scala-2.13+/org/scalacheck/time/OrderingVersionSpecific.scala b/core/shared/src/test/scala-2.13+/scalacheck/tests/time/OrderingVersionSpecific.scala similarity index 93% rename from core/shared/src/test/scala-2.13+/org/scalacheck/time/OrderingVersionSpecific.scala rename to core/shared/src/test/scala-2.13+/scalacheck/tests/time/OrderingVersionSpecific.scala index a41aa2c4..34fd47c7 100644 --- a/core/shared/src/test/scala-2.13+/org/scalacheck/time/OrderingVersionSpecific.scala +++ b/core/shared/src/test/scala-2.13+/scalacheck/tests/time/OrderingVersionSpecific.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.time +package scalacheck.tests.time /** This is unused on Scala >= 2.13. * diff --git a/core/shared/src/test/scala/org/scalacheck/NoPropertyNestingSpecification.scala b/core/shared/src/test/scala/scalacheck/tests/NoPropertyNestingSpecification.scala similarity index 93% rename from core/shared/src/test/scala/org/scalacheck/NoPropertyNestingSpecification.scala rename to core/shared/src/test/scala/scalacheck/tests/NoPropertyNestingSpecification.scala index 327aa854..d8ca0926 100644 --- a/core/shared/src/test/scala/org/scalacheck/NoPropertyNestingSpecification.scala +++ b/core/shared/src/test/scala/scalacheck/tests/NoPropertyNestingSpecification.scala @@ -7,7 +7,9 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests + +import org.scalacheck.{Gen, Prop, Properties} object NoPropertyNestingSpecification extends Properties("Properties.no nesting") { property("no nested properties") = { diff --git a/core/shared/src/test/scala/org/scalacheck/PropSpecification.scala b/core/shared/src/test/scala/scalacheck/tests/PropSpecification.scala similarity index 97% rename from core/shared/src/test/scala/org/scalacheck/PropSpecification.scala rename to core/shared/src/test/scala/scalacheck/tests/PropSpecification.scala index ce62b731..84e82ba9 100644 --- a/core/shared/src/test/scala/org/scalacheck/PropSpecification.scala +++ b/core/shared/src/test/scala/scalacheck/tests/PropSpecification.scala @@ -7,9 +7,10 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests -import Prop.{ +import org.scalacheck.{Gen, Prop, Properties, Shrink} +import org.scalacheck.Prop.{ forAll, falsified, undecided, @@ -33,7 +34,8 @@ import Prop.{ lzy, collect } -import Gen.{const, fail, oneOf, listOf, Parameters} +import org.scalacheck.Gen.{const, fail, oneOf, listOf, Parameters} +import org.scalacheck.rng.Seed object PropSpecification extends Properties("Prop") { @@ -224,7 +226,7 @@ object PropSpecification extends Properties("Prop") { property("prop.useSeed is deterministic") = forAll { (p0: Prop, n: Long) => val params = Gen.Parameters.default - val p = p0.useSeed(rng.Seed(n)) + val p = p0.useSeed(Seed(n)) val x = p(params).success val set = (1 to 10).map(_ => p(params).success).toSet Prop(set == Set(x)).label(s"$set == Set($x)") @@ -234,7 +236,7 @@ object PropSpecification extends Properties("Prop") { forAll { (g1: Gen[Int], g2: Gen[Int], g3: Gen[Int], n: Long) => val params = Gen.Parameters.default val p0 = Prop.forAll(g1, g2, g3) { (x, y, z) => x == y && y == z } - val p = p0.useSeed(rng.Seed(n)) + val p = p0.useSeed(Seed(n)) val r1 = p(params).success val r2 = p(params).success Prop(r1 == r2).label(s"$r1 == $r2") diff --git a/core/shared/src/test/scala/org/scalacheck/ShrinkSpecification.scala b/core/shared/src/test/scala/scalacheck/tests/ShrinkSpecification.scala similarity index 96% rename from core/shared/src/test/scala/org/scalacheck/ShrinkSpecification.scala rename to core/shared/src/test/scala/scalacheck/tests/ShrinkSpecification.scala index 0f79ef21..df933200 100644 --- a/core/shared/src/test/scala/org/scalacheck/ShrinkSpecification.scala +++ b/core/shared/src/test/scala/scalacheck/tests/ShrinkSpecification.scala @@ -7,13 +7,14 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests import scala.concurrent.duration.Duration import scala.concurrent.duration.FiniteDuration -import Prop.{forAll, forAllNoShrink, propBoolean} -import Shrink.shrink +import org.scalacheck.{Arbitrary, Gen, Prop, Properties, Shrink} +import org.scalacheck.Prop.{forAll, forAllNoShrink, propBoolean} +import org.scalacheck.Shrink.shrink object ShrinkSpecification extends Properties("Shrink") { diff --git a/core/shared/src/test/scala/org/scalacheck/StatsSpecification.scala b/core/shared/src/test/scala/scalacheck/tests/StatsSpecification.scala similarity index 95% rename from core/shared/src/test/scala/org/scalacheck/StatsSpecification.scala rename to core/shared/src/test/scala/scalacheck/tests/StatsSpecification.scala index 0a214693..ccbbe58c 100644 --- a/core/shared/src/test/scala/org/scalacheck/StatsSpecification.scala +++ b/core/shared/src/test/scala/scalacheck/tests/StatsSpecification.scala @@ -7,9 +7,10 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests -import Prop.{forAllNoShrink => forAll} +import org.scalacheck.{Gen, Prop, Properties, Test} +import org.scalacheck.Prop.{forAllNoShrink => forAll} object StatsSpecification extends Properties("Stats") { diff --git a/core/shared/src/test/scala/org/scalacheck/TestFingerprint.scala b/core/shared/src/test/scala/scalacheck/tests/TestFingerprint.scala similarity index 87% rename from core/shared/src/test/scala/org/scalacheck/TestFingerprint.scala rename to core/shared/src/test/scala/scalacheck/tests/TestFingerprint.scala index 58f7fc50..50509738 100644 --- a/core/shared/src/test/scala/org/scalacheck/TestFingerprint.scala +++ b/core/shared/src/test/scala/scalacheck/tests/TestFingerprint.scala @@ -7,7 +7,9 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests + +import org.scalacheck.{Prop, Properties} class PropsClass extends Properties("TestFingerprint") { property("propclass") = Prop.proved diff --git a/core/shared/src/test/scala/org/scalacheck/examples/Examples.scala b/core/shared/src/test/scala/scalacheck/tests/examples/Examples.scala similarity index 97% rename from core/shared/src/test/scala/org/scalacheck/examples/Examples.scala rename to core/shared/src/test/scala/scalacheck/tests/examples/Examples.scala index 51a5ec0a..7e087d6a 100644 --- a/core/shared/src/test/scala/org/scalacheck/examples/Examples.scala +++ b/core/shared/src/test/scala/scalacheck/tests/examples/Examples.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.examples +package scalacheck.tests.examples import org.scalacheck.Prop import org.scalacheck.Properties diff --git a/core/shared/src/test/scala/org/scalacheck/examples/MathSpec.scala b/core/shared/src/test/scala/scalacheck/tests/examples/MathSpec.scala similarity index 93% rename from core/shared/src/test/scala/org/scalacheck/examples/MathSpec.scala rename to core/shared/src/test/scala/scalacheck/tests/examples/MathSpec.scala index 2407c3e6..0314990d 100644 --- a/core/shared/src/test/scala/org/scalacheck/examples/MathSpec.scala +++ b/core/shared/src/test/scala/scalacheck/tests/examples/MathSpec.scala @@ -7,7 +7,7 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck.examples +package scalacheck.tests.examples import org.scalacheck.Prop.forAll import org.scalacheck.Prop.propBoolean diff --git a/core/shared/src/test/scala/org/scalacheck/util/BuildableSpecification.scala b/core/shared/src/test/scala/scalacheck/tests/util/BuildableSpecification.scala similarity index 94% rename from core/shared/src/test/scala/org/scalacheck/util/BuildableSpecification.scala rename to core/shared/src/test/scala/scalacheck/tests/util/BuildableSpecification.scala index 98a599ff..67287938 100644 --- a/core/shared/src/test/scala/org/scalacheck/util/BuildableSpecification.scala +++ b/core/shared/src/test/scala/scalacheck/tests/util/BuildableSpecification.scala @@ -7,11 +7,13 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests package util import scala.collection._ +import org.scalacheck.Gen +import org.scalacheck.util.Buildable import ScalaVersionSpecific._ object BuildableSpecification { diff --git a/core/shared/src/test/scala/org/scalacheck/util/PrettySpecification.scala b/core/shared/src/test/scala/scalacheck/tests/util/PrettySpecification.scala similarity index 96% rename from core/shared/src/test/scala/org/scalacheck/util/PrettySpecification.scala rename to core/shared/src/test/scala/scalacheck/tests/util/PrettySpecification.scala index f5e5404d..dca8da82 100644 --- a/core/shared/src/test/scala/org/scalacheck/util/PrettySpecification.scala +++ b/core/shared/src/test/scala/scalacheck/tests/util/PrettySpecification.scala @@ -7,11 +7,12 @@ * There is NO WARRANTY. See the file LICENSE for the full text. */ -package org.scalacheck +package scalacheck.tests package util import org.scalacheck.{Gen, Prop, Properties} import org.scalacheck.Prop._ +import org.scalacheck.util.Pretty object PrettySpecification extends Properties("Pretty") {