Skip to content

Commit c7dde90

Browse files
committed
Make internal info an official data channel
Because TUI also uses it to retrieve background information about the ThreadClient, it's not for test-only anymore. So this commit makes that clear by removing comments, renaming methods and add a key to test-related info.
1 parent 098fdd4 commit c7dde90

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

lib/debug/local.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def ask prompt
5252
end
5353
end
5454

55-
def puts_internal_info(internal_info)
55+
def puts_internal_test_info(internal_info)
5656
$stdout.puts("INTERNAL_INFO: #{internal_info}")
5757
end
5858

lib/debug/session.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ def request_tc(req)
220220
end
221221

222222
def process_event evt
223-
# variable `@internal_info` is only used for test
224223
@tc, output, ev, @internal_info, *ev_args = evt
225224

226-
capture_tui_data(@internal_info[:tui]) if @ui.tui?
225+
capture_tui_data(@internal_info[:tui]) if @ui.tui? && @internal_info
227226

228227
output.each{|str| @ui.puts str} if ev != :suspend
229228

@@ -387,7 +386,7 @@ def wait_command
387386
@ui.puts "(rdbg:#{@preset_command.source}) #{line}"
388387
end
389388
else
390-
@ui.puts_internal_info(JSON.generate(@internal_info)) if ENV['RUBY_DEBUG_TEST_MODE']
389+
@ui.puts_internal_test_info(JSON.generate(@internal_info[:test])) if ENV['RUBY_DEBUG_TEST_MODE']
391390
line = @ui.readline prompt
392391
end
393392

@@ -1952,7 +1951,7 @@ def event type, *args
19521951
end
19531952
end
19541953

1955-
def puts_internal_info(internal_info)
1954+
def puts_internal_test_info(internal_info)
19561955
puts("INTERNAL_INFO: #{internal_info}")
19571956
end
19581957
end

lib/debug/thread_client.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,8 @@ def generate_tui_data(metadata)
212212
def generate_info
213213
return {} unless current_frame
214214

215-
result = { location: current_frame.location_str, line: current_frame.location.lineno }
216-
217-
if @tui_metadata
218-
result[:tui] = generate_tui_data(@tui_metadata)
219-
end
215+
result = { test: { location: current_frame.location_str, line: current_frame.location.lineno } }
216+
result[:tui] = generate_tui_data(@tui_metadata) if @tui_metadata
220217

221218
result
222219
end

0 commit comments

Comments
 (0)