Skip to content

Commit fd38122

Browse files
committed
Fix TestServer to include transitive dependencies
Test workspaces should be created with the complete dependency classpath of their dependencies. The classpath was wrongly built with only the class directory of their dependencies.
1 parent 10294ab commit fd38122

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

language-server/test/dotty/tools/languageserver/DefinitionTest.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ class DefinitionTest {
2828
code"""class Bar { new ${m3}Foo${m4} }"""
2929
)
3030

31-
withWorkspaces(w0, w1)
31+
val w2 = Workspace.dependingOn(w1).withSources(
32+
code"""class Baz extends ${m5}Foo${m6}"""
33+
)
34+
35+
withWorkspaces(w0, w1, w2)
3236
.definition(m1 to m2, List(m1 to m2))
3337
.definition(m3 to m4, List(m1 to m2))
38+
.definition(m5 to m6, List(m1 to m2))
3439
}
3540

3641
@Test def valDefinition0: Unit = {

language-server/test/dotty/tools/languageserver/util/server/TestServer.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,12 @@ class TestServer(testFolder: Path, workspaces: List[Workspace]) {
102102
path.toAbsolutePath
103103
}
104104

105-
private def dependencyClasspath(workspace: Workspace) =
105+
private def dependencyClasspath(workspace: Workspace): Seq[String] = {
106106
BuildInfo.ideTestsDependencyClasspath.map(_.getAbsolutePath) ++
107-
workspace.dependsOn.map(w => classDirectory(w, wipe = false).toString)
107+
workspace.dependsOn.flatMap { dep =>
108+
classDirectory(dep, wipe = false).toString +: dependencyClasspath(dep)
109+
}
110+
}.distinct
108111

109112
private def sourceDirectory(workspace: Workspace, wipe: Boolean): Path = {
110113
val path = TestFile.sourceDir.resolve(workspace.name).toAbsolutePath

0 commit comments

Comments
 (0)