mirror of https://github.com/sbt/sbt.git
Merge pull request #3669 from cunei/wip-interim-3583
Interim fix for #3583, for 1.0.3
This commit is contained in:
commit
cb79a4ae08
|
|
@ -9,6 +9,7 @@ import sbt.internal.inc.Analysis
|
|||
import TaskExtra._
|
||||
import sbt.internal.util.FeedbackProvidedException
|
||||
import xsbti.api.Definition
|
||||
import xsbti.api.ClassLike
|
||||
import xsbti.compile.CompileAnalysis
|
||||
import ConcurrentRestrictions.Tag
|
||||
|
||||
|
|
@ -385,7 +386,11 @@ object Tests {
|
|||
defined(subclasses, d.baseClasses, d.isModule) ++
|
||||
defined(annotations, d.annotations, d.isModule)
|
||||
|
||||
val discovered = Discovery(firsts(subclasses), firsts(annotations))(definitions)
|
||||
val discovered = Discovery(firsts(subclasses), firsts(annotations))(definitions.filter {
|
||||
case c: ClassLike =>
|
||||
c.topLevel
|
||||
case _ => false
|
||||
})
|
||||
// TODO: To pass in correct explicitlySpecified and selectors
|
||||
val tests = for ((df, di) <- discovered; fingerprint <- toFingerprints(di))
|
||||
yield new TestDefinition(df.name, fingerprint, false, Array(new SuiteSelector))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
### Bug fixes
|
||||
|
||||
In 0.13.x, zinc would discover only top-level objects and classes
|
||||
containing tests, and pass them to the test framework. In 1.x,
|
||||
however, zinc can discover also nested objects and classes; that
|
||||
causes the "name" of a ClassLike to no longer be usable for reflection.
|
||||
|
||||
Version 1.0.3 filters out nested objects/classes from the list,
|
||||
restoring compatibility with 0.13. A zinc extension of ClassLike
|
||||
will probably be introduced in 1.1 or 1.2, in order to provide
|
||||
the test framework with enough information to deal with nested
|
||||
classes.
|
||||
|
||||
[@cunei]: https://github.com/cunei
|
||||
[3583]: https://github.com/sbt/sbt/issues/3583
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.5" % "test"
|
||||
|
||||
version := "0.0.1"
|
||||
name := "broken"
|
||||
organization := "org.catastrophe"
|
||||
//scalaVersion := "2.10.6"
|
||||
scalaVersion := "2.12.3"
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package q
|
||||
|
||||
//
|
||||
// On 1.0.3+ this test will say:
|
||||
// [info] + Nesting.startsWith: OK, passed 100 tests.
|
||||
// [info] Passed: Total 1, Failed 0, Errors 0, Passed 1
|
||||
//
|
||||
// On 1.0.0 to 1.0.2 it will crash with:
|
||||
// [error] java.lang.ClassNotFoundException: q.X.Y$
|
||||
//
|
||||
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
import Prop.forAll
|
||||
|
||||
class U extends Properties("Nesting")
|
||||
object X extends U {
|
||||
property("startsWith") = forAll { (a: String, b: String) =>
|
||||
(a+b).startsWith(a)
|
||||
}
|
||||
object Y extends U {
|
||||
property("endsWith") = forAll { (a: String, b: String) =>
|
||||
(a+b).endsWith(b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
> test
|
||||
|
||||
Loading…
Reference in New Issue