Skip to content

Commit

Permalink
test with dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
iusildra committed Aug 28, 2023
1 parent 2f6989d commit a553696
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions frontend/src/test/scala/bloop/dap/DebugServerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ object DebugServerSpec extends DebugBspBaseSuite {
testTask("Performs Hot Code Replace", FiniteDuration(16, SECONDS)) {
val source2 =
"""|/Main.scala
|object Main {
| def main(args: Array[String]): Unit = {
| println("A")
| new A().m()
| }
|}
|
|class A {
| def m() = {
| println("B")
Expand All @@ -77,7 +70,9 @@ object DebugServerSpec extends DebugBspBaseSuite {
| new A().m()
| }
|}
|
|""".stripMargin
val Asource =
"""|/A.scala
|class A {
| def m() = {
| println("A")
Expand All @@ -86,17 +81,18 @@ object DebugServerSpec extends DebugBspBaseSuite {
|""".stripMargin

val logger = new RecordingLogger(ansiCodesSupported = false)
val project = TestProject(workspace, "r", List(source))
val projectDep = TestProject(workspace, "a", List(Asource))
val mainProject = TestProject(workspace, "r", List(source), List(projectDep))

loadBspStateWithTask(workspace, List(project), logger) { state =>
val testState = state.compile(project).toTestState
val buildProject = testState.getProjectFor(project)
loadBspStateWithTask(workspace, List(mainProject, projectDep), logger) { state =>
val testState = state.compile(mainProject).toTestState
val buildProject = testState.getProjectFor(mainProject)
def srcFor(srcName: String) =
buildProject.sources.map(_.resolve(srcName)).find(_.exists).get
val `Main.scala` = srcFor("Main.scala")
val breakpoints = breakpointsArgs(`Main.scala`, 10)
buildProject.sources.map(_.resolve(s"$srcName")).find(_.exists).get
val `A.scala` = srcFor("../../a/src/A.scala")
val breakpoints = breakpointsArgs(srcFor("Main.scala"), 4)

val runner = mainRunner(project, state)
val runner = mainRunner(mainProject, state)

startDebugServer(runner) { server =>
for {
Expand All @@ -108,8 +104,8 @@ object DebugServerSpec extends DebugBspBaseSuite {
_ = assert(bps.breakpoints.forall(_.verified))
_ <- client.configurationDone()
stopped <- client.stopped
_ = writeFile(`Main.scala`, source2)
_ = state.compile(project)
_ = writeFile(`A.scala`, source2)
_ = state.compile(mainProject)
_ <- client.redefineClasses()
_ <- client.continue(stopped.threadId)
_ <- client.exited
Expand Down

0 comments on commit a553696

Please sign in to comment.