byebug 3.0.0 → 3.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/GUIDE.md +2 -2
- data/LICENSE +3 -3
- data/README.md +5 -4
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +20 -19
- data/lib/byebug.rb +2 -53
- data/lib/byebug/command.rb +9 -109
- data/lib/byebug/commands/breakpoints.rb +1 -1
- data/lib/byebug/commands/control.rb +20 -21
- data/lib/byebug/commands/display.rb +2 -3
- data/lib/byebug/commands/eval.rb +6 -16
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/frame.rb +9 -9
- data/lib/byebug/commands/help.rb +2 -3
- data/lib/byebug/commands/history.rb +28 -0
- data/lib/byebug/commands/info.rb +3 -3
- data/lib/byebug/commands/list.rb +2 -13
- data/lib/byebug/commands/method.rb +5 -45
- data/lib/byebug/commands/reload.rb +1 -12
- data/lib/byebug/commands/repl.rb +6 -15
- data/lib/byebug/commands/save.rb +2 -7
- data/lib/byebug/commands/set.rb +45 -116
- data/lib/byebug/commands/show.rb +22 -126
- data/lib/byebug/commands/stepping.rb +1 -1
- data/lib/byebug/commands/trace.rb +14 -25
- data/lib/byebug/commands/variables.rb +3 -41
- data/lib/byebug/helper.rb +11 -42
- data/lib/byebug/history.rb +5 -13
- data/lib/byebug/processors/command_processor.rb +6 -6
- data/lib/byebug/setting.rb +82 -0
- data/lib/byebug/settings/autoeval.rb +20 -0
- data/lib/byebug/settings/autoirb.rb +19 -0
- data/lib/byebug/settings/autolist.rb +19 -0
- data/lib/byebug/settings/autoreload.rb +11 -0
- data/lib/byebug/settings/autosave.rb +11 -0
- data/lib/byebug/settings/basename.rb +7 -0
- data/lib/byebug/settings/callstyle.rb +15 -0
- data/lib/byebug/settings/forcestep.rb +11 -0
- data/lib/byebug/settings/fullpath.rb +11 -0
- data/lib/byebug/settings/histfile.rb +16 -0
- data/lib/byebug/settings/histsize.rb +18 -0
- data/lib/byebug/settings/linetrace.rb +15 -0
- data/lib/byebug/settings/listsize.rb +15 -0
- data/lib/byebug/settings/post_mortem.rb +15 -0
- data/lib/byebug/settings/stack_on_error.rb +7 -0
- data/lib/byebug/settings/testing.rb +7 -0
- data/lib/byebug/settings/tracing_plus.rb +7 -0
- data/lib/byebug/settings/verbose.rb +7 -0
- data/lib/byebug/settings/width.rb +29 -0
- data/lib/byebug/version.rb +1 -1
- data/test/breakpoints_test.rb +345 -324
- data/test/conditions_test.rb +61 -48
- data/test/continue_test.rb +38 -27
- data/test/debugger_alias_test.rb +5 -3
- data/test/display_test.rb +103 -92
- data/test/edit_test.rb +42 -34
- data/test/eval_test.rb +91 -75
- data/test/finish_test.rb +51 -40
- data/test/frame_test.rb +197 -184
- data/test/help_test.rb +47 -38
- data/test/history_test.rb +54 -0
- data/test/info_test.rb +306 -293
- data/test/interrupt_test.rb +44 -38
- data/test/kill_test.rb +40 -31
- data/test/list_test.rb +166 -133
- data/test/method_test.rb +67 -60
- data/test/post_mortem_test.rb +56 -48
- data/test/quit_test.rb +44 -35
- data/test/reload_test.rb +36 -24
- data/test/repl_test.rb +57 -47
- data/test/restart_test.rb +56 -69
- data/test/save_test.rb +62 -53
- data/test/set_test.rb +140 -118
- data/test/show_test.rb +68 -201
- data/test/source_test.rb +39 -29
- data/test/stepping_test.rb +163 -136
- data/test/support/test_dsl.rb +9 -11
- data/test/test_helper.rb +2 -7
- data/test/thread_test.rb +121 -107
- data/test/trace_test.rb +86 -83
- data/test/variables_test.rb +104 -98
- metadata +27 -86
- data/test/examples/breakpoint.rb +0 -6
- data/test/examples/breakpoint_deep.rb +0 -4
- data/test/examples/conditions.rb +0 -4
- data/test/examples/continue.rb +0 -5
- data/test/examples/display.rb +0 -5
- data/test/examples/edit.rb +0 -4
- data/test/examples/eval.rb +0 -4
- data/test/examples/finish.rb +0 -3
- data/test/examples/frame.rb +0 -4
- data/test/examples/frame_deep.rb +0 -1
- data/test/examples/gcd.rb +0 -15
- data/test/examples/hanoi.rb +0 -34
- data/test/examples/help.rb +0 -1
- data/test/examples/info.rb +0 -6
- data/test/examples/info2.rb +0 -3
- data/test/examples/interrupt.rb +0 -8
- data/test/examples/kill.rb +0 -2
- data/test/examples/list.rb +0 -23
- data/test/examples/method.rb +0 -4
- data/test/examples/post_mortem.rb +0 -4
- data/test/examples/primes.rb +0 -25
- data/test/examples/quit.rb +0 -2
- data/test/examples/reload.rb +0 -6
- data/test/examples/repl.rb +0 -6
- data/test/examples/restart.rb +0 -6
- data/test/examples/save.rb +0 -3
- data/test/examples/set.rb +0 -3
- data/test/examples/settings.rb +0 -1
- data/test/examples/show.rb +0 -1
- data/test/examples/source.rb +0 -3
- data/test/examples/stepping.rb +0 -8
- data/test/examples/stepping_raise_from_c_method.rb +0 -3
- data/test/examples/stepping_raise_from_ruby_method.rb +0 -3
- data/test/examples/test-triangle.rb +0 -14
- data/test/examples/thread.rb +0 -5
- data/test/examples/tmate.rb +0 -10
- data/test/examples/trace.rb +0 -8
- data/test/examples/tri3.rb +0 -6
- data/test/examples/triangle.rb +0 -13
- data/test/examples/variables.rb +0 -4
- data/test/timeout_test.rb +0 -9
data/test/show_test.rb
CHANGED
@@ -1,230 +1,97 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
it 'must show args' do
|
7
|
-
enter 'show args'
|
8
|
-
debug_file 'show'
|
9
|
-
check_output_includes 'Argument list to give program being debugged ' \
|
10
|
-
'when it is started is "foo bar".'
|
1
|
+
module ShowTest
|
2
|
+
class ShowTestCase < TestDsl::TestCase
|
3
|
+
before do
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
11
6
|
end
|
12
7
|
end
|
13
8
|
|
14
|
-
|
15
|
-
|
9
|
+
[:autoeval, :autolist, :autoreload, :autosave, :basename, :forcestep,
|
10
|
+
:fullpath, :post_mortem, :stack_on_error, :testing, :linetrace,
|
11
|
+
:tracing_plus].each do |setting|
|
12
|
+
describe "showing disabled boolean setting #{setting}" do
|
13
|
+
temporary_change_hash Byebug::Setting, setting, false
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
it 'must show default value' do
|
16
|
+
enter "show #{setting}"
|
17
|
+
debug_proc(@example)
|
18
|
+
check_output_includes "#{setting} is off"
|
19
|
+
end
|
22
20
|
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'autolist' do
|
27
|
-
it 'must show default value' do
|
28
|
-
enter 'show autolist'
|
29
|
-
debug_file 'show'
|
30
|
-
check_output_includes 'autolist is on.'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'autoeval' do
|
35
|
-
it 'must show default value' do
|
36
|
-
enter 'show autoeval'
|
37
|
-
debug_file 'show'
|
38
|
-
check_output_includes 'autoeval is on.'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'autoreload' do
|
43
|
-
it 'must show default value' do
|
44
|
-
enter 'show autoreload'
|
45
|
-
debug_file 'show'
|
46
|
-
check_output_includes 'autoreload is on.'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'autoirb' do
|
51
|
-
before { Byebug::IrbCommand.any_instance.stubs(:execute) }
|
52
|
-
|
53
|
-
it 'must show default value' do
|
54
|
-
enter 'show autoirb'
|
55
|
-
debug_file 'show'
|
56
|
-
check_output_includes 'autoirb is off.'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'basename' do
|
61
|
-
it 'must show default value' do
|
62
|
-
enter 'show basename'
|
63
|
-
debug_file 'show'
|
64
|
-
check_output_includes 'basename is off.'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe 'callstyle' do
|
69
|
-
it 'must show default value' do
|
70
|
-
enter 'show callstyle'
|
71
|
-
debug_file 'show'
|
72
|
-
check_output_includes 'Frame call-display style is long.'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe 'forcestep' do
|
77
|
-
it 'must show default value' do
|
78
|
-
enter 'show forcestep'
|
79
|
-
debug_file 'show'
|
80
|
-
check_output_includes 'force-stepping is off.'
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe 'fullpath' do
|
85
|
-
it 'must show default value' do
|
86
|
-
enter 'show fullpath'
|
87
|
-
debug_file 'show'
|
88
|
-
check_output_includes 'Displaying frame\'s full file names is on.'
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe 'linetrace' do
|
93
|
-
it 'must show default value' do
|
94
|
-
enter 'show linetrace'
|
95
|
-
debug_file 'show'
|
96
|
-
check_output_includes 'line tracing is off.'
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe 'linetrace_plus' do
|
101
|
-
it 'must show default value' do
|
102
|
-
enter 'show linetrace_plus'
|
103
|
-
debug_file 'show'
|
104
|
-
check_output_includes 'line tracing style is different consecutive lines.'
|
105
|
-
end
|
106
|
-
end
|
107
21
|
|
108
|
-
|
109
|
-
|
110
|
-
enter 'show listsize'
|
111
|
-
debug_file 'show'
|
112
|
-
check_output_includes 'Number of source lines to list is 10.'
|
113
|
-
end
|
114
|
-
end
|
22
|
+
describe "showing enabled boolean setting #{setting}" do
|
23
|
+
temporary_change_hash Byebug::Setting, setting, true
|
115
24
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
123
|
-
|
124
|
-
describe 'version' do
|
125
|
-
it 'must show version' do
|
126
|
-
enter 'show version'
|
127
|
-
debug_file 'show'
|
128
|
-
check_output_includes "Byebug #{Byebug::VERSION}"
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
describe 'width' do
|
133
|
-
let(:cols) { `stty size`.scan(/\d+/)[1].to_i }
|
134
|
-
|
135
|
-
it 'must show default width' do
|
136
|
-
enter 'show width'
|
137
|
-
debug_file 'show'
|
138
|
-
check_output_includes "Width is #{cols}."
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
describe 'unknown command' do
|
143
|
-
it 'must show a message' do
|
144
|
-
enter 'show bla'
|
145
|
-
debug_file 'show'
|
146
|
-
check_output_includes 'Unknown show command bla'
|
25
|
+
it 'must show default value' do
|
26
|
+
enter "show #{setting}"
|
27
|
+
debug_proc(@example)
|
28
|
+
check_output_includes "#{setting} is on"
|
29
|
+
end
|
30
|
+
end
|
147
31
|
end
|
148
|
-
end
|
149
32
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
33
|
+
describe 'callstyle' do
|
34
|
+
it 'must show default value' do
|
35
|
+
enter 'show callstyle'
|
36
|
+
debug_proc(@example)
|
37
|
+
check_output_includes 'Frame display callstyle is :long'
|
38
|
+
end
|
155
39
|
end
|
156
|
-
end
|
157
40
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
check_output_includes "The command history file is \"#{@filename}\""
|
41
|
+
describe 'listsize' do
|
42
|
+
it 'must show listsize' do
|
43
|
+
enter 'show listsize'
|
44
|
+
debug_proc(@example)
|
45
|
+
check_output_includes 'Number of source lines to list is 10'
|
46
|
+
end
|
165
47
|
end
|
166
|
-
end
|
167
48
|
|
168
|
-
|
169
|
-
|
49
|
+
describe 'width' do
|
50
|
+
let(:cols) { `stty size`.scan(/\d+/)[1].to_i }
|
170
51
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
52
|
+
it 'must show default width' do
|
53
|
+
enter 'show width'
|
54
|
+
debug_proc(@example)
|
55
|
+
check_output_includes "Maximum width of byebug's output is #{cols}"
|
56
|
+
end
|
175
57
|
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe 'commands' do
|
179
|
-
temporary_change_const Readline, 'HISTORY', %w(aaa bbb ccc ddd)
|
180
58
|
|
181
|
-
describe '
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
debug_file 'show'
|
187
|
-
check_output_includes "Not currently saving history. " \
|
188
|
-
'Enable it with "set autosave"'
|
59
|
+
describe 'unknown command' do
|
60
|
+
it 'must show a message' do
|
61
|
+
enter 'show bla'
|
62
|
+
debug_proc(@example)
|
63
|
+
check_output_includes 'Unknown setting :bla'
|
189
64
|
end
|
190
65
|
end
|
191
66
|
|
192
|
-
describe '
|
193
|
-
|
67
|
+
describe 'histfile' do
|
68
|
+
before { @filename = Byebug::Setting[:histfile] }
|
194
69
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
check_output_includes(/2 bbb\n 3 ccc\n 4 ddd/)
|
200
|
-
check_output_doesnt_include(/1 aaa/)
|
201
|
-
end
|
70
|
+
it 'must show history filename' do
|
71
|
+
enter 'show histfile'
|
72
|
+
debug_proc(@example)
|
73
|
+
check_output_includes "The command history file is #{@filename}"
|
202
74
|
end
|
75
|
+
end
|
203
76
|
|
204
|
-
|
205
|
-
|
206
|
-
enter 'set histsize 7', 'show commands'
|
207
|
-
debug_file 'show'
|
208
|
-
check_output_includes(/1 aaa\n 2 bbb\n 3 ccc\n 4 ddd/)
|
209
|
-
end
|
210
|
-
end
|
77
|
+
describe 'histsize' do
|
78
|
+
before { @max_size = Byebug::Setting[:histsize] }
|
211
79
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
check_output_doesnt_include(/1 aaa\n 2 bbb/)
|
218
|
-
end
|
80
|
+
it "must show history's max size" do
|
81
|
+
enter 'show histsize'
|
82
|
+
debug_proc(@example)
|
83
|
+
check_output_includes \
|
84
|
+
"Maximum size of byebug's command history is #{@max_size}"
|
219
85
|
end
|
220
86
|
end
|
221
|
-
end
|
222
87
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
88
|
+
describe 'Help' do
|
89
|
+
it 'must show help when typing just "show"' do
|
90
|
+
enter 'show', 'cont'
|
91
|
+
debug_proc(@example)
|
92
|
+
check_output_includes(/Generic command for showing byebug settings./)
|
93
|
+
check_output_includes(/List of settings supported in byebug/)
|
94
|
+
end
|
228
95
|
end
|
229
96
|
end
|
230
97
|
end
|
data/test/source_test.rb
CHANGED
@@ -1,39 +1,49 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module SourceTest
|
2
|
+
class SourceTestCase < TestDsl::TestCase
|
3
|
+
let(:filename) { 'source_example.txt' }
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
before do
|
6
|
+
@example = -> do
|
7
|
+
byebug
|
8
|
+
a = 2
|
9
|
+
a = 3
|
10
|
+
end
|
8
11
|
|
9
|
-
|
12
|
+
File.open(filename, 'w') do |f|
|
13
|
+
f.puts 'break 2'
|
14
|
+
f.puts 'break 3 if true'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
after { FileUtils.rm(filename) }
|
10
19
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
it 'must run commands from file' do
|
21
|
+
enter "source #{filename}"
|
22
|
+
debug_proc(@example) do
|
23
|
+
Byebug.breakpoints[0].pos.must_equal 2
|
24
|
+
Byebug.breakpoints[1].pos.must_equal 3
|
25
|
+
Byebug.breakpoints[1].expr.must_equal 'true'
|
26
|
+
end
|
17
27
|
end
|
18
|
-
end
|
19
28
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
29
|
+
it 'must be able to use shortcut' do
|
30
|
+
enter "so #{filename}"
|
31
|
+
debug_proc(@example) { Byebug.breakpoints[0].pos.must_equal 2 }
|
32
|
+
end
|
24
33
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
34
|
+
it 'must show an error if file is not found' do
|
35
|
+
enter 'source blabla'
|
36
|
+
debug_proc(@example)
|
37
|
+
check_error_includes(/File ".*blabla" not found/)
|
38
|
+
end
|
30
39
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
40
|
+
describe 'Help' do
|
41
|
+
it 'must show help when used without arguments' do
|
42
|
+
enter 'source'
|
43
|
+
debug_proc(@example)
|
44
|
+
check_output_includes \
|
45
|
+
"source FILE\texecutes a file containing byebug commands"
|
46
|
+
end
|
37
47
|
end
|
38
48
|
end
|
39
49
|
end
|
data/test/stepping_test.rb
CHANGED
@@ -1,183 +1,210 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
num
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def self.b(num)
|
8
|
-
v2 = 5 if 1 == num ; [1, 2, v2].map { |t| t.to_f }
|
9
|
-
c(num)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.c(num)
|
13
|
-
num += 4
|
14
|
-
num
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class SteppingRaiseFromRubyMethodExample
|
19
|
-
def a
|
20
|
-
b
|
21
|
-
rescue
|
22
|
-
1
|
23
|
-
end
|
24
|
-
|
25
|
-
def b
|
26
|
-
c
|
27
|
-
end
|
28
|
-
|
29
|
-
def c
|
30
|
-
raise 'bang'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class SteppingRaiseFromCMethodExample
|
35
|
-
def a
|
36
|
-
b
|
37
|
-
rescue NameError
|
38
|
-
1
|
39
|
-
end
|
1
|
+
module SteppingTest
|
2
|
+
class Example
|
3
|
+
def self.a(num)
|
4
|
+
num += 2
|
5
|
+
b(num)
|
6
|
+
end
|
40
7
|
|
41
|
-
|
42
|
-
|
43
|
-
|
8
|
+
def self.b(num)
|
9
|
+
v2 = 5 if 1 == num ; [1, 2, v2].map { |t| t.to_f }
|
10
|
+
c(num)
|
11
|
+
end
|
44
12
|
|
45
|
-
|
46
|
-
|
13
|
+
def self.c(num)
|
14
|
+
num += 4
|
15
|
+
num
|
16
|
+
end
|
47
17
|
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class TestStepping < TestDsl::TestCase
|
51
18
|
|
52
|
-
|
19
|
+
class SteppingTestCase < TestDsl::TestCase
|
20
|
+
before do
|
21
|
+
@example = -> do
|
22
|
+
byebug
|
53
23
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
enter 'next'
|
59
|
-
debug_file('stepping') { state.line.must_equal 8 }
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'must go to the next line if forced by "plus" sign' do
|
63
|
-
enter 'next+'
|
64
|
-
debug_file('stepping') { state.line.must_equal 9 }
|
65
|
-
end
|
24
|
+
ex = Example.a(7)
|
25
|
+
2.times do
|
26
|
+
ex += 1
|
27
|
+
end
|
66
28
|
|
67
|
-
|
68
|
-
enter 'next-'
|
69
|
-
debug_file('stepping') { state.line.must_equal 8 }
|
29
|
+
Example.b(ex)
|
70
30
|
end
|
31
|
+
end
|
71
32
|
|
72
|
-
|
73
|
-
|
33
|
+
describe 'Next Command' do
|
34
|
+
describe 'method call behaviour' do
|
35
|
+
before { enter 'break 9', 'cont' }
|
74
36
|
|
75
|
-
it 'must
|
37
|
+
it 'must leave on the same line by default' do
|
76
38
|
enter 'next'
|
77
|
-
|
39
|
+
debug_proc(@example) { state.line.must_equal 9 }
|
78
40
|
end
|
79
41
|
|
80
|
-
it 'must go to the next line
|
81
|
-
enter '
|
82
|
-
|
42
|
+
it 'must go to the next line if forced by "plus" sign' do
|
43
|
+
enter 'next+'
|
44
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
83
45
|
end
|
84
46
|
|
85
|
-
it 'must
|
86
|
-
enter 'next
|
87
|
-
|
47
|
+
it 'must leave on the same line if forced by "minus" sign' do
|
48
|
+
enter 'next-'
|
49
|
+
debug_proc(@example) { state.line.must_equal 9 }
|
88
50
|
end
|
89
51
|
|
90
|
-
|
91
|
-
|
92
|
-
debug_file('stepping')
|
93
|
-
check_output_includes \
|
94
|
-
'Next went up a frame because previous frame finished'
|
95
|
-
end
|
52
|
+
describe 'when forcestep is set' do
|
53
|
+
temporary_change_hash Byebug::Setting, :forcestep, true
|
96
54
|
|
55
|
+
it 'must go to the next line' do
|
56
|
+
enter 'next'
|
57
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
58
|
+
end
|
97
59
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
end
|
103
|
-
end
|
60
|
+
it 'must go to the next line (by shortcut)' do
|
61
|
+
enter 'n'
|
62
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
63
|
+
end
|
104
64
|
|
105
|
-
|
106
|
-
|
65
|
+
it 'must go the specified number of lines forward by default' do
|
66
|
+
enter 'next 2'
|
67
|
+
debug_proc(@example) { state.line.must_equal 25 }
|
68
|
+
end
|
107
69
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
70
|
+
it 'must inform when not staying in the same frame' do
|
71
|
+
enter 'next 2'
|
72
|
+
debug_proc(@example)
|
73
|
+
check_output_includes \
|
74
|
+
'Next went up a frame because previous frame finished'
|
75
|
+
end
|
113
76
|
|
114
|
-
describe 'raise/rescue behaviour' do
|
115
|
-
describe 'from c method' do
|
116
|
-
before { enter "break #{__FILE__}:36", 'cont' }
|
117
77
|
|
118
|
-
|
119
|
-
|
120
|
-
|
78
|
+
it 'must ignore it if "minus" is specified' do
|
79
|
+
enter 'next-'
|
80
|
+
debug_proc(@example) { state.line.must_equal 9 }
|
81
|
+
end
|
121
82
|
end
|
122
83
|
end
|
123
84
|
|
124
|
-
describe '
|
125
|
-
before { enter
|
85
|
+
describe 'block behaviour' do
|
86
|
+
before { enter 'break 57', 'cont' }
|
126
87
|
|
127
|
-
it 'must step over
|
88
|
+
it 'must step over blocks' do
|
128
89
|
enter 'next'
|
129
|
-
|
90
|
+
debug_proc(@example) { state.line.must_equal 24 }
|
130
91
|
end
|
131
92
|
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe 'Step Command' do
|
136
|
-
|
137
|
-
describe 'method call behaviour' do
|
138
|
-
before { enter "break #{__FILE__}:8", 'cont' }
|
139
93
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
94
|
+
describe 'raise/rescue behaviour' do
|
95
|
+
describe 'from c method' do
|
96
|
+
before do
|
97
|
+
@example_raise = -> do
|
98
|
+
byebug
|
99
|
+
|
100
|
+
class RaiseFromCMethodExample
|
101
|
+
def a
|
102
|
+
b
|
103
|
+
rescue NameError
|
104
|
+
1
|
105
|
+
end
|
106
|
+
|
107
|
+
def b
|
108
|
+
c
|
109
|
+
end
|
110
|
+
|
111
|
+
def c
|
112
|
+
d
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
RaiseFromCMethodExample.new.a
|
117
|
+
end
|
118
|
+
enter 'break 102', 'cont'
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'must step over rescue' do
|
122
|
+
enter 'next'
|
123
|
+
debug_proc(@example_raise) { state.line.must_equal 104 }
|
124
|
+
end
|
125
|
+
end
|
144
126
|
|
145
|
-
|
146
|
-
|
147
|
-
|
127
|
+
describe 'from ruby method' do
|
128
|
+
before do
|
129
|
+
@example_raise = -> do
|
130
|
+
byebug
|
131
|
+
|
132
|
+
class RaiseFromRubyMethodExample
|
133
|
+
def a
|
134
|
+
b
|
135
|
+
rescue
|
136
|
+
1
|
137
|
+
end
|
138
|
+
|
139
|
+
def b
|
140
|
+
c
|
141
|
+
end
|
142
|
+
|
143
|
+
def c
|
144
|
+
raise 'bang'
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
RaiseFromRubyMethodExample.new.a
|
149
|
+
end
|
150
|
+
enter 'break 134', 'cont'
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'must step over rescue' do
|
154
|
+
enter 'next'
|
155
|
+
debug_proc(@example_raise) { state.line.must_equal 136 }
|
156
|
+
end
|
157
|
+
end
|
148
158
|
end
|
159
|
+
end
|
149
160
|
|
150
|
-
|
151
|
-
enter 'step-'
|
152
|
-
debug_file('stepping') { state.line.must_equal 8 }
|
153
|
-
end
|
161
|
+
describe 'Step Command' do
|
154
162
|
|
155
|
-
describe '
|
156
|
-
|
163
|
+
describe 'method call behaviour' do
|
164
|
+
before { enter 'break 9', 'cont' }
|
157
165
|
|
158
|
-
it 'must
|
166
|
+
it 'must leave on the same line if forced by a setting' do
|
159
167
|
enter 'step'
|
160
|
-
|
168
|
+
debug_proc(@example) { state.line.must_equal 9 }
|
161
169
|
end
|
162
170
|
|
163
|
-
it 'must go to the
|
164
|
-
enter '
|
165
|
-
|
171
|
+
it 'must go to the step line if forced to do that by "plus" sign' do
|
172
|
+
enter 'step+'
|
173
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
166
174
|
end
|
167
175
|
|
168
|
-
it 'must
|
169
|
-
enter 'step
|
170
|
-
|
176
|
+
it 'must leave on the same line if forced to do that by "minus" sign' do
|
177
|
+
enter 'step-'
|
178
|
+
debug_proc(@example) { state.line.must_equal 9 }
|
179
|
+
end
|
180
|
+
|
181
|
+
describe 'when forcestep is set' do
|
182
|
+
temporary_change_hash Byebug::Setting, :forcestep, true
|
183
|
+
|
184
|
+
it 'must go to the step line if forced by a setting' do
|
185
|
+
enter 'step'
|
186
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'must go to the next line if forced by a setting (by shortcut)' do
|
190
|
+
enter 's'
|
191
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'must go the specified number of lines forward by default' do
|
195
|
+
enter 'step 2'
|
196
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
197
|
+
end
|
171
198
|
end
|
172
199
|
end
|
173
|
-
end
|
174
200
|
|
175
|
-
|
176
|
-
|
201
|
+
describe 'block behaviour' do
|
202
|
+
before { enter 'break 25', 'cont' }
|
177
203
|
|
178
|
-
|
179
|
-
|
180
|
-
|
204
|
+
it 'must step into blocks' do
|
205
|
+
enter 'step'
|
206
|
+
debug_proc(@example) { state.line.must_equal 26 }
|
207
|
+
end
|
181
208
|
end
|
182
209
|
end
|
183
210
|
end
|