Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for frame control commands
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../support/test_case' | ||
|
||
module DEBUGGER__ | ||
class FrameControlTest < TestCase | ||
def program | ||
<<~RUBY | ||
1| class Foo | ||
2| def bar | ||
3| baz | ||
4| end | ||
5| | ||
6| def baz | ||
7| 10 | ||
8| end | ||
9| end | ||
10| | ||
11| Foo.new.bar | ||
RUBY | ||
end | ||
|
||
def test_frame_prints_the_current_frame | ||
debug_code(program) do | ||
type 'b 7' | ||
type 'continue' | ||
|
||
type 'frame' | ||
assert_line_text(/Foo#baz at/) | ||
type 'q!' | ||
end | ||
end | ||
|
||
def test_up_moves_up_one_frame | ||
debug_code(program) do | ||
type 'b 7' | ||
type 'continue' | ||
|
||
type 'frame' | ||
assert_line_text(/Foo#baz at/) | ||
type 'up' | ||
assert_line_text(/Foo#bar at/) | ||
type 'up' | ||
assert_line_text(/<main> at/) | ||
type 'frame' | ||
assert_line_text(/<main> at/) | ||
type 'q!' | ||
end | ||
end | ||
|
||
def test_down_moves_down_one_frame | ||
debug_code(program) do | ||
type 'b 7' | ||
type 'continue' | ||
|
||
type 'up' | ||
assert_line_text(/Foo#bar at/) | ||
type 'up' | ||
assert_line_text(/<main> at/) | ||
type 'down' | ||
assert_line_text(/Foo#bar at/) | ||
type 'down' | ||
assert_line_text(/Foo#baz at/) | ||
type 'q!' | ||
end | ||
end | ||
end | ||
end |