Skip to content

Commit a517a6f

Browse files
committed
Propagate exceptions from the asynchronous context
1 parent 2cd26d7 commit a517a6f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

adapter/src/test/kotlin/org/javacs/ktda/SampleWorkspaceTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import java.util.concurrent.Semaphore
2222
*/
2323
class SampleWorkspaceTest : DebugAdapterTestFixture("sample-workspace", "sample.workspace.AppKt") {
2424
private val semaphore = Semaphore(0)
25+
private var asyncException: Throwable? = null
2526

2627
@Test fun testBreakpointsAndVariables() {
2728
debugAdapter.setBreakpoints(SetBreakpointsArguments().apply {
@@ -40,8 +41,10 @@ class SampleWorkspaceTest : DebugAdapterTestFixture("sample-workspace", "sample.
4041
line = 8
4142
})
4243
}).join()
44+
4345
launch()
4446
semaphore.acquire() // Wait for the end
47+
asyncException?.let { throw it }
4548
}
4649

4750
override fun stopped(args: StoppedEventArguments) {
@@ -70,6 +73,8 @@ class SampleWorkspaceTest : DebugAdapterTestFixture("sample-workspace", "sample.
7073
}).join()
7174

7275
assertThat(members.variables.map { Pair(it.name, it.value) }, contains(Pair("member", "test")))
76+
} catch (e: Throwable) {
77+
asyncException = e
7378
} finally {
7479
semaphore.release()
7580
}

0 commit comments

Comments
 (0)