Skip to content

Commit a01eae5

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 1bbbc1a commit a01eae5

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
@@ -100,9 +100,12 @@ class TestServer(testFolder: Path, workspaces: List[Workspace]) {
100100
path.toAbsolutePath
101101
}
102102

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

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

0 commit comments

Comments
 (0)