Skip to content

Commit a333cf3

Browse files
ono-maxko1
authored andcommitted
Add the test case for "Restart"
1 parent 1819e94 commit a333cf3

File tree

1 file changed

+197
-0
lines changed

1 file changed

+197
-0
lines changed

test/dap/restart_test.rb

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# frozen_string_literal: true
2+
3+
require_relative '../support/test_case'
4+
5+
module DEBUGGER__
6+
7+
class RestartTest1644070899 < TestCase
8+
PROGRAM = <<~RUBY
9+
1| module Foo
10+
2| class Bar
11+
3| def self.a
12+
4| "hello"
13+
5| end
14+
6| end
15+
7| Bar.a
16+
8| loop do
17+
9| a = 1
18+
10| end
19+
11| bar = Bar.new
20+
12| end
21+
RUBY
22+
23+
def test_restart_works_correctly_1644070899
24+
run_dap_scenario PROGRAM do
25+
[
26+
*INITIALIZE_MSG,
27+
{
28+
seq: 7,
29+
type: "event",
30+
event: "stopped",
31+
body: {
32+
reason: "pause",
33+
threadId: 1,
34+
allThreadsStopped: true
35+
}
36+
},
37+
{
38+
seq: 6,
39+
command: "threads",
40+
type: "request"
41+
},
42+
{
43+
seq: 8,
44+
type: "response",
45+
command: "threads",
46+
request_seq: 6,
47+
success: true,
48+
message: "Success",
49+
body: {
50+
threads: [
51+
{
52+
id: 1,
53+
name: /#1 .*/
54+
}
55+
]
56+
}
57+
},
58+
{
59+
seq: 7,
60+
command: "threads",
61+
type: "request"
62+
},
63+
{
64+
seq: 9,
65+
type: "response",
66+
command: "threads",
67+
request_seq: 7,
68+
success: true,
69+
message: "Success",
70+
body: {
71+
threads: [
72+
{
73+
id: 1,
74+
name: /#1 .*/
75+
}
76+
]
77+
}
78+
},
79+
{
80+
seq: 8,
81+
command: "stackTrace",
82+
arguments: {
83+
threadId: 1,
84+
startFrame: 0,
85+
levels: 20
86+
},
87+
type: "request"
88+
},
89+
{
90+
seq: 10,
91+
type: "response",
92+
command: "stackTrace",
93+
request_seq: 8,
94+
success: true,
95+
message: "Success",
96+
body: {
97+
stackFrames: [
98+
{
99+
name: "<main>",
100+
line: 1,
101+
column: 1,
102+
source: {
103+
name: /#{File.basename temp_file_path}/,
104+
path: /#{temp_file_path}/,
105+
sourceReference: nil
106+
},
107+
id: 1
108+
}
109+
]
110+
}
111+
},
112+
{
113+
seq: 9,
114+
command: "scopes",
115+
arguments: {
116+
frameId: 1
117+
},
118+
type: "request"
119+
},
120+
{
121+
seq: 11,
122+
type: "response",
123+
command: "scopes",
124+
request_seq: 9,
125+
success: true,
126+
message: "Success",
127+
body: {
128+
scopes: [
129+
{
130+
name: "Local variables",
131+
presentationHint: "locals",
132+
namedVariables: /\d+/,
133+
indexedVariables: 0,
134+
expensive: false,
135+
variablesReference: 2
136+
},
137+
{
138+
name: "Global variables",
139+
presentationHint: "globals",
140+
variablesReference: 1,
141+
namedVariables: /\d+/,
142+
indexedVariables: 0,
143+
expensive: false
144+
}
145+
]
146+
}
147+
},
148+
{
149+
seq: 10,
150+
command: "variables",
151+
arguments: {
152+
variablesReference: 2
153+
},
154+
type: "request"
155+
},
156+
{
157+
seq: 12,
158+
type: "response",
159+
command: "variables",
160+
request_seq: 10,
161+
success: true,
162+
message: "Success",
163+
body: {
164+
variables: [
165+
{
166+
name: "%self",
167+
value: "main",
168+
type: "Object",
169+
variablesReference: 3,
170+
indexedVariables: 0,
171+
namedVariables: /\d+/
172+
}
173+
]
174+
}
175+
},
176+
{
177+
seq: 11,
178+
command: "disconnect",
179+
arguments: {
180+
restart: true,
181+
terminateDebuggee: true
182+
},
183+
type: "request"
184+
},
185+
{
186+
seq: 13,
187+
type: "response",
188+
command: "disconnect",
189+
request_seq: 11,
190+
success: true,
191+
message: "Success"
192+
}
193+
]
194+
end
195+
end
196+
end
197+
end

0 commit comments

Comments
 (0)