Skip to content

Commit 2d91f5d

Browse files
authored
Merge branch 'master' into st0012-improve-protocol-test-case
2 parents 958c882 + f1f9211 commit 2d91f5d

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

lib/debug/server_cdp.rb

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def run_new_chrome
9898
candidates = ['C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']
9999
path = get_chrome_path candidates
100100
end
101-
uuid = SecureRandom.uuid
102101
# The path is based on https://github.com/sindresorhus/open/blob/v8.4.0/index.js#L128.
103102
stdin, stdout, stderr, wait_thr = *Open3.popen3("#{ENV['SystemRoot']}\\System32\\WindowsPowerShell\\v1.0\\powershell")
104103
tf = Tempfile.create(['debug-', '.txt'])

lib/debug/server_dap.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,17 @@ class RetryBecauseCantRead < Exception
251251
end
252252

253253
def recv_request
254-
r = IO.select([@sock])
254+
IO.select([@sock])
255255

256256
@session.process_group.sync do
257257
raise RetryBecauseCantRead unless IO.select([@sock], nil, nil, 0)
258258

259-
case header = @sock.gets
259+
case @sock.gets
260260
when /Content-Length: (\d+)/
261261
b = @sock.read(2)
262262
raise b.inspect unless b == "\r\n"
263263

264-
l = @sock.read(s = $1.to_i)
264+
l = @sock.read($1.to_i)
265265
show_protocol :>, l
266266
JSON.load(l)
267267
when nil
@@ -551,7 +551,7 @@ def process_protocol_request req
551551
when 'stackTrace'
552552
tid = req.dig('arguments', 'threadId')
553553

554-
if tc = find_waiting_tc(tid)
554+
if find_waiting_tc(tid)
555555
request_tc [:dap, :backtrace, req]
556556
else
557557
fail_response req
@@ -560,7 +560,7 @@ def process_protocol_request req
560560
frame_id = req.dig('arguments', 'frameId')
561561
if @frame_map[frame_id]
562562
tid, fid = @frame_map[frame_id]
563-
if tc = find_waiting_tc(tid)
563+
if find_waiting_tc(tid)
564564
request_tc [:dap, :scopes, req, fid]
565565
else
566566
fail_response req
@@ -596,7 +596,7 @@ def process_protocol_request req
596596
frame_id = ref[1]
597597
tid, fid = @frame_map[frame_id]
598598

599-
if tc = find_waiting_tc(tid)
599+
if find_waiting_tc(tid)
600600
request_tc [:dap, :scope, req, fid]
601601
else
602602
fail_response req
@@ -605,7 +605,7 @@ def process_protocol_request req
605605
when :variable
606606
tid, vid = ref[1], ref[2]
607607

608-
if tc = find_waiting_tc(tid)
608+
if find_waiting_tc(tid)
609609
request_tc [:dap, :variable, req, vid]
610610
else
611611
fail_response req
@@ -624,7 +624,7 @@ def process_protocol_request req
624624
tid, fid = @frame_map[frame_id]
625625
expr = req.dig('arguments', 'expression')
626626

627-
if tc = find_waiting_tc(tid)
627+
if find_waiting_tc(tid)
628628
request_tc [:dap, :evaluate, req, fid, expr, context]
629629
else
630630
fail_response req
@@ -645,7 +645,7 @@ def process_protocol_request req
645645
frame_id = req.dig('arguments', 'frameId')
646646
tid, fid = @frame_map[frame_id]
647647

648-
if tc = find_waiting_tc(tid)
648+
if find_waiting_tc(tid)
649649
text = req.dig('arguments', 'text')
650650
line = req.dig('arguments', 'line')
651651
if col = req.dig('arguments', 'column')

lib/debug/source_repository.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def orig_src iseq
4949
lines = iseq.script_lines&.map(&:chomp)
5050
line = iseq.first_line
5151
if line > 1
52-
lines = [*([''] * (line - 1)), *lines]
52+
[*([''] * (line - 1)), *lines]
5353
else
5454
lines
5555
end

test/support/protocol_test_case.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def execute_cdp_scenario_ scenario
370370
scenario.call
371371
ensure
372372
kill_remote_debuggee test_info
373-
if name = test_info.failed_process
373+
if test_info.failed_process
374374
flunk create_protocol_message "Expected the debuggee program to finish"
375375
end
376376
# Because the debuggee may be terminated by executing the following operations, we need to run them after `kill_remote_debuggee` method.
@@ -1070,4 +1070,3 @@ def parse_ k, v
10701070
end
10711071
end
10721072
end
1073-

test/support/test_case.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ def get_request host, port, path
223223
sock.print "GET #{path} HTTP/1.1\r\n"
224224
sock.close_write
225225
loop do
226-
case header = sock.gets
226+
case sock.gets
227227
when /Content-Length: (\d+)/
228228
b = sock.read(2)
229229
raise b.inspect unless b == "\r\n"
230-
230+
231231
l = sock.read $1.to_i
232232
return JSON.parse l, symbolize_names: true
233233
end

test/tool/test_builder.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def activate_debugger
477477
when /\[\>\]\s(.*)/
478478
begin
479479
req = JSON.parse $1
480-
rescue JSON::ParserError => e
480+
rescue JSON::ParserError
481481
$stderr.print data
482482
next
483483
end
@@ -504,7 +504,7 @@ def activate_debugger
504504
when /\[\<\]\s(.*)/
505505
begin
506506
res = JSON.parse $1
507-
rescue JSON::ParserError => e
507+
rescue JSON::ParserError
508508
$stderr.print data
509509
next
510510
end

0 commit comments

Comments
 (0)