Skip to content

Commit b1d4411

Browse files
ono-maxko1
authored andcommitted
Add the new test framework for DAP and CDP
1 parent 9c70455 commit b1d4411

File tree

6 files changed

+830
-1
lines changed

6 files changed

+830
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
/Gemfile.lock
1111
/lib/debug/debug.so
1212
.ruby-version
13+
/debugAdapterProtocol.json
14+
/chromeDevToolsProtocol.json

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ gem "rake"
66
gem "rake-compiler"
77
gem "test-unit", "~> 3.0"
88
gem "test-unit-rr"
9+
gem "json-schema"

lib/debug/server_dap.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def dap_setup bytes
145145
def send **kw
146146
kw[:seq] = @seq += 1
147147
str = JSON.dump(kw)
148-
show_protocol '<', str
149148
@sock.write "Content-Length: #{str.bytesize}\r\n\r\n#{str}"
149+
show_protocol '<', str
150150
end
151151

152152
def send_response req, success: true, message: nil, **kw

test/support/assertions.rb

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ def assert_line_num(expected)
1212
expected == test_info.internal_info['line']
1313
end
1414
})
15+
when 'vscode'
16+
send_request 'stackTrace',
17+
threadId: 1,
18+
startFrame: 0,
19+
levels: 20
20+
res = find_crt_dap_response
21+
failure_msg = FailureMessage.new{create_protocol_message "result:\n#{JSON.pretty_generate res}"}
22+
result = res.dig(:body, :stackFrames, 0, :line)
23+
assert_equal expected, result, failure_msg
24+
when 'chrome'
25+
failure_msg = FailureMessage.new{create_protocol_message "result:\n#{JSON.pretty_generate @crt_frames}"}
26+
result = @crt_frames.dig(0, :location, :lineNumber) + 1
27+
assert_equal expected, result, failure_msg
1528
else
1629
raise 'Invalid environment variable'
1730
end

0 commit comments

Comments
 (0)