mirror of https://github.com/sbt/sbt.git
Fixes test
This commit is contained in:
parent
c75a386a82
commit
9458eb6428
|
|
@ -15,7 +15,7 @@ class ExtractAPISpecification extends Specification {
|
|||
|
||||
def stableExistentialNames: Boolean = {
|
||||
def compileAndGetFooMethodApi(src: String): Def = {
|
||||
val compilerForTesting = new ScalaCompilerForUnitTesting
|
||||
val compilerForTesting = new ScalaCompilerForUnitTesting(nameHashing = false)
|
||||
val sourceApi = compilerForTesting.extractApiFromSrc(src)
|
||||
val FooApi = sourceApi.definitions().find(_.name() == "Foo").get.asInstanceOf[ClassLike]
|
||||
val fooMethodApi = FooApi.structure().declared().find(_.name == "foo").get
|
||||
|
|
@ -66,7 +66,7 @@ class ExtractAPISpecification extends Specification {
|
|||
| class Foo extends Namers
|
||||
|}
|
||||
|""".stripMargin
|
||||
val compilerForTesting = new ScalaCompilerForUnitTesting
|
||||
val compilerForTesting = new ScalaCompilerForUnitTesting(nameHashing = false)
|
||||
val apis = compilerForTesting.extractApisFromSrcs(reuseCompilerInstance = false)(List(src1, src2), List(src2))
|
||||
val _ :: src2Api1 :: src2Api2 :: Nil = apis.toList
|
||||
val namerApi1 = selectNamer(src2Api1)
|
||||
|
|
@ -92,7 +92,7 @@ class ExtractAPISpecification extends Specification {
|
|||
val srcC6 = "class C6 extends AnyRef with X { self: X with Y => }"
|
||||
val srcC7 = "class C7 { _ => }"
|
||||
val srcC8 = "class C8 { self => }"
|
||||
val compilerForTesting = new ScalaCompilerForUnitTesting
|
||||
val compilerForTesting = new ScalaCompilerForUnitTesting(nameHashing = false)
|
||||
val apis = compilerForTesting.extractApisFromSrcs(reuseCompilerInstance = true)(
|
||||
List(srcX, srcY, srcC1, srcC2, srcC3, srcC4, srcC5, srcC6, srcC7, srcC8)
|
||||
).map(x => collectFirstClass(x.definitions))
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import ScalaCompilerForUnitTesting.ExtractedSourceDependencies
|
|||
* Provides common functionality needed for unit tests that require compiling
|
||||
* source code using Scala compiler.
|
||||
*/
|
||||
class ScalaCompilerForUnitTesting(nameHashing: Boolean = false) {
|
||||
class ScalaCompilerForUnitTesting(nameHashing: Boolean, includeSynthToNameHashing: Boolean = false) {
|
||||
|
||||
/**
|
||||
* Compiles given source code using Scala compiler and returns API representation
|
||||
|
|
@ -127,7 +127,7 @@ class ScalaCompilerForUnitTesting(nameHashing: Boolean = false) {
|
|||
private def compileSrcs(groupedSrcs: List[List[String]],
|
||||
reuseCompilerInstance: Boolean): (Seq[File], TestCallback) = {
|
||||
withTemporaryDirectory { temp =>
|
||||
val analysisCallback = new TestCallback(nameHashing)
|
||||
val analysisCallback = new TestCallback(nameHashing, includeSynthToNameHashing)
|
||||
val classesDir = new File(temp, "classes")
|
||||
classesDir.mkdir()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import scala.collection.mutable.ArrayBuffer
|
|||
import xsbti.api.SourceAPI
|
||||
import xsbti.DependencyContext._
|
||||
|
||||
class TestCallback(override val nameHashing: Boolean = false) extends AnalysisCallback
|
||||
class TestCallback(override val nameHashing: Boolean, override val includeSynthToNameHashing: Boolean) extends AnalysisCallback
|
||||
{
|
||||
val sourceDependencies = new ArrayBuffer[(File, File, DependencyContext)]
|
||||
val binaryDependencies = new ArrayBuffer[(File, String, File, DependencyContext)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue