@@ -12,6 +12,8 @@ import org.junit.Assert.assertThat
12
12
import org.junit.Test
13
13
import org.hamcrest.Matchers.contains
14
14
import org.hamcrest.Matchers.equalTo
15
+ import org.hamcrest.Matchers.nullValue
16
+ import org.hamcrest.Matchers.not
15
17
import java.util.concurrent.Semaphore
16
18
17
19
/* *
@@ -43,25 +45,33 @@ class SampleWorkspaceTest : DebugAdapterTestFixture("sample-workspace", "sample.
43
45
}
44
46
45
47
override fun stopped (args : StoppedEventArguments ) {
46
- assertThat(args.reason, equalTo(" breakpoint" ))
48
+ try {
49
+ assertThat(args.reason, equalTo(" breakpoint" ))
47
50
48
- // Query information about the debuggee's current state
49
- val stackTrace = debugAdapter.stackTrace(StackTraceArguments ().apply {
50
- threadId = args.threadId
51
- }).join()
52
- val topFrame = stackTrace.stackFrames.first()
53
- val scopes = debugAdapter.scopes(ScopesArguments ().apply {
54
- frameId = topFrame.id
55
- }).join()
56
- val scope = scopes.scopes.first()
57
- val variables = debugAdapter.variables(VariablesArguments ().apply {
58
- variablesReference = scope.variablesReference
59
- }).join()
60
-
61
- assertThat(variables.variables.map { Pair (it.name, it.value) }, contains(
62
- Pair (" member" , " \" test\" " ),
63
- Pair (" local" , " 123" )
64
- ))
65
- semaphore.release()
51
+ // Query information about the debuggee's current state
52
+ val stackTrace = debugAdapter.stackTrace(StackTraceArguments ().apply {
53
+ threadId = args.threadId
54
+ }).join()
55
+ val topFrame = stackTrace.stackFrames.first()
56
+ val scopes = debugAdapter.scopes(ScopesArguments ().apply {
57
+ frameId = topFrame.id
58
+ }).join()
59
+ val scope = scopes.scopes.first()
60
+ val variables = debugAdapter.variables(VariablesArguments ().apply {
61
+ variablesReference = scope.variablesReference
62
+ }).join()
63
+ val receiver = variables.variables.find { it.name == " this" }
64
+
65
+ assertThat(variables.variables.map { Pair (it.name, it.value) }, contains(Pair (" local" , " 123" )))
66
+ assertThat(receiver, not (nullValue()))
67
+
68
+ val members = debugAdapter.variables(VariablesArguments ().apply {
69
+ variablesReference = receiver!! .variablesReference
70
+ }).join()
71
+
72
+ assertThat(members.variables.map { Pair (it.name, it.value) }, contains(Pair (" member" , " test" )))
73
+ } finally {
74
+ semaphore.release()
75
+ }
66
76
}
67
77
}
0 commit comments