Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 197 additions & 0 deletions test/dap/restart_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# frozen_string_literal: true

require_relative '../support/test_case'

module DEBUGGER__

class RestartTest1644070899 < TestCase
PROGRAM = <<~RUBY
1| module Foo
2| class Bar
3| def self.a
4| "hello"
5| end
6| end
7| Bar.a
8| loop do
9| a = 1
10| end
11| bar = Bar.new
12| end
RUBY

def test_restart_works_correctly_1644070899
run_dap_scenario PROGRAM do
[
*INITIALIZE_MSG,
{
seq: 7,
type: "event",
event: "stopped",
body: {
reason: "pause",
threadId: 1,
allThreadsStopped: true
}
},
{
seq: 6,
command: "threads",
type: "request"
},
{
seq: 8,
type: "response",
command: "threads",
request_seq: 6,
success: true,
message: "Success",
body: {
threads: [
{
id: 1,
name: /#1 .*/
}
]
}
},
{
seq: 7,
command: "threads",
type: "request"
},
{
seq: 9,
type: "response",
command: "threads",
request_seq: 7,
success: true,
message: "Success",
body: {
threads: [
{
id: 1,
name: /#1 .*/
}
]
}
},
{
seq: 8,
command: "stackTrace",
arguments: {
threadId: 1,
startFrame: 0,
levels: 20
},
type: "request"
},
{
seq: 10,
type: "response",
command: "stackTrace",
request_seq: 8,
success: true,
message: "Success",
body: {
stackFrames: [
{
name: "<main>",
line: 1,
column: 1,
source: {
name: /#{File.basename temp_file_path}/,
path: /#{temp_file_path}/,
sourceReference: nil
},
id: 1
}
]
}
},
{
seq: 9,
command: "scopes",
arguments: {
frameId: 1
},
type: "request"
},
{
seq: 11,
type: "response",
command: "scopes",
request_seq: 9,
success: true,
message: "Success",
body: {
scopes: [
{
name: "Local variables",
presentationHint: "locals",
namedVariables: /\d+/,
indexedVariables: 0,
expensive: false,
variablesReference: 2
},
{
name: "Global variables",
presentationHint: "globals",
variablesReference: 1,
namedVariables: /\d+/,
indexedVariables: 0,
expensive: false
}
]
}
},
{
seq: 10,
command: "variables",
arguments: {
variablesReference: 2
},
type: "request"
},
{
seq: 12,
type: "response",
command: "variables",
request_seq: 10,
success: true,
message: "Success",
body: {
variables: [
{
name: "%self",
value: "main",
type: "Object",
variablesReference: 3,
indexedVariables: 0,
namedVariables: /\d+/
}
]
}
},
{
seq: 11,
command: "disconnect",
arguments: {
restart: true,
terminateDebuggee: true
},
type: "request"
},
{
seq: 13,
type: "response",
command: "disconnect",
request_seq: 11,
success: true,
message: "Success"
}
]
end
end
end
end