Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions sbt-bridge/test/xsbt/DependencySpecification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,30 @@ class DependencySpecification {
assertEquals(Set.empty, inheritance("B"))
}

@Test
def binaryDependencyOnTopLevelObjectUsesModuleClassFile = {
val upstream =
"""|package example
|object Api {
| val value = 1
|}""".stripMargin
val downstream =
"""|package example
|object Usage {
| val value = Api.value
|}""".stripMargin

val compilerForTesting = new ScalaCompilerForUnitTesting
val output = compilerForTesting.compileSrcs(List(List(upstream), List(downstream)))
val downstreamSource = output.srcFiles.last
val dependencyClassFiles = output.analysis.binaryDependencies.collect {
case (classFile, "example.Api$", _, source, _) if source == downstreamSource =>
classFile.getFileName.toString
}

assertEquals(Seq("Api$.class"), dependencyClassFiles.toSeq)
}

@Test
def extractedTopLevelImportDependencies = {
val srcA =
Expand Down
Loading