Skip to content

Commit 93fcd94

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 fdedd8a commit 93fcd94

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
@@ -46,9 +46,14 @@ class DefinitionTest {
4646
code"""class Bar { new ${m3}Foo${m4} }"""
4747
)
4848

49-
withWorkspaces(w0, w1)
49+
val w2 = Workspace.dependingOn(w1).withSources(
50+
code"""class Baz extends ${m5}Foo${m6}"""
51+
)
52+
53+
withWorkspaces(w0, w1, w2)
5054
.definition(m1 to m2, List(m1 to m2))
5155
.definition(m3 to m4, List(m1 to m2))
56+
.definition(m5 to m6, List(m1 to m2))
5257
}
5358

5459
@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)