Skip to content

Commit e7cc649

Browse files
author
ono-max
committed
add tests
1 parent 089ae90 commit e7cc649

File tree

1 file changed

+375
-0
lines changed

1 file changed

+375
-0
lines changed

test/dap/foo_test.rb

Lines changed: 375 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,375 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../support/test_case'
4+
5+
module DEBUGGER__
6+
7+
class FooTest1643891417 < TestCase
8+
PROGRAM = <<~RUBY
9+
1| module Foo
10+
2| class Bar
11+
3| def self.a
12+
4| raise 'foo'
13+
5| end
14+
6| end
15+
7| Bar.a
16+
8| bar = Bar.new
17+
9| end
18+
RUBY
19+
20+
def test_1643891417
21+
run_dap_scenario PROGRAM do
22+
[
23+
*INITIALIZE_MSG,
24+
{
25+
seq: 7,
26+
type: "event",
27+
event: "stopped",
28+
body: {
29+
reason: "pause",
30+
threadId: 1,
31+
allThreadsStopped: true
32+
}
33+
},
34+
{
35+
seq: 6,
36+
command: "threads",
37+
type: "request"
38+
},
39+
{
40+
seq: 8,
41+
type: "response",
42+
command: "threads",
43+
request_seq: 6,
44+
success: true,
45+
message: "Success",
46+
body: {
47+
threads: [
48+
{
49+
id: 1,
50+
name: /#1 .*/
51+
}
52+
]
53+
}
54+
},
55+
{
56+
seq: 7,
57+
command: "threads",
58+
type: "request"
59+
},
60+
{
61+
seq: 9,
62+
type: "response",
63+
command: "threads",
64+
request_seq: 7,
65+
success: true,
66+
message: "Success",
67+
body: {
68+
threads: [
69+
{
70+
id: 1,
71+
name: /#1 .*/
72+
}
73+
]
74+
}
75+
},
76+
{
77+
seq: 8,
78+
command: "stackTrace",
79+
arguments: {
80+
threadId: 1,
81+
startFrame: 0,
82+
levels: 20
83+
},
84+
type: "request"
85+
},
86+
{
87+
seq: 10,
88+
type: "response",
89+
command: "stackTrace",
90+
request_seq: 8,
91+
success: true,
92+
message: "Success",
93+
body: {
94+
stackFrames: [
95+
{
96+
name: "<main>",
97+
line: 1,
98+
column: 1,
99+
source: {
100+
name: /#{File.basename temp_file_path}/,
101+
path: /#{temp_file_path}/,
102+
sourceReference: nil
103+
},
104+
id: 1
105+
}
106+
]
107+
}
108+
},
109+
{
110+
seq: 9,
111+
command: "scopes",
112+
arguments: {
113+
frameId: 1
114+
},
115+
type: "request"
116+
},
117+
{
118+
seq: 11,
119+
type: "response",
120+
command: "scopes",
121+
request_seq: 9,
122+
success: true,
123+
message: "Success",
124+
body: {
125+
scopes: [
126+
{
127+
name: "Local variables",
128+
presentationHint: "locals",
129+
namedVariables: /\d+/,
130+
indexedVariables: 0,
131+
expensive: false,
132+
variablesReference: 2
133+
},
134+
{
135+
name: "Global variables",
136+
presentationHint: "globals",
137+
variablesReference: 1,
138+
namedVariables: /\d+/,
139+
indexedVariables: 0,
140+
expensive: false
141+
}
142+
]
143+
}
144+
},
145+
{
146+
seq: 10,
147+
command: "variables",
148+
arguments: {
149+
variablesReference: 2
150+
},
151+
type: "request"
152+
},
153+
{
154+
seq: 12,
155+
type: "response",
156+
command: "variables",
157+
request_seq: 10,
158+
success: true,
159+
message: "Success",
160+
body: {
161+
variables: [
162+
{
163+
name: "%self",
164+
value: "main",
165+
type: "Object",
166+
variablesReference: 3,
167+
indexedVariables: 0,
168+
namedVariables: /\d+/
169+
}
170+
]
171+
}
172+
},
173+
{
174+
seq: 11,
175+
command: "continue",
176+
arguments: {
177+
threadId: 1
178+
},
179+
type: "request"
180+
},
181+
{
182+
seq: 13,
183+
type: "response",
184+
command: "continue",
185+
request_seq: 11,
186+
success: true,
187+
message: "Success",
188+
body: {
189+
allThreadsContinued: true
190+
}
191+
},
192+
{
193+
seq: 14,
194+
type: "event",
195+
event: "stopped",
196+
body: {
197+
reason: "exception",
198+
description: "#<RuntimeError: foo> is raised.",
199+
text: "#<RuntimeError: foo> is raised.",
200+
threadId: 1,
201+
allThreadsStopped: true
202+
}
203+
},
204+
{
205+
seq: 12,
206+
command: "threads",
207+
type: "request"
208+
},
209+
{
210+
seq: 15,
211+
type: "response",
212+
command: "threads",
213+
request_seq: 12,
214+
success: true,
215+
message: "Success",
216+
body: {
217+
threads: [
218+
{
219+
id: 1,
220+
name: /#1 .*/
221+
}
222+
]
223+
}
224+
},
225+
{
226+
seq: 13,
227+
command: "stackTrace",
228+
arguments: {
229+
threadId: 1,
230+
startFrame: 0,
231+
levels: 20
232+
},
233+
type: "request"
234+
},
235+
{
236+
seq: 16,
237+
type: "response",
238+
command: "stackTrace",
239+
request_seq: 13,
240+
success: true,
241+
message: "Success",
242+
body: {
243+
stackFrames: [
244+
{
245+
name: "Foo::Bar.a",
246+
line: 4,
247+
column: 1,
248+
source: {
249+
name: /#{File.basename temp_file_path}/,
250+
path: /#{temp_file_path}/,
251+
sourceReference: nil
252+
},
253+
id: 2
254+
},
255+
{
256+
name: "<module:Foo>",
257+
line: 7,
258+
column: 1,
259+
source: {
260+
name: /#{File.basename temp_file_path}/,
261+
path: /#{temp_file_path}/,
262+
sourceReference: nil
263+
},
264+
id: 3
265+
},
266+
{
267+
name: "<main>",
268+
line: 1,
269+
column: 1,
270+
source: {
271+
name: /#{File.basename temp_file_path}/,
272+
path: /#{temp_file_path}/,
273+
sourceReference: nil
274+
},
275+
id: 4
276+
}
277+
]
278+
}
279+
},
280+
{
281+
seq: 14,
282+
command: "scopes",
283+
arguments: {
284+
frameId: 2
285+
},
286+
type: "request"
287+
},
288+
{
289+
seq: 17,
290+
type: "response",
291+
command: "scopes",
292+
request_seq: 14,
293+
success: true,
294+
message: "Success",
295+
body: {
296+
scopes: [
297+
{
298+
name: "Local variables",
299+
presentationHint: "locals",
300+
namedVariables: /\d+/,
301+
indexedVariables: 0,
302+
expensive: false,
303+
variablesReference: 4
304+
},
305+
{
306+
name: "Global variables",
307+
presentationHint: "globals",
308+
variablesReference: 1,
309+
namedVariables: /\d+/,
310+
indexedVariables: 0,
311+
expensive: false
312+
}
313+
]
314+
}
315+
},
316+
{
317+
seq: 15,
318+
command: "variables",
319+
arguments: {
320+
variablesReference: 4
321+
},
322+
type: "request"
323+
},
324+
{
325+
seq: 18,
326+
type: "response",
327+
command: "variables",
328+
request_seq: 15,
329+
success: true,
330+
message: "Success",
331+
body: {
332+
variables: [
333+
{
334+
name: "%self",
335+
value: "Foo::Bar",
336+
type: "Class",
337+
variablesReference: 5,
338+
indexedVariables: 0,
339+
namedVariables: /\d+/
340+
},
341+
{
342+
name: "_raised",
343+
value: "#<RuntimeError: foo>",
344+
type: "RuntimeError",
345+
variablesReference: 6,
346+
indexedVariables: 0,
347+
namedVariables: /\d+/
348+
}
349+
]
350+
}
351+
},
352+
{
353+
seq: 16,
354+
command: "continue",
355+
arguments: {
356+
threadId: 1
357+
},
358+
type: "request"
359+
},
360+
{
361+
seq: 19,
362+
type: "response",
363+
command: "continue",
364+
request_seq: 16,
365+
success: true,
366+
message: "Success",
367+
body: {
368+
allThreadsContinued: true
369+
}
370+
}
371+
]
372+
end
373+
end
374+
end
375+
end

0 commit comments

Comments
 (0)