@@ -10,8 +10,9 @@ import org.eclipse.lsp4j.debug.StoppedEventArguments
10
10
import org.eclipse.lsp4j.debug.VariablesArguments
11
11
import org.junit.Assert.assertThat
12
12
import org.junit.Test
13
- import org.hamcrest.Matchers.contains
13
+ import org.hamcrest.Matchers.containsInAnyOrder
14
14
import org.hamcrest.Matchers.equalTo
15
+ import org.hamcrest.Matchers.hasItem
15
16
import org.hamcrest.Matchers.nullValue
16
17
import org.hamcrest.Matchers.not
17
18
import java.util.concurrent.Semaphore
@@ -55,24 +56,25 @@ class SampleWorkspaceTest : DebugAdapterTestFixture("sample-workspace", "sample.
55
56
val stackTrace = debugAdapter.stackTrace(StackTraceArguments ().apply {
56
57
threadId = args.threadId
57
58
}).join()
58
- val topFrame = stackTrace.stackFrames.first()
59
- val scopes = debugAdapter.scopes(ScopesArguments ().apply {
60
- frameId = topFrame.id
61
- }).join()
62
- val scope = scopes.scopes.first()
63
- val variables = debugAdapter.variables(VariablesArguments ().apply {
64
- variablesReference = scope.variablesReference
65
- }).join()
66
- val receiver = variables.variables.find { it.name == " this" }
59
+ val locals = stackTrace.stackFrames.asSequence().flatMap {
60
+ debugAdapter.scopes(ScopesArguments ().apply {
61
+ frameId = it.id
62
+ }).join().scopes.asSequence().flatMap {
63
+ debugAdapter.variables(VariablesArguments ().apply {
64
+ variablesReference = it.variablesReference
65
+ }).join().variables.asSequence()
66
+ }
67
+ }.toList()
68
+ val receiver = locals.find { it.name == " this" }
67
69
68
- assertThat(variables.variables. map { Pair (it.name, it.value) }, contains (Pair (" local" , " 123" )))
70
+ assertThat(locals. map { Pair (it.name, it.value) }, hasItem (Pair (" local" , " 123" )))
69
71
assertThat(receiver, not (nullValue()))
70
72
71
73
val members = debugAdapter.variables(VariablesArguments ().apply {
72
74
variablesReference = receiver!! .variablesReference
73
- }).join()
75
+ }).join().variables
74
76
75
- assertThat(members.variables. map { Pair (it.name, it.value) }, contains (Pair (" member" , " test" )))
77
+ assertThat(members.map { Pair (it.name, it.value) }, containsInAnyOrder (Pair (" member" , " \" test\" " )))
76
78
} catch (e: Throwable ) {
77
79
asyncException = e
78
80
} finally {
0 commit comments