Skip to content

Commit

Permalink
Prepare upgrade to scalacheck 1.11.
Browse files Browse the repository at this point in the history
Our scalacheck tests now compile against 1.10.1 and 1.11.0.
They pass on 1.10.1, but fail on 1.11.0.

Once (that)[typelevel/scalacheck#79 fixed,
and 1.11.1 released, we should be able to upgrade to it by simply
changing scalacheck.version.number in versions.properties.

The changes are mostly removing dead code (e.g., consolereporter business).

Of interest: the type ascription for `oneOf`. I haven't quite investigated,
but something seems to have changed between 1.10.1 and 1.11.0 that caused
a different overload to be picked without the type ascription.
Probably not a scalac bug, just a scalacheck api change.
  • Loading branch information
adriaanm committed Nov 20, 2013
1 parent c243435 commit 733f7f0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 31 deletions.
9 changes: 1 addition & 8 deletions test/files/scalacheck/CheckCollections.scala
@@ -1,4 +1,4 @@
import org.scalacheck.{ ConsoleReporter, Properties }
import org.scalacheck.Properties
import org.scalacheck.Prop._

import scala.reflect.internal.util.Collections._
Expand Down Expand Up @@ -49,11 +49,4 @@ object Test extends Properties("reflect.internal.util.Collections") {
for {
(label, prop) <- tests
} property(label) = prop

import org.scalacheck.{ Test => STest }

def runTests() =
STest.checkProperties(
STest.Params(testCallback = ConsoleReporter(0)), this)

}
12 changes: 2 additions & 10 deletions test/files/scalacheck/CheckEither.scala
@@ -1,10 +1,8 @@
import org.scalacheck.{ Arbitrary, ConsoleReporter, Prop, Properties }
import org.scalacheck.{ Arbitrary, Prop, Properties }
import org.scalacheck.Arbitrary.{arbitrary, arbThrowable}
import org.scalacheck.Gen.oneOf
import org.scalacheck.util.StdRand
import org.scalacheck.Prop._
import org.scalacheck.Test.{Params, check}
import org.scalacheck.ConsoleReporter.testStatsEx
import org.scalacheck.Test.check
import Function.tupled

object Test extends Properties("Either") {
Expand Down Expand Up @@ -178,10 +176,4 @@ object Test extends Properties("Either") {
for ((label, prop) <- tests) {
property(label) = prop
}

import org.scalacheck.{ Test => STest }

def runTests() = {
STest.checkProperties(STest.Params(testCallback = ConsoleReporter(0)), this)
}
}
2 changes: 1 addition & 1 deletion test/files/scalacheck/array-new.scala
@@ -1,4 +1,4 @@
import scala.reflect.{ClassTag, classTag}
import scala.reflect.ClassTag // new style: use ClassTag
import org.scalacheck._
import Prop._
import Gen._
Expand Down
Expand Up @@ -222,7 +222,7 @@ trait ArbitraryTreesAndNames {
yield ValDef(mods, name, tpt, rhs)

def genTree(size: Int): Gen[Tree] =
if (size <= 1) oneOf(EmptyTree, genTreeIsTerm(size), genTreeIsType(size))
if (size <= 1) oneOf(EmptyTree: Gen[Tree], genTreeIsTerm(size), genTreeIsType(size))
else oneOf(genTree(1),
// these trees are neither terms nor types
genPackageDef(size - 1), genModuleDef(size - 1),
Expand Down Expand Up @@ -273,8 +273,8 @@ trait ArbitraryTreesAndNames {
def apply(universe: Universe, value: TreeIsType): universe.Tree =
value.tree.asInstanceOf[universe.Tree]
}
implicit def treeIsTerm2tree(tit: TreeIsTerm) = tit.tree
implicit def treeIsType2tree(tit: TreeIsType) = tit.tree
implicit def treeIsTerm2tree(tit: TreeIsTerm): Tree = tit.tree
implicit def treeIsType2tree(tit: TreeIsType): Tree = tit.tree

implicit val arbConstant: Arbitrary[Constant] = Arbitrary(genConstant)
implicit val arbModifiers: Arbitrary[Modifiers] = Arbitrary(genModifiers)
Expand Down
4 changes: 1 addition & 3 deletions test/files/scalacheck/si4147.scala
@@ -1,8 +1,6 @@
import org.scalacheck.Prop.{forAll, throws}
import org.scalacheck.Properties
import org.scalacheck.ConsoleReporter.testStatsEx
import org.scalacheck.Gen
import org.scalacheck.ConsoleReporter


import collection.mutable
Expand Down Expand Up @@ -66,5 +64,5 @@ object Test extends Properties("Mutable TreeSet") {
}

property("ordering must not be null") =
throws(mutable.TreeSet.empty[Int](null), classOf[NullPointerException])
throws(classOf[NullPointerException])(mutable.TreeSet.empty[Int](null))
}
5 changes: 0 additions & 5 deletions test/files/scalacheck/t2460.scala
@@ -1,6 +1,5 @@
import org.scalacheck.Prop.forAll
import org.scalacheck.Properties
import org.scalacheck.ConsoleReporter.testStatsEx
import org.scalacheck.{Test => SCTest}
import org.scalacheck.Gen

Expand All @@ -25,8 +24,4 @@ object Test extends Properties("Regex : Ticket 2460") {
("numberOfGroup", numberOfGroup),
("nameOfGroup", nameOfGroup)
)

/*tests foreach {
case (name, p) => testStatsEx(name, SCTest.check(p))
}*/
}
2 changes: 1 addition & 1 deletion test/files/scalacheck/treeset.scala
Expand Up @@ -151,5 +151,5 @@ object Test extends Properties("TreeSet") {
}

property("ordering must not be null") =
throws(TreeSet.empty[Int](null), classOf[NullPointerException])
throws(classOf[NullPointerException])(TreeSet.empty[Int](null))
}

0 comments on commit 733f7f0

Please sign in to comment.