Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default max_lines when calling up & down #1094

Closed
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1079,13 +1079,13 @@ def wait_next_action_
when :up
if @current_frame_index + 1 < @target_frames.size
@current_frame_index += 1
show_src max_lines: 1
show_src
show_frame(@current_frame_index)
end
when :down
if @current_frame_index > 0
@current_frame_index -= 1
show_src max_lines: 1
show_src
show_frame(@current_frame_index)
end
when :set
Expand Down
74 changes: 56 additions & 18 deletions test/console/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,28 @@ def test_config_show_frames_set
class ShowSrcLinesTest < ConsoleTestCase
def program
<<~RUBY
1| p 1
2| p 2
3| p 3
4| p 4
5| p 5
6| p 6
7| p 7
8| p 8
9| p 9
10| binding.b
11| p 11
12| p 12
13| p 13
14| p 14
15| p 15
1| class Foo
2| def self.a
3| p 1
4| p 2
5| p 3
6| p 3
7| p 5
8| p 6
9| p 7
10| p 8
11| p 9
12| p 10
13| b
14| end
15|
16| def self.b
17| binding.b
18| p 11
19| end
20| end
21|
22| Foo.a
RUBY
end

Expand All @@ -95,11 +102,42 @@ def test_show_src_lines_control_the_lines_displayed_on_breakpoint
type 'config set show_src_lines 2'
type 'continue'
assert_line_text([
/9| p 9/,
/=> 10| binding.b/
/16\| def self\.b/,
/=> 17\| binding\.b/
])
assert_no_line_text(/15\|/)
assert_no_line_text(/18\|/)
type 'continue'
end
end

assert_no_line_text(/p 11/)
def test_show_src_lines_control_the_lines_displayed_on_up
debug_code(program) do
type 'config set show_src_lines 2'
type 'continue'
type 'up'
assert_line_text([
/12\| p 10/,
/=> 13\| b/,
])
assert_no_line_text(/11\|/)
assert_no_line_text(/14\|/)
type 'continue'
end
end

def test_show_src_lines_control_the_lines_displayed_on_down
debug_code(program) do
type 'config set show_src_lines 2'
type 'continue'
type 'up'
type 'down'
assert_line_text([
/16\| def self\.b/,
/=> 17\| binding\.b/
])
assert_no_line_text(/15\|/)
assert_no_line_text(/18\|/)
type 'continue'
end
end
Expand Down