Skip to content

Commit e09075b

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 f79ae94 commit e09075b

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
@@ -97,9 +97,12 @@ class TestServer(testFolder: Path, workspaces: List[Workspace]) {
9797
path.toAbsolutePath
9898
}
9999

100-
private def dependencyClasspath(workspace: Workspace) =
100+
private def dependencyClasspath(workspace: Workspace): Seq[String] = {
101101
BuildInfo.ideTestsDependencyClasspath.map(_.getAbsolutePath) ++
102-
workspace.dependsOn.map(w => classDirectory(w, wipe = false).toString)
102+
workspace.dependsOn.flatMap { dep =>
103+
classDirectory(dep, wipe = false).toString +: dependencyClasspath(dep)
104+
}
105+
}.distinct
103106

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

0 commit comments

Comments
 (0)