Skip to content

Commit a0aaf10

Browse files
committed
Add debug adapter test fixture
1 parent d7345b3 commit a0aaf10

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.javacs.ktda
2+
3+
import java.nio.file.Path
4+
import java.nio.file.Paths
5+
import org.eclipse.lsp4j.debug.DisconnectArguments
6+
import org.javacs.ktda.adapter.KotlinDebugAdapter
7+
import org.javacs.ktda.jdi.launch.JDILauncher
8+
import org.junit.AfterClass
9+
10+
abstract class DebugAdapterTestFixture(relativeWorkspaceRoot: String) {
11+
private val absoluteWorkspaceRoot: Path = Paths.get(DebugAdapterTestFixture::class.java.getResource("/$relativeWorkspaceRoot").toURI())
12+
val debugAdapter: KotlinDebugAdapter = JDILauncher()
13+
.let(::KotlinDebugAdapter)
14+
.also { it.launch(mapOf(
15+
"projectRoot" to absoluteWorkspaceRoot.toString(),
16+
"mainClass" to "sample.workspace.AppKt"
17+
)) }
18+
19+
@AfterClass private fun closeDebugAdapter() {
20+
debugAdapter.disconnect(DisconnectArguments()).join()
21+
}
22+
}

0 commit comments

Comments
 (0)