debugger 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/README.md +9 -3
- data/debugger.gemspec +1 -1
- data/ext/ruby_debug/192/ruby_debug.c +21 -9
- data/ext/ruby_debug/193/ruby_debug.c +15 -5
- data/lib/debugger/test.rb +6 -0
- data/{test/support → lib/debugger/test}/breakpoint.rb +0 -0
- data/{test/support → lib/debugger/test}/context.rb +0 -0
- data/{test/support → lib/debugger/test}/matchers.rb +0 -0
- data/{test/support → lib/debugger/test}/mocha_extensions.rb +1 -1
- data/lib/debugger/test/printer_helpers.rb +8 -0
- data/{test/support → lib/debugger/test}/processor.rb +0 -0
- data/{test/support → lib/debugger/test}/test_dsl.rb +22 -2
- data/{test/support → lib/debugger/test}/test_interface.rb +4 -0
- data/lib/debugger/version.rb +1 -1
- data/lib/ruby-debug.rb +4 -1
- data/lib/ruby-debug/command.rb +18 -6
- data/lib/ruby-debug/commands/breakpoints.rb +27 -29
- data/lib/ruby-debug/commands/condition.rb +7 -2
- data/lib/ruby-debug/commands/continue.rb +1 -2
- data/lib/ruby-debug/commands/control.rb +8 -9
- data/lib/ruby-debug/commands/display.rb +7 -15
- data/lib/ruby-debug/commands/edit.rb +6 -6
- data/lib/ruby-debug/commands/enable.rb +6 -7
- data/lib/ruby-debug/commands/eval.rb +1 -3
- data/lib/ruby-debug/commands/frame.rb +72 -101
- data/lib/ruby-debug/commands/info.rb +8 -14
- data/lib/ruby-debug/commands/irb.rb +1 -1
- data/lib/ruby-debug/commands/jump.rb +6 -6
- data/lib/ruby-debug/commands/kill.rb +0 -1
- data/lib/ruby-debug/commands/list.rb +4 -4
- data/lib/ruby-debug/commands/method.rb +8 -11
- data/lib/ruby-debug/commands/quit.rb +1 -1
- data/lib/ruby-debug/commands/reload.rb +1 -1
- data/lib/ruby-debug/commands/save.rb +1 -1
- data/lib/ruby-debug/commands/set.rb +10 -15
- data/lib/ruby-debug/commands/show.rb +28 -42
- data/lib/ruby-debug/commands/skip.rb +1 -1
- data/lib/ruby-debug/commands/source.rb +1 -1
- data/lib/ruby-debug/commands/start.rb +26 -0
- data/lib/ruby-debug/commands/threads.rb +29 -18
- data/lib/ruby-debug/commands/tmate.rb +1 -1
- data/lib/ruby-debug/commands/trace.rb +6 -7
- data/lib/ruby-debug/commands/variables.rb +36 -19
- data/lib/ruby-debug/helper.rb +5 -5
- data/lib/ruby-debug/interface.rb +15 -3
- data/lib/ruby-debug/printers/base.rb +58 -0
- data/lib/ruby-debug/printers/plain.rb +41 -0
- data/lib/ruby-debug/printers/texts/base.yml +146 -0
- data/lib/ruby-debug/printers/texts/plain.yml +60 -0
- data/lib/ruby-debug/processor.rb +56 -47
- data/test/breakpoints_test.rb +43 -54
- data/test/conditions_test.rb +18 -6
- data/test/continue_test.rb +1 -1
- data/test/display_test.rb +11 -11
- data/test/edit_test.rb +1 -2
- data/test/eval_test.rb +5 -6
- data/test/finish_test.rb +1 -1
- data/test/frame_test.rb +29 -27
- data/test/help_test.rb +0 -1
- data/test/info_test.rb +10 -14
- data/test/irb_test.rb +0 -1
- data/test/jump_test.rb +21 -2
- data/test/method_test.rb +3 -3
- data/test/new/printers/plain_test.rb +84 -0
- data/test/reload_test.rb +2 -2
- data/test/restart_test.rb +1 -2
- data/test/set_test.rb +8 -7
- data/test/show_test.rb +22 -22
- data/test/source_test.rb +1 -1
- data/test/test_helper.rb +2 -1
- data/test/thread_test.rb +11 -13
- data/test/trace_test.rb +7 -7
- data/test/variables_test.rb +33 -15
- metadata +20 -12
data/test/conditions_test.rb
CHANGED
@@ -15,6 +15,12 @@ describe "Conditions" do
|
|
15
15
|
it "must assign that expression to breakpoint" do
|
16
16
|
debug_file('conditions') { breakpoint.expr.must_equal "b == 5" }
|
17
17
|
end
|
18
|
+
|
19
|
+
it "must show a successful message" do
|
20
|
+
id = nil
|
21
|
+
debug_file('conditions') { id = breakpoint.id }
|
22
|
+
check_output_includes "Condition 'b == 5' is set for the breakpoint #{id}"
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
it "must not stop at the breakpoint if condition is false" do
|
@@ -49,20 +55,26 @@ describe "Conditions" do
|
|
49
55
|
it "must not stop on the breakpoint" do
|
50
56
|
debug_file('conditions') { state.line.must_equal 3 }
|
51
57
|
end
|
58
|
+
|
59
|
+
it "must show a successful message" do
|
60
|
+
id = nil
|
61
|
+
debug_file('conditions') { id = breakpoint.id }
|
62
|
+
check_output_includes "Condition is cleared for the breakpoint #{id}"
|
63
|
+
end
|
52
64
|
end
|
53
65
|
|
54
66
|
|
55
67
|
describe "errors" do
|
56
|
-
it "must show error if there are no breakpoints" do
|
57
|
-
enter 'cond 1 true'
|
58
|
-
debug_file('conditions')
|
59
|
-
check_output_includes "No breakpoints have been set."
|
60
|
-
end
|
61
|
-
|
62
68
|
it "must not set breakpoint condition if breakpoint id is incorrect" do
|
63
69
|
enter 'break 3', 'cond 8 b == 3', 'cont'
|
64
70
|
debug_file('conditions') { state.line.must_equal 3 }
|
65
71
|
end
|
72
|
+
|
73
|
+
it "must show error if there are no breakpoints" do
|
74
|
+
enter 'cond 1 true'
|
75
|
+
debug_file('conditions')
|
76
|
+
check_output_includes "No breakpoints have been set"
|
77
|
+
end
|
66
78
|
end
|
67
79
|
|
68
80
|
|
data/test/continue_test.rb
CHANGED
@@ -21,7 +21,7 @@ describe "Continue Command" do
|
|
21
21
|
it "must show error if there is no specified line" do
|
22
22
|
enter 'cont 123'
|
23
23
|
debug_file('continue')
|
24
|
-
check_output_includes "Line 123 is not a stopping point in file
|
24
|
+
check_output_includes "Line 123 is not a stopping point in file '#{fullpath('continue')}'", interface.error_queue
|
25
25
|
end
|
26
26
|
|
27
27
|
it "must ignore the line if the context is dead"
|
data/test/display_test.rb
CHANGED
@@ -6,13 +6,13 @@ describe "Display Command" do
|
|
6
6
|
it "must show expressions" do
|
7
7
|
enter 'display d + 1', 'break 3', 'cont'
|
8
8
|
debug_file('display')
|
9
|
-
check_output_includes "1:
|
9
|
+
check_output_includes "1: d + 1 = 5"
|
10
10
|
end
|
11
11
|
|
12
12
|
it "must work with shortcut" do
|
13
13
|
enter 'disp d + 1', 'break 3', 'cont'
|
14
14
|
debug_file('display')
|
15
|
-
check_output_includes "1:
|
15
|
+
check_output_includes "1: d + 1 = 5"
|
16
16
|
end
|
17
17
|
|
18
18
|
it "must save displayed expressions" do
|
@@ -25,7 +25,7 @@ describe "Display Command" do
|
|
25
25
|
Debugger.handler.display.concat([[true, "abc"], [true, "d"]]); 'display'
|
26
26
|
end
|
27
27
|
debug_file('display')
|
28
|
-
check_output_includes "1:
|
28
|
+
check_output_includes "1: abc = \n2: d = 4"
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "undisplay" do
|
@@ -51,7 +51,7 @@ describe "Display Command" do
|
|
51
51
|
|
52
52
|
it "must not show any output" do
|
53
53
|
debug_file('display')
|
54
|
-
check_output_doesnt_include "1:
|
54
|
+
check_output_doesnt_include "1: abc = \n2: d = 4"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -64,7 +64,7 @@ describe "Display Command" do
|
|
64
64
|
|
65
65
|
it "must not show any output" do
|
66
66
|
debug_file('display')
|
67
|
-
check_output_includes "1:
|
67
|
+
check_output_includes "1: abc = \n2: d = 4"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -83,12 +83,12 @@ describe "Display Command" do
|
|
83
83
|
|
84
84
|
it "must display only the active position" do
|
85
85
|
debug_file('display')
|
86
|
-
check_output_includes "2:
|
86
|
+
check_output_includes "2: d = 4"
|
87
87
|
end
|
88
88
|
|
89
89
|
it "must not display the disabled position" do
|
90
90
|
debug_file('display')
|
91
|
-
check_output_doesnt_include "1:
|
91
|
+
check_output_doesnt_include "1: abc"
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
@@ -102,13 +102,13 @@ describe "Display Command" do
|
|
102
102
|
it "must show an error if no displays are set" do
|
103
103
|
enter 'disable display 1'
|
104
104
|
debug_file('display')
|
105
|
-
check_output_includes "No display expressions have been set
|
105
|
+
check_output_includes "No display expressions have been set", interface.error_queue
|
106
106
|
end
|
107
107
|
|
108
108
|
it "must show an error if there is no such display position" do
|
109
109
|
enter 'display d', 'disable display 4'
|
110
110
|
debug_file('display')
|
111
|
-
check_output_includes "Disable display argument '4' needs to at most 1
|
111
|
+
check_output_includes "Disable display argument '4' needs to at most 1"
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -125,7 +125,7 @@ describe "Display Command" do
|
|
125
125
|
it "must show display expression in annotation" do
|
126
126
|
enter 'display 2 + 2', 'set annotate 3', 'next', 'next'
|
127
127
|
debug_file 'display'
|
128
|
-
check_output_includes "\x1A\x1Adisplay", "1:
|
128
|
+
check_output_includes "\x1A\x1Adisplay", "1: 2 + 2 = 4"
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -134,7 +134,7 @@ describe "Display Command" do
|
|
134
134
|
it "must be able to set display expressions in post-mortem mode" do
|
135
135
|
enter 'cont', 'display 2 + 2', 'cont'
|
136
136
|
debug_file("post_mortem")
|
137
|
-
check_output_includes "1:
|
137
|
+
check_output_includes "1: 2 + 2 = 4"
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
data/test/edit_test.rb
CHANGED
@@ -30,7 +30,7 @@ describe "Edit Command" do
|
|
30
30
|
it "must show an error if there is no such line" do
|
31
31
|
enter "edit #{fullpath('edit3')}:6"
|
32
32
|
debug_file 'edit'
|
33
|
-
check_output_includes "File
|
33
|
+
check_output_includes "File '#{fullpath('edit3')}' is not readable", interface.error_queue
|
34
34
|
end
|
35
35
|
|
36
36
|
it "must show an error if there is incorrect syntax" do
|
@@ -39,7 +39,6 @@ describe "Edit Command" do
|
|
39
39
|
check_output_includes "Invalid file/line number specification: blabla", interface.error_queue
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
42
|
describe "Post Mortem" do
|
44
43
|
# TODO: This test fails with "Segmentation fault". Probably need to fix it somehow, or forbid this
|
45
44
|
# command in the post mortem mode
|
data/test/eval_test.rb
CHANGED
@@ -31,25 +31,24 @@ describe "Eval Command" do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe "
|
34
|
+
describe "evaluate with error" do
|
35
35
|
temporary_change_hash_value(Debugger::Command.settings, :stack_trace_on_error, false)
|
36
36
|
|
37
37
|
it "must show a stack trace if showing trace on error is enabled" do
|
38
38
|
enter 'set notrace', 'eval 2 / 0'
|
39
39
|
debug_file 'eval'
|
40
|
-
check_output_includes "ZeroDivisionError Exception: divided by 0"
|
41
|
-
check_output_doesnt_include /\S+:\d+:in `eval':divided by 0
|
40
|
+
check_output_includes "ZeroDivisionError Exception: divided by 0", interface.error_queue
|
41
|
+
check_output_doesnt_include /\S+:\d+:in `eval':divided by 0/, interface.error_queue
|
42
42
|
end
|
43
43
|
|
44
44
|
it "must show a stack trace if showing trace on error is enabled" do
|
45
45
|
enter 'set trace', 'eval 2 / 0'
|
46
46
|
debug_file 'eval'
|
47
|
-
check_output_includes /\S+:\d+:in `eval':divided by 0
|
48
|
-
check_output_doesnt_include "ZeroDivisionError Exception: divided by 0"
|
47
|
+
check_output_includes /\S+:\d+:in `eval':divided by 0/, interface.error_queue
|
48
|
+
check_output_doesnt_include "ZeroDivisionError Exception: divided by 0", interface.error_queue
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
|
53
52
|
it "must pretty print the expression result" do
|
54
53
|
enter 'pp {a: "3" * 40, b: "4" * 30}'
|
55
54
|
debug_file 'eval'
|
data/test/finish_test.rb
CHANGED
@@ -28,7 +28,7 @@ describe "Finish Command" do
|
|
28
28
|
|
29
29
|
it "must show an error" do
|
30
30
|
debug_file('finish')
|
31
|
-
check_output_includes "Finish argument 'foo' needs to be a number
|
31
|
+
check_output_includes "Finish argument 'foo' needs to be a number"
|
32
32
|
end
|
33
33
|
|
34
34
|
it "must be on the same line" do
|
data/test/frame_test.rb
CHANGED
@@ -36,7 +36,7 @@ describe "Frame Command" do
|
|
36
36
|
it "must print current stack frame when without arguments" do
|
37
37
|
enter 'break 25', 'cont', 'up', 'frame'
|
38
38
|
debug_file('frame')
|
39
|
-
check_output_includes "#0
|
39
|
+
check_output_includes "#0 A.d(e#String)\n at line #{fullpath('frame')}:25"
|
40
40
|
end
|
41
41
|
|
42
42
|
it "must set frame to the first one" do
|
@@ -46,19 +46,19 @@ describe "Frame Command" do
|
|
46
46
|
|
47
47
|
it "must set frame to the last one" do
|
48
48
|
enter 'break 25', 'cont', 'frame -1'
|
49
|
-
debug_file('frame') { state.line.must_equal
|
49
|
+
debug_file('frame') { state.line.must_equal 29 }
|
50
50
|
end
|
51
51
|
|
52
52
|
it "must not set frame if the frame number is too low" do
|
53
53
|
enter 'break 25', 'cont', 'down'
|
54
54
|
debug_file('frame') { state.line.must_equal 25 }
|
55
|
-
check_output_includes "Adjusting would put us beyond the newest (innermost) frame
|
55
|
+
check_output_includes "Adjusting would put us beyond the newest (innermost) frame", interface.error_queue
|
56
56
|
end
|
57
57
|
|
58
58
|
it "must not set frame if the frame number is too high" do
|
59
59
|
enter 'break 25', 'cont', 'up 100'
|
60
60
|
debug_file('frame') { state.line.must_equal 25 }
|
61
|
-
check_output_includes "Adjusting would put us beyond the oldest (initial) frame
|
61
|
+
check_output_includes "Adjusting would put us beyond the oldest (initial) frame", interface.error_queue
|
62
62
|
end
|
63
63
|
|
64
64
|
describe "full path settings" do
|
@@ -72,45 +72,47 @@ describe "Frame Command" do
|
|
72
72
|
it "must display current backtrace with full path = true" do
|
73
73
|
enter 'set fullpath', 'break 25', 'cont', 'where'
|
74
74
|
debug_file('frame')
|
75
|
-
check_output_includes(
|
76
|
-
"-->
|
77
|
-
|
78
|
-
|
75
|
+
check_output_includes(Regexp.new(
|
76
|
+
"--> #0 A.d\\(e#String\\)\\n" +
|
77
|
+
" at line #{fullpath('frame')}:25\\n" +
|
78
|
+
" #1 A.c at line #{fullpath('frame')}:21\\n",
|
79
|
+
Regexp::MULTILINE))
|
79
80
|
end
|
80
81
|
|
81
82
|
it "must display current backtrace with full path = false" do
|
82
83
|
enter 'set nofullpath', 'break 25', 'cont', 'where'
|
83
84
|
debug_file('frame')
|
84
|
-
check_output_includes(
|
85
|
-
"-->
|
86
|
-
|
87
|
-
)
|
85
|
+
check_output_includes(Regexp.new(
|
86
|
+
"--> #0 A.d\\(e#String\\) at line #{short_path(fullpath('frame'))}:25\\n" +
|
87
|
+
" #1 A.c at line #{short_path(fullpath('frame'))}:21",
|
88
|
+
Regexp::MULTILINE))
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
91
92
|
describe "display backtrace with callstyle" do
|
92
93
|
temporary_change_hash_value(Debugger::Command.settings, :callstyle, :last)
|
93
94
|
|
94
|
-
it "must display current backtrace" do
|
95
|
+
it "must display current backtrace with last callstyle" do
|
95
96
|
enter 'set callstyle last', 'break 25', 'cont', 'where'
|
96
97
|
debug_file('frame')
|
97
|
-
check_output_includes(
|
98
|
-
"-->
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
98
|
+
check_output_includes(Regexp.new(
|
99
|
+
"--> #0 A.d\\(e#String\\)\\n" +
|
100
|
+
" at line #{fullpath('frame')}:25\\n" +
|
101
|
+
" #1 A.c at line #{fullpath('frame')}:21\\n" +
|
102
|
+
" #2 A.b at line #{fullpath('frame')}:17\\n" +
|
103
|
+
" #3 A.a at line #{fullpath('frame')}:14\\n",
|
104
|
+
Regexp::MULTILINE))
|
103
105
|
end
|
104
106
|
|
105
|
-
it "must display current backtrace" do
|
107
|
+
it "must display current backtrace with short callstyle" do
|
106
108
|
enter 'set callstyle short', 'break 25', 'cont', 'where'
|
107
109
|
debug_file('frame')
|
108
|
-
check_output_includes(
|
109
|
-
"-->
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
)
|
110
|
+
check_output_includes(Regexp.new(
|
111
|
+
"--> #0 d\\(e\\) at line #{fullpath('frame')}:25\\n" +
|
112
|
+
" #1 c at line #{fullpath('frame')}:21\\n" +
|
113
|
+
" #2 b at line #{fullpath('frame')}:17\\n" +
|
114
|
+
" #3 a at line #{fullpath('frame')}:14\\n",
|
115
|
+
Regexp::MULTILINE))
|
114
116
|
end
|
115
117
|
|
116
118
|
# NOTE: We also have support of 'tracked' callstyle in the code, but by some reason
|
@@ -118,7 +120,7 @@ describe "Frame Command" do
|
|
118
120
|
it "must not set 'tracked' callstyle" do
|
119
121
|
enter 'set callstyle tracked'
|
120
122
|
debug_file('frame')
|
121
|
-
check_output_includes "Invalid call style tracked. Should be one of: 'short' or 'last'
|
123
|
+
check_output_includes "Invalid call style tracked. Should be one of: 'short' or 'last'"
|
122
124
|
Debugger::Command.settings[:callstyle].must_equal :last
|
123
125
|
end
|
124
126
|
end
|
data/test/help_test.rb
CHANGED
data/test/info_test.rb
CHANGED
@@ -162,7 +162,7 @@ describe "Info Command" do
|
|
162
162
|
it "must show instance variables" do
|
163
163
|
enter 'break 21', 'cont', 'info instance_variables'
|
164
164
|
debug_file 'info'
|
165
|
-
check_output_includes
|
165
|
+
check_output_includes %{@bla = "blabla"\n@foo = "bar"}
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -224,10 +224,10 @@ describe "Info Command" do
|
|
224
224
|
it "must show stack info" do
|
225
225
|
enter 'break 20', 'cont', 'info stack'
|
226
226
|
debug_file 'info'
|
227
|
-
check_output_includes(
|
228
|
-
"-->
|
229
|
-
|
230
|
-
)
|
227
|
+
check_output_includes(Regexp.new(
|
228
|
+
"--> #0 A.a at line #{fullpath('info')}:20\\n" +
|
229
|
+
" #1 A.b at line #{fullpath('info')}:30\\n",
|
230
|
+
Regexp::MULTILINE))
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
@@ -256,13 +256,13 @@ describe "Info Command" do
|
|
256
256
|
thread_number = nil
|
257
257
|
enter ->{thread_number = context.thnum; "info thread #{context.thnum}"}
|
258
258
|
debug_file 'info'
|
259
|
-
check_output_includes
|
259
|
+
check_output_includes /\+ #{thread_number} #<Thread:\S+ run>/
|
260
260
|
end
|
261
261
|
|
262
262
|
it "must show verbose thread info" do
|
263
263
|
enter 'break 20', 'cont', ->{"info thread #{context.thnum} verbose"}
|
264
264
|
debug_file 'info'
|
265
|
-
check_output_includes /#<Thread:\S+ run>/, "#0
|
265
|
+
check_output_includes /#<Thread:\S+ run>/, "#0 A.a at line #{fullpath('info')}:20"
|
266
266
|
end
|
267
267
|
|
268
268
|
it "must show error when unknown parameter is used" do
|
@@ -276,7 +276,7 @@ describe "Info Command" do
|
|
276
276
|
it "must show global variables" do
|
277
277
|
enter 'info global_variables'
|
278
278
|
debug_file 'info'
|
279
|
-
check_output_includes
|
279
|
+
check_output_includes /\$\$ = #{Process.pid}/
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
@@ -289,8 +289,7 @@ describe "Info Command" do
|
|
289
289
|
'a = "1111111111111111111111...',
|
290
290
|
"b = 2",
|
291
291
|
/self = #<A:\S+.../,
|
292
|
-
|
293
|
-
'@foo = "bar"'
|
292
|
+
/@bla = "blabla"\n@foo = "bar"/
|
294
293
|
)
|
295
294
|
end
|
296
295
|
end
|
@@ -301,8 +300,7 @@ describe "Info Command" do
|
|
301
300
|
check_output_includes(
|
302
301
|
'a = *Error in evaluation*',
|
303
302
|
/self = #<A:\S+.../,
|
304
|
-
|
305
|
-
'@foo = "bar"'
|
303
|
+
/@bla = "blabla"\n@foo = "bar"/
|
306
304
|
)
|
307
305
|
end
|
308
306
|
|
@@ -313,7 +311,6 @@ describe "Info Command" do
|
|
313
311
|
end
|
314
312
|
end
|
315
313
|
|
316
|
-
|
317
314
|
describe "Post Mortem" do
|
318
315
|
it "must work in post-mortem mode" do
|
319
316
|
enter 'cont', 'info line'
|
@@ -321,5 +318,4 @@ describe "Info Command" do
|
|
321
318
|
check_output_includes "Line 8 of \"#{fullpath('post_mortem')}\""
|
322
319
|
end
|
323
320
|
end
|
324
|
-
|
325
321
|
end
|
data/test/irb_test.rb
CHANGED
data/test/jump_test.rb
CHANGED
@@ -9,11 +9,24 @@ describe "Jump Command" do
|
|
9
9
|
debug_file('jump') { state.line.must_equal 8 }
|
10
10
|
end
|
11
11
|
|
12
|
+
describe "jumping to the same line" do
|
13
|
+
it "must jump to the same line" do
|
14
|
+
enter 'break 6', 'cont', "jump 6 #{fullpath('jump')}"
|
15
|
+
debug_file('jump') { state.line.must_equal 6 }
|
16
|
+
end
|
17
|
+
|
18
|
+
it "must show show the same position" do
|
19
|
+
enter 'break 6', 'cont', "jump 6 #{fullpath('jump')}"
|
20
|
+
debug_file('jump')
|
21
|
+
check_output_includes "#{fullpath('jump')}:6\nb = 3"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
12
25
|
it "must not initialize skipped variables during jump" do
|
13
26
|
enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}", 'next'
|
14
27
|
enter 'var local'
|
15
28
|
debug_file('jump')
|
16
|
-
check_output_includes
|
29
|
+
check_output_includes /a = 2\nb = nil\nc = nil\nd = 5\ne = nil\nf = nil/
|
17
30
|
end
|
18
31
|
|
19
32
|
it "must jump with relative line number (-)" do
|
@@ -25,6 +38,12 @@ describe "Jump Command" do
|
|
25
38
|
enter 'break 8', 'cont', "jump +2 #{fullpath('jump')}"
|
26
39
|
debug_file('jump') { state.line.must_equal 10 }
|
27
40
|
end
|
41
|
+
|
42
|
+
it "must show message after jump" do
|
43
|
+
enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}"
|
44
|
+
debug_file('jump')
|
45
|
+
check_output_includes "#{fullpath('jump')}:8\nd = 5"
|
46
|
+
end
|
28
47
|
end
|
29
48
|
|
30
49
|
describe "errors" do
|
@@ -37,7 +56,7 @@ describe "Jump Command" do
|
|
37
56
|
it "must show an error if line number is not specified" do
|
38
57
|
enter 'jump'
|
39
58
|
debug_file('jump')
|
40
|
-
check_output_includes '
|
59
|
+
check_output_includes "'jump' must be followed by a line number", interface.error_queue
|
41
60
|
end
|
42
61
|
|
43
62
|
describe "when there is no active code in specified line" do
|