byebug 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +125 -99
- data/CONTRIBUTING.md +4 -6
- data/GUIDE.md +42 -20
- data/Gemfile +5 -3
- data/README.md +2 -3
- data/Rakefile +11 -7
- data/bin/byebug +2 -252
- data/byebug.gemspec +7 -4
- data/ext/byebug/byebug.c +17 -18
- data/ext/byebug/byebug.h +4 -5
- data/ext/byebug/context.c +37 -39
- data/ext/byebug/threads.c +39 -18
- data/lib/byebug.rb +2 -110
- data/lib/byebug/attacher.rb +23 -0
- data/lib/byebug/breakpoint.rb +60 -0
- data/lib/byebug/command.rb +62 -70
- data/lib/byebug/commands/break.rb +24 -24
- data/lib/byebug/commands/catchpoint.rb +18 -10
- data/lib/byebug/commands/condition.rb +18 -17
- data/lib/byebug/commands/continue.rb +17 -9
- data/lib/byebug/commands/delete.rb +19 -13
- data/lib/byebug/commands/display.rb +19 -53
- data/lib/byebug/commands/edit.rb +7 -4
- data/lib/byebug/commands/enable_disable.rb +130 -0
- data/lib/byebug/commands/eval.rb +40 -22
- data/lib/byebug/commands/finish.rb +13 -4
- data/lib/byebug/commands/frame.rb +65 -45
- data/lib/byebug/commands/help.rb +17 -18
- data/lib/byebug/commands/history.rb +14 -8
- data/lib/byebug/commands/info.rb +160 -182
- data/lib/byebug/commands/interrupt.rb +4 -1
- data/lib/byebug/commands/irb.rb +30 -0
- data/lib/byebug/commands/kill.rb +7 -8
- data/lib/byebug/commands/list.rb +71 -66
- data/lib/byebug/commands/method.rb +14 -6
- data/lib/byebug/commands/pry.rb +35 -0
- data/lib/byebug/commands/quit.rb +9 -6
- data/lib/byebug/commands/reload.rb +5 -2
- data/lib/byebug/commands/restart.rb +13 -9
- data/lib/byebug/commands/save.rb +17 -17
- data/lib/byebug/commands/set.rb +16 -15
- data/lib/byebug/commands/show.rb +10 -11
- data/lib/byebug/commands/source.rb +11 -5
- data/lib/byebug/commands/stepping.rb +38 -24
- data/lib/byebug/commands/threads.rb +45 -31
- data/lib/byebug/commands/trace.rb +22 -9
- data/lib/byebug/commands/undisplay.rb +45 -0
- data/lib/byebug/commands/variables.rb +83 -27
- data/lib/byebug/context.rb +25 -22
- data/lib/byebug/core.rb +82 -0
- data/lib/byebug/helper.rb +37 -28
- data/lib/byebug/history.rb +8 -4
- data/lib/byebug/interface.rb +12 -17
- data/lib/byebug/interfaces/local_interface.rb +11 -8
- data/lib/byebug/interfaces/remote_interface.rb +11 -8
- data/lib/byebug/interfaces/script_interface.rb +9 -6
- data/lib/byebug/options.rb +46 -0
- data/lib/byebug/processor.rb +7 -1
- data/lib/byebug/processors/command_processor.rb +135 -125
- data/lib/byebug/processors/control_command_processor.rb +23 -23
- data/lib/byebug/remote.rb +17 -26
- data/lib/byebug/runner.rb +100 -0
- data/lib/byebug/setting.rb +33 -8
- data/lib/byebug/settings/autoeval.rb +5 -15
- data/lib/byebug/settings/autoirb.rb +4 -1
- data/lib/byebug/settings/autolist.rb +5 -2
- data/lib/byebug/settings/autoreload.rb +5 -2
- data/lib/byebug/settings/autosave.rb +6 -2
- data/lib/byebug/settings/basename.rb +7 -2
- data/lib/byebug/settings/callstyle.rb +4 -1
- data/lib/byebug/settings/forcestep.rb +6 -3
- data/lib/byebug/settings/fullpath.rb +5 -2
- data/lib/byebug/settings/histfile.rb +5 -3
- data/lib/byebug/settings/histsize.rb +5 -3
- data/lib/byebug/settings/linetrace.rb +4 -1
- data/lib/byebug/settings/listsize.rb +5 -1
- data/lib/byebug/settings/post_mortem.rb +21 -13
- data/lib/byebug/settings/stack_on_error.rb +6 -2
- data/lib/byebug/settings/testing.rb +6 -1
- data/lib/byebug/settings/tracing_plus.rb +5 -1
- data/lib/byebug/settings/verbose.rb +13 -2
- data/lib/byebug/settings/width.rb +4 -1
- data/lib/byebug/version.rb +1 -1
- data/test/{break_test.rb → commands/break_test.rb} +41 -53
- data/test/{condition_test.rb → commands/condition_test.rb} +14 -14
- data/test/{continue_test.rb → commands/continue_test.rb} +0 -0
- data/test/{delete_test.rb → commands/delete_test.rb} +2 -2
- data/test/commands/display_test.rb +37 -0
- data/test/{edit_test.rb → commands/edit_test.rb} +0 -0
- data/test/{eval_test.rb → commands/eval_test.rb} +1 -0
- data/test/{finish_test.rb → commands/finish_test.rb} +11 -1
- data/test/{frame_test.rb → commands/frame_test.rb} +12 -16
- data/test/{help_test.rb → commands/help_test.rb} +21 -4
- data/test/{history_test.rb → commands/history_test.rb} +0 -0
- data/test/{info_test.rb → commands/info_test.rb} +5 -55
- data/test/{interrupt_test.rb → commands/interrupt_test.rb} +0 -0
- data/test/commands/irb_test.rb +28 -0
- data/test/{kill_test.rb → commands/kill_test.rb} +1 -1
- data/test/{list_test.rb → commands/list_test.rb} +1 -1
- data/test/{method_test.rb → commands/method_test.rb} +0 -0
- data/test/{post_mortem_test.rb → commands/post_mortem_test.rb} +6 -10
- data/test/{pry_test.rb → commands/pry_test.rb} +4 -13
- data/test/{quit_test.rb → commands/quit_test.rb} +4 -4
- data/test/{reload_test.rb → commands/reload_test.rb} +0 -0
- data/test/{restart_test.rb → commands/restart_test.rb} +6 -0
- data/test/{save_test.rb → commands/save_test.rb} +2 -2
- data/test/{set_test.rb → commands/set_test.rb} +9 -2
- data/test/{show_test.rb → commands/show_test.rb} +1 -1
- data/test/{source_test.rb → commands/source_test.rb} +3 -3
- data/test/{stepping_test.rb → commands/stepping_test.rb} +44 -35
- data/test/{thread_test.rb → commands/thread_test.rb} +0 -0
- data/test/{trace_test.rb → commands/trace_test.rb} +0 -0
- data/test/{display_test.rb → commands/undisplay_test.rb} +7 -45
- data/test/{variables_test.rb → commands/variables_test.rb} +10 -1
- data/test/debugger_alias_test.rb +2 -2
- data/test/runner_test.rb +127 -0
- data/test/support/matchers.rb +27 -25
- data/test/support/test_interface.rb +9 -5
- data/test/support/utils.rb +96 -101
- data/test/test_helper.rb +32 -20
- metadata +93 -68
- data/lib/byebug/commands/enable.rb +0 -154
- data/lib/byebug/commands/repl.rb +0 -126
- data/test/irb_test.rb +0 -47
- data/test/support/breakpoint.rb +0 -13
@@ -1,11 +1,14 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to force changing lines when executing step or next commands.
|
4
|
+
#
|
2
5
|
class ForcestepSetting < Setting
|
3
|
-
def
|
4
|
-
'
|
6
|
+
def banner
|
7
|
+
'Force next/step commands to always move to a new line'
|
5
8
|
end
|
6
9
|
|
7
10
|
def print
|
8
|
-
"forced-stepping is #{
|
11
|
+
"forced-stepping is #{getter}"
|
9
12
|
end
|
10
13
|
end
|
11
14
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to customize the file where byebug's history is saved.
|
4
|
+
#
|
2
5
|
class HistfileSetting < Setting
|
3
6
|
DEFAULT = File.expand_path("#{ENV['HOME'] || '.'}/.byebug_hist")
|
4
7
|
|
5
|
-
def
|
6
|
-
|
7
|
-
"~/.byebug_hist"
|
8
|
+
def banner
|
9
|
+
'File where cmd history is saved to. Default: ~/.byebug_hist'
|
8
10
|
end
|
9
11
|
|
10
12
|
def to_s
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to customize the number of byebug commands to be saved in history.
|
4
|
+
#
|
2
5
|
class HistsizeSetting < Setting
|
3
6
|
DEFAULT = 256
|
4
7
|
|
5
|
-
def
|
6
|
-
|
7
|
-
"history record. By default, #{DEFAULT}"
|
8
|
+
def banner
|
9
|
+
'Maximum number of commands that can be stored in byebug history'
|
8
10
|
end
|
9
11
|
|
10
12
|
def to_s
|
@@ -1,8 +1,12 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to customize the number of source code lines to be displayed every
|
4
|
+
# time the "list" command is invoked.
|
5
|
+
#
|
2
6
|
class ListsizeSetting < Setting
|
3
7
|
DEFAULT = 10
|
4
8
|
|
5
|
-
def
|
9
|
+
def banner
|
6
10
|
'Set number of source lines to list by default'
|
7
11
|
end
|
8
12
|
|
@@ -1,28 +1,36 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to enable/disable post_mortem mode, i.e., a debugger prompt after
|
4
|
+
# program termination by unhandled exception.
|
5
|
+
#
|
2
6
|
class PostMortemSetting < Setting
|
3
|
-
def
|
7
|
+
def initialize
|
8
|
+
Byebug.post_mortem = DEFAULT
|
9
|
+
end
|
10
|
+
|
11
|
+
def banner
|
4
12
|
'Enable/disable post-mortem mode'
|
5
13
|
end
|
6
14
|
|
7
15
|
def value=(v)
|
8
16
|
Byebug.post_mortem = v
|
9
|
-
at_exit { handle_post_mortem if Byebug.post_mortem? }
|
10
17
|
end
|
11
18
|
|
12
19
|
def value
|
13
20
|
Byebug.post_mortem?
|
14
21
|
end
|
22
|
+
end
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
Byebug.handler.at_line(context, file, line)
|
26
|
-
end
|
24
|
+
#
|
25
|
+
# Saves information about the unhandled exception and gives a byebug
|
26
|
+
# prompt back to the user before program termination.
|
27
|
+
#
|
28
|
+
def self.handle_post_mortem
|
29
|
+
context = Byebug.raised_exception.__bb_context
|
30
|
+
file = Byebug.raised_exception.__bb_file
|
31
|
+
line = Byebug.raised_exception.__bb_line
|
32
|
+
Byebug.handler.at_line(context, file, line)
|
27
33
|
end
|
34
|
+
|
35
|
+
at_exit { Byebug.handle_post_mortem if Byebug.post_mortem? }
|
28
36
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to enable/disable the display of backtraces when evaluations raise
|
4
|
+
# errors.
|
5
|
+
#
|
2
6
|
class StackOnErrorSetting < Setting
|
3
|
-
def
|
4
|
-
'Display stack trace when
|
7
|
+
def banner
|
8
|
+
'Display stack trace when `eval` raises an exception'
|
5
9
|
end
|
6
10
|
end
|
7
11
|
end
|
@@ -1,7 +1,18 @@
|
|
1
1
|
module Byebug
|
2
|
+
#
|
3
|
+
# Setting to show verbose output about TracePoint API events.
|
4
|
+
#
|
2
5
|
class VerboseSetting < Setting
|
3
|
-
def
|
4
|
-
|
6
|
+
def banner
|
7
|
+
'Enable verbose output of TracePoint API events'
|
8
|
+
end
|
9
|
+
|
10
|
+
def value=(v)
|
11
|
+
Byebug.verbose = v
|
12
|
+
end
|
13
|
+
|
14
|
+
def value
|
15
|
+
Byebug.verbose?
|
5
16
|
end
|
6
17
|
end
|
7
18
|
end
|
data/lib/byebug/version.rb
CHANGED
@@ -27,12 +27,12 @@ module Byebug
|
|
27
27
|
enter 'break 19'
|
28
28
|
|
29
29
|
debug_proc(@example) do
|
30
|
-
assert_equal 19,
|
31
|
-
assert_equal __FILE__,
|
32
|
-
assert_equal nil,
|
33
|
-
assert_equal 0,
|
34
|
-
assert_equal 0,
|
35
|
-
assert_equal true,
|
30
|
+
assert_equal 19, Breakpoint.first.pos
|
31
|
+
assert_equal __FILE__, Breakpoint.first.source
|
32
|
+
assert_equal nil, Breakpoint.first.expr
|
33
|
+
assert_equal 0, Breakpoint.first.hit_count
|
34
|
+
assert_equal 0, Breakpoint.first.hit_value
|
35
|
+
assert_equal true, Breakpoint.first.enabled?
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -144,26 +144,26 @@ module Byebug
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def test_disabling_breakpoints_with_short_syntax_sets_enabled_to_false
|
147
|
-
enter 'break 19', 'break 20', -> { "disable #{
|
147
|
+
enter 'break 19', 'break 20', -> { "disable #{Breakpoint.first.id}" }
|
148
148
|
|
149
|
-
debug_proc(@example) { assert_equal false,
|
149
|
+
debug_proc(@example) { assert_equal false, Breakpoint.first.enabled? }
|
150
150
|
end
|
151
151
|
|
152
152
|
def test_disabling_breakpoints_with_short_syntax_properly_ignores_them
|
153
|
-
enter '
|
153
|
+
enter 'b 19', 'b 20', -> { "disable #{Breakpoint.first.id}" } , 'cont'
|
154
154
|
|
155
155
|
debug_proc(@example) { assert_equal 20, state.line }
|
156
156
|
end
|
157
157
|
|
158
158
|
def test_disabling_breakpoints_with_full_syntax_sets_enabled_to_false
|
159
|
-
enter 'b 19', 'b 20', -> { "disable breakpoints #{
|
159
|
+
enter 'b 19', 'b 20', -> { "disable breakpoints #{Breakpoint.first.id}" }
|
160
160
|
|
161
|
-
debug_proc(@example) { assert_equal false,
|
161
|
+
debug_proc(@example) { assert_equal false, Breakpoint.first.enabled? }
|
162
162
|
end
|
163
163
|
|
164
164
|
def test_disabling_breakpoints_with_full_syntax_properly_ignores_them
|
165
|
-
enter '
|
166
|
-
'cont'
|
165
|
+
enter 'break 19', 'break 20',
|
166
|
+
-> { "disable breakpoints #{Breakpoint.first.id}" }, 'cont'
|
167
167
|
|
168
168
|
debug_proc(@example) { assert_equal 20, state.line }
|
169
169
|
end
|
@@ -172,8 +172,8 @@ module Byebug
|
|
172
172
|
enter 'break 19', 'break 20', 'disable breakpoints'
|
173
173
|
|
174
174
|
debug_proc(@example) do
|
175
|
-
assert_equal false,
|
176
|
-
assert_equal false,
|
175
|
+
assert_equal false, Breakpoint.first.enabled?
|
176
|
+
assert_equal false, Breakpoint.last.enabled?
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
@@ -188,8 +188,8 @@ module Byebug
|
|
188
188
|
enter 'disable'
|
189
189
|
|
190
190
|
debug_proc(@example)
|
191
|
-
check_error_includes \
|
192
|
-
|
191
|
+
check_error_includes '"disable" must be followed by "display", ' \
|
192
|
+
'"breakpoints" or breakpoint ids'
|
193
193
|
end
|
194
194
|
|
195
195
|
def test_disabling_breakpoints_shows_an_error_if_no_breakpoints_are_set
|
@@ -203,20 +203,20 @@ module Byebug
|
|
203
203
|
enter 'break 5', 'disable foo'
|
204
204
|
|
205
205
|
debug_proc(@example)
|
206
|
-
|
206
|
+
check_error_includes \
|
207
207
|
'"disable breakpoints" argument "foo" needs to be a number'
|
208
208
|
end
|
209
209
|
|
210
210
|
def test_enabling_breakpoints_with_short_syntax_sets_enabled_to_true
|
211
211
|
enter 'b 19', 'b 20', 'disable breakpoints',
|
212
|
-
-> { "enable #{
|
212
|
+
-> { "enable #{Breakpoint.first.id}" }
|
213
213
|
|
214
|
-
debug_proc(@example) { assert_equal true,
|
214
|
+
debug_proc(@example) { assert_equal true, Breakpoint.first.enabled? }
|
215
215
|
end
|
216
216
|
|
217
217
|
def test_enabling_breakpoints_with_short_syntax_stops_at_enabled_breakpoint
|
218
218
|
enter 'break 19', 'break 20', 'disable breakpoints',
|
219
|
-
-> { "enable #{
|
219
|
+
-> { "enable #{Breakpoint.first.id}" }, 'cont'
|
220
220
|
|
221
221
|
debug_proc(@example) { assert_equal 19, state.line }
|
222
222
|
end
|
@@ -225,8 +225,8 @@ module Byebug
|
|
225
225
|
enter 'break 19', 'break 20', 'disable breakpoints', 'enable breakpoints'
|
226
226
|
|
227
227
|
debug_proc(@example) do
|
228
|
-
assert_equal true,
|
229
|
-
assert_equal true,
|
228
|
+
assert_equal true, Breakpoint.first.enabled?
|
229
|
+
assert_equal true, Breakpoint.last.enabled?
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -245,14 +245,14 @@ module Byebug
|
|
245
245
|
|
246
246
|
def test_enabling_breakpoints_with_full_syntax_sets_enabled_to_false
|
247
247
|
enter 'break 19', 'break 20', 'disable breakpoints',
|
248
|
-
-> { "enable breakpoints #{
|
248
|
+
-> { "enable breakpoints #{Breakpoint.last.id}" }
|
249
249
|
|
250
|
-
debug_proc(@example) { assert_equal false,
|
250
|
+
debug_proc(@example) { assert_equal false, Breakpoint.first.enabled? }
|
251
251
|
end
|
252
252
|
|
253
253
|
def test_enabling_breakpoints_with_full_syntax_stops_at_enabled_breakpoint
|
254
254
|
enter 'break 19', 'break 20', 'disable breakpoints',
|
255
|
-
-> { "enable breakpoints #{
|
255
|
+
-> { "enable breakpoints #{Breakpoint.last.id}" }, 'cont'
|
256
256
|
|
257
257
|
debug_proc(@example) { assert_equal 20, state.line }
|
258
258
|
end
|
@@ -261,8 +261,8 @@ module Byebug
|
|
261
261
|
enter 'enable'
|
262
262
|
|
263
263
|
debug_proc(@example)
|
264
|
-
check_error_includes \
|
265
|
-
|
264
|
+
check_error_includes '"enable" must be followed by "display", ' \
|
265
|
+
'"breakpoints" or breakpoint ids'
|
266
266
|
end
|
267
267
|
|
268
268
|
def test_conditional_breakpoint_stops_if_condition_is_true
|
@@ -303,7 +303,7 @@ module Byebug
|
|
303
303
|
module FilenameTests
|
304
304
|
def test_setting_breakpoint_prints_confirmation_message
|
305
305
|
enter 'break 19'
|
306
|
-
debug_proc(@example) { @id =
|
306
|
+
debug_proc(@example) { @id = Breakpoint.first.id }
|
307
307
|
check_output_includes "Created breakpoint #{@id} at #{@filename}:19"
|
308
308
|
end
|
309
309
|
|
@@ -342,35 +342,23 @@ module Byebug
|
|
342
342
|
include FilenameTests
|
343
343
|
end
|
344
344
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
345
|
+
def test_setting_breakpoint_with_autoreload_uses_new_source
|
346
|
+
enter 'set autoreload', -> do
|
347
|
+
change_line_in_file(__FILE__, 19, '')
|
348
|
+
'break 19'
|
349
349
|
end
|
350
350
|
|
351
|
-
|
352
|
-
|
353
|
-
change_line_in_file(__FILE__, 19, '')
|
354
|
-
'break 19'
|
355
|
-
end
|
356
|
-
debug_proc(@example) { assert_empty Byebug.breakpoints }
|
357
|
-
change_line_in_file(__FILE__,19, ' BreakExample.new.b')
|
358
|
-
end
|
351
|
+
debug_proc(@example) { assert_empty Byebug.breakpoints }
|
352
|
+
change_line_in_file(__FILE__,19, ' BreakExample.new.b')
|
359
353
|
end
|
360
354
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
355
|
+
def test_setting_breakpoint_with_noautoreload_uses_old_source
|
356
|
+
enter 'set noautoreload', -> do
|
357
|
+
change_line_in_file(__FILE__, 19, '')
|
358
|
+
'break 19'
|
365
359
|
end
|
366
360
|
|
367
|
-
|
368
|
-
|
369
|
-
change_line_in_file(__FILE__, 19, '')
|
370
|
-
'break 19'
|
371
|
-
end
|
372
|
-
debug_proc(@example) { assert_equal 1, Byebug.breakpoints.size }
|
373
|
-
change_line_in_file(__FILE__,19, ' BreakExample.new.b')
|
374
|
-
end
|
361
|
+
debug_proc(@example) { assert_equal 1, Byebug.breakpoints.size }
|
362
|
+
change_line_in_file(__FILE__,19, ' BreakExample.new.b')
|
375
363
|
end
|
376
364
|
end
|
@@ -12,27 +12,27 @@ module Byebug
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_setting_condition_w_short_syntax_assigns_expression_to_breakpoint
|
15
|
-
enter 'break 7', -> { "cond #{
|
15
|
+
enter 'break 7', -> { "cond #{Breakpoint.first.id} b == 5" }
|
16
16
|
|
17
|
-
debug_proc(@example) { assert_equal 'b == 5',
|
17
|
+
debug_proc(@example) { assert_equal 'b == 5', Breakpoint.first.expr }
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_setting_condition_w_full_syntax_assigns_expression_to_breakpoint
|
21
|
-
enter 'break 7', -> { "condition #{
|
21
|
+
enter 'break 7', -> { "condition #{Breakpoint.first.id} b == 5" }
|
22
22
|
|
23
|
-
debug_proc(@example) { assert_equal 'b == 5',
|
23
|
+
debug_proc(@example) { assert_equal 'b == 5', Breakpoint.first.expr }
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_setting_condition_w_wrong_syntax_does_not_enable_breakpoint
|
27
|
-
enter 'break 7', -> { "disable #{
|
28
|
-
-> { "cond #{
|
27
|
+
enter 'break 7', -> { "disable #{Breakpoint.first.id}" },
|
28
|
+
-> { "cond #{Breakpoint.first.id} b ==" }
|
29
29
|
|
30
|
-
debug_proc(@example) { assert_equal false,
|
30
|
+
debug_proc(@example) { assert_equal false, Breakpoint.first.enabled? }
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_setting_condition_w_wrong_syntax_shows_error
|
34
|
-
enter 'break 7', -> { "disable #{
|
35
|
-
-> { "cond #{
|
34
|
+
enter 'break 7', -> { "disable #{Breakpoint.first.id}" },
|
35
|
+
-> { "cond #{Breakpoint.first.id} b ==" }
|
36
36
|
|
37
37
|
debug_proc(@example)
|
38
38
|
check_error_includes \
|
@@ -40,28 +40,28 @@ module Byebug
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_execution_stops_when_condition_is_true
|
43
|
-
enter 'break 7', -> { "cond #{
|
43
|
+
enter 'break 7', -> { "cond #{Breakpoint.first.id} b == 5" }, 'cont'
|
44
44
|
|
45
45
|
debug_proc(@example) { assert_equal 7, state.line }
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_execution_does_not_stop_when_condition_is_false
|
49
|
-
enter 'b 7', 'b 8', -> { "cond #{
|
49
|
+
enter 'b 7', 'b 8', -> { "cond #{Breakpoint.first.id} b == 3" }, 'cont'
|
50
50
|
|
51
51
|
debug_proc(@example) { assert_equal 8, state.line }
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_conditions_with_wrong_syntax_are_ignored
|
55
|
-
enter '
|
55
|
+
enter 'b 7', 'b 8', -> { "cond #{Breakpoint.first.id} b ==" }, 'cont'
|
56
56
|
|
57
57
|
debug_proc(@example) { assert_equal 7, state.line }
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_empty_condition_means_removing_any_conditions
|
61
|
-
enter 'b 7 if b == 3', 'b 8', -> { "cond #{
|
61
|
+
enter 'b 7 if b == 3', 'b 8', -> { "cond #{Breakpoint.first.id}" }, 'c'
|
62
62
|
|
63
63
|
debug_proc(@example) do
|
64
|
-
assert_nil
|
64
|
+
assert_nil Breakpoint.first.expr
|
65
65
|
assert_equal 7, state.line
|
66
66
|
end
|
67
67
|
end
|