byebug 3.2.0 → 3.3.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/.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
File without changes
|
@@ -12,13 +12,13 @@ module Byebug
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_deleting_a_breakpoint_removes_it_from_breakpoints_list
|
15
|
-
enter 'break 7', -> { "delete #{
|
15
|
+
enter 'break 7', -> { "delete #{Breakpoint.first.id}" }
|
16
16
|
|
17
17
|
debug_proc(@example) { assert_empty Byebug.breakpoints }
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_does_not_stop_at_the_deleted_breakpoint
|
21
|
-
enter '
|
21
|
+
enter 'b 7', 'b 8', -> { "delete #{Breakpoint.first.id}" }, 'cont'
|
22
22
|
|
23
23
|
debug_proc(@example) { assert_equal 8, state.line }
|
24
24
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Byebug
|
2
|
+
class DisplayTestCase < TestCase
|
3
|
+
def setup
|
4
|
+
@example = -> do
|
5
|
+
d = 0
|
6
|
+
byebug
|
7
|
+
d = d + 3
|
8
|
+
d = d + 6
|
9
|
+
end
|
10
|
+
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_shows_expressions
|
15
|
+
enter 'display d + 1'
|
16
|
+
debug_proc(@example)
|
17
|
+
check_output_includes '1: d + 1 = 1'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_works_when_using_a_shortcut
|
21
|
+
enter 'disp d + 1'
|
22
|
+
debug_proc(@example)
|
23
|
+
check_output_includes '1: d + 1 = 1'
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_saves_displayed_expressions
|
27
|
+
enter 'display d + 1'
|
28
|
+
debug_proc(@example) { assert_equal [[true, 'd + 1']], state.display }
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_displays_all_expressions_available
|
32
|
+
enter 'display d', 'display d + 1', 'display'
|
33
|
+
debug_proc(@example)
|
34
|
+
check_output_includes '1: d = 0', '2: d + 1 = 1'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
File without changes
|
@@ -45,6 +45,11 @@ module Byebug
|
|
45
45
|
debug_proc(@example) { assert_equal 14, state.line }
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_finish_works_for_frame_numbers_higher_than_one
|
49
|
+
enter 'finish 2'
|
50
|
+
debug_proc(@example) { assert_equal 9, state.line }
|
51
|
+
end
|
52
|
+
|
48
53
|
def test_finish_behaves_consistenly_even_if_current_frame_has_been_changed
|
49
54
|
enter 'up', 'finish'
|
50
55
|
debug_proc(@example) { assert_equal 9, state.line }
|
@@ -53,12 +58,17 @@ module Byebug
|
|
53
58
|
def test_finish_shows_an_error_if_incorrect_frame_number_specified
|
54
59
|
enter 'finish foo'
|
55
60
|
debug_proc(@example)
|
56
|
-
|
61
|
+
check_error_includes '"finish" argument "foo" needs to be a number'
|
57
62
|
end
|
58
63
|
|
59
64
|
def test_finish_stays_at_the_same_line_if_incorrect_frame_number_specified
|
60
65
|
enter 'finish foo'
|
61
66
|
debug_proc(@example) { assert_equal 18, state.line }
|
62
67
|
end
|
68
|
+
|
69
|
+
def test_finish_does_not_stop_in_byebug_internal_frames
|
70
|
+
enter 'finish 4'
|
71
|
+
debug_proc(@example) { refute_match(/byebug.test.support/, state.file) }
|
72
|
+
end
|
63
73
|
end
|
64
74
|
end
|
@@ -72,23 +72,19 @@ module Byebug
|
|
72
72
|
|
73
73
|
def test_frame_minus_one_sets_frame_to_the_last_one
|
74
74
|
enter 'break 22', 'cont', 'frame -1'
|
75
|
-
debug_proc(@example)
|
76
|
-
assert_equal 'test_helper.rb', File.basename(state.file)
|
77
|
-
end
|
75
|
+
debug_proc(@example) { assert_match 'frame_test.rb', state.file }
|
78
76
|
end
|
79
77
|
|
80
78
|
def test_down_does_not_move_if_frame_number_to_too_low
|
81
79
|
enter 'break 22', 'cont', 'down'
|
82
80
|
debug_proc(@example) { assert_equal 22, state.line }
|
83
|
-
|
84
|
-
"Can't navigate beyond the newest frame", interface.error_queue
|
81
|
+
check_error_includes "Can't navigate beyond the newest frame"
|
85
82
|
end
|
86
83
|
|
87
84
|
def test_up_does_not_move_if_frame_number_to_too_high
|
88
85
|
enter 'break 22', 'cont', 'up 100'
|
89
86
|
debug_proc(@example) { assert_equal 22, state.line }
|
90
|
-
|
91
|
-
"Can't navigate beyond the oldest frame", interface.error_queue
|
87
|
+
check_error_includes "Can't navigate beyond the oldest frame"
|
92
88
|
end
|
93
89
|
|
94
90
|
def test_where_displays_current_backtrace_with_fullpaths
|
@@ -157,7 +153,7 @@ module Byebug
|
|
157
153
|
def test_frame_cannot_navigate_to_c_frames
|
158
154
|
enter 'break 4', 'cont', 'frame 1'
|
159
155
|
debug_proc(@example)
|
160
|
-
|
156
|
+
check_error_includes "Can't navigate to c-frame"
|
161
157
|
end
|
162
158
|
end
|
163
159
|
|
@@ -190,32 +186,32 @@ module Byebug
|
|
190
186
|
end
|
191
187
|
|
192
188
|
super
|
193
|
-
enter 'break
|
189
|
+
enter 'break 178', 'cont'
|
194
190
|
end
|
195
191
|
|
196
192
|
def test_where_correctly_prints_the_backtrace
|
197
193
|
enter 'where'
|
198
194
|
debug_proc(@deep_example)
|
199
195
|
check_output_includes(
|
200
|
-
/--> #0 Byebug::DeepFrameExample\.d\(e#String\)\s+at #{__FILE__}:
|
201
|
-
/#1 Byebug::DeepFrameExample\.c\s+at #{__FILE__}:
|
202
|
-
/#2 Byebug::DeepFrameExample\.b\s+at #{__FILE__}:
|
203
|
-
/#3 Byebug::DeepFrameExample\.a\s+at #{__FILE__}:
|
196
|
+
/--> #0 Byebug::DeepFrameExample\.d\(e#String\)\s+at #{__FILE__}:178/,
|
197
|
+
/#1 Byebug::DeepFrameExample\.c\s+at #{__FILE__}:174/,
|
198
|
+
/#2 Byebug::DeepFrameExample\.b\s+at #{__FILE__}:168/,
|
199
|
+
/#3 Byebug::DeepFrameExample\.a\s+at #{__FILE__}:163/)
|
204
200
|
end
|
205
201
|
|
206
202
|
def test_up_moves_up_in_the_callstack
|
207
203
|
enter 'up'
|
208
|
-
debug_proc(@deep_example) { assert_equal
|
204
|
+
debug_proc(@deep_example) { assert_equal 174, state.line }
|
209
205
|
end
|
210
206
|
|
211
207
|
def test_down_moves_down_in_the_callstack
|
212
208
|
enter 'up', 'down'
|
213
|
-
debug_proc(@deep_example) { assert_equal
|
209
|
+
debug_proc(@deep_example) { assert_equal 178, state.line }
|
214
210
|
end
|
215
211
|
|
216
212
|
def test_frame_moves_to_a_specific_frame
|
217
213
|
enter 'frame 2'
|
218
|
-
debug_proc(@deep_example) { assert_equal
|
214
|
+
debug_proc(@deep_example) { assert_equal 168, state.line }
|
219
215
|
end
|
220
216
|
|
221
217
|
def test_eval_works_properly_when_moving_through_the_stack
|
@@ -11,8 +11,7 @@ module Byebug
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def available_cmds
|
14
|
-
@available_cmds ||=
|
15
|
-
Command.commands.map(&:names).flatten.uniq.sort
|
14
|
+
@available_cmds ||= Command.commands.map(&:names).flatten.uniq.sort
|
16
15
|
end
|
17
16
|
|
18
17
|
%w(help h).each do |cmd_alias|
|
@@ -37,13 +36,31 @@ module Byebug
|
|
37
36
|
def test_help_with_undefined_command_shows_an_error
|
38
37
|
enter 'help foobar'
|
39
38
|
debug_proc(@example)
|
40
|
-
check_error_includes 'Undefined command: "foobar". Try "help"
|
39
|
+
check_error_includes 'Undefined command: "foobar". Try "help"'
|
41
40
|
end
|
42
41
|
|
43
42
|
def test_help_with_command_and_subcommand_shows_subcommands_help
|
44
43
|
enter 'help info breakpoints'
|
45
44
|
debug_proc(@example)
|
46
|
-
check_output_includes
|
45
|
+
check_output_includes(/Status of user-settable breakpoints/)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_help_set_shows_help_for_set_command
|
49
|
+
enter 'help set'
|
50
|
+
debug_proc(@example)
|
51
|
+
check_output_includes(/Modifies parts of byebug environment/)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_help_set_plus_a_setting_shows_help_for_that_setting
|
55
|
+
enter 'help set width'
|
56
|
+
debug_proc(@example)
|
57
|
+
check_output_includes(/Number of characters per line in byebug's output/)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_help_show_shows_help_for_show_command
|
61
|
+
enter 'help show'
|
62
|
+
debug_proc(@example)
|
63
|
+
check_output_includes(/Generic command for showing byebug settings/)
|
47
64
|
end
|
48
65
|
end
|
49
66
|
end
|
File without changes
|
@@ -58,8 +58,7 @@ module Byebug
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_info_about_specific_breakpoints
|
61
|
-
enter '
|
62
|
-
-> { "info breakpoints #{first_brkpt.id}" }
|
61
|
+
enter 'b 38', 'b 39', -> { "info breakpoints #{Breakpoint.first.id}" }
|
63
62
|
debug_proc(@example)
|
64
63
|
check_output_includes 'Num Enb What', /\d+ +y at #{__FILE__}:38/
|
65
64
|
check_output_doesnt_include(/\d+ +y at #{__FILE__}:39/)
|
@@ -74,7 +73,7 @@ module Byebug
|
|
74
73
|
def test_info_breakpoints_shows_error_if_specific_breakpoint_do_not_exist
|
75
74
|
enter 'break 38', 'info breakpoints 100'
|
76
75
|
debug_proc(@example)
|
77
|
-
check_error_includes 'No breakpoints found among list given
|
76
|
+
check_error_includes 'No breakpoints found among list given'
|
78
77
|
end
|
79
78
|
|
80
79
|
def test_info_breakpoints_shows_hit_counts
|
@@ -87,7 +86,7 @@ module Byebug
|
|
87
86
|
def test_info_display_shows_all_display_expressions
|
88
87
|
enter 'display 3 + 3', 'display a + b', 'info display'
|
89
88
|
debug_proc(@example)
|
90
|
-
check_output_includes "Auto-display expressions now in effect
|
89
|
+
check_output_includes "Auto-display expressions now in effect:",
|
91
90
|
'Num Enb Expression',
|
92
91
|
'1: y 3 + 3',
|
93
92
|
'2: y a + b'
|
@@ -131,7 +130,7 @@ module Byebug
|
|
131
130
|
def breakpoint_line_numbers
|
132
131
|
@breakpoint_line_numbers ||=
|
133
132
|
columnize(LineCache.trace_line_numbers(__FILE__).to_a.sort,
|
134
|
-
Setting[:width])
|
133
|
+
Byebug::Setting[:width])
|
135
134
|
end
|
136
135
|
|
137
136
|
def test_info_file_basic_shows_basic_info_about_a_specific_file
|
@@ -186,30 +185,12 @@ module Byebug
|
|
186
185
|
check_error_includes 'Invalid parameter blabla'
|
187
186
|
end
|
188
187
|
|
189
|
-
def test_info_instance_variables_shows_instance_variables
|
190
|
-
enter 'break 11', 'cont', 'info instance_variables'
|
191
|
-
debug_proc(@example)
|
192
|
-
check_output_includes '@bla = "blabla"', '@foo = "bar"'
|
193
|
-
end
|
194
|
-
|
195
188
|
def test_info_line_shows_info_about_the_current_line
|
196
189
|
enter 'break 11', 'cont', 'info line'
|
197
190
|
debug_proc(@example)
|
198
191
|
check_output_includes "Line 11 of \"#{__FILE__}\""
|
199
192
|
end
|
200
193
|
|
201
|
-
def test_info_locals_shows_info_about_the_current_local_variables
|
202
|
-
enter 'break 11', 'cont', 'set width 28', 'info locals'
|
203
|
-
debug_proc(@example)
|
204
|
-
check_output_includes 'w = "11111111111111111111...', 'x = 2'
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_info_locals_fail_if_local_variable_does_not_have_to_s_or_inspect
|
208
|
-
enter 'break 16', 'cont', 'info locals'
|
209
|
-
debug_proc(@example)
|
210
|
-
check_output_includes 'a = *Error in evaluation*'
|
211
|
-
end
|
212
|
-
|
213
194
|
def test_info_program_shows_the_initial_stop_reason
|
214
195
|
enter 'info program'
|
215
196
|
debug_proc(@example)
|
@@ -241,44 +222,13 @@ module Byebug
|
|
241
222
|
enter 'break 39', 'cont',
|
242
223
|
->{ context.stubs(:stop_reason).returns('blabla'); 'info program' }
|
243
224
|
debug_proc(@example)
|
244
|
-
check_output_includes 'Program stopped.', '
|
225
|
+
check_output_includes 'Program stopped.', 'Unknown reason: blabla'
|
245
226
|
end
|
246
227
|
|
247
228
|
def test_shows_an_error_if_the_program_is_crashed
|
248
229
|
skip('TODO')
|
249
230
|
end
|
250
231
|
|
251
|
-
def test_info_global_variables_shows_global_variables
|
252
|
-
enter 'info global_variables'
|
253
|
-
debug_proc(@example)
|
254
|
-
check_output_includes "$$ = #{Process.pid}"
|
255
|
-
end
|
256
|
-
|
257
|
-
def test_info_variables_shows_all_variables
|
258
|
-
enter 'break 11', 'cont', 'set width 45', 'info variables'
|
259
|
-
debug_proc(@example)
|
260
|
-
check_output_includes(/self = #<Byebug::InfoExample:\S*.../,
|
261
|
-
'w = "1111111111111111111111111111111111111...',
|
262
|
-
'x = 2',
|
263
|
-
'@bla = "blabla"',
|
264
|
-
'@foo = "bar"')
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_info_variables_fails_if_variables_has_no_to_s_or_inspect_methods
|
268
|
-
enter 'break 16', 'cont', 'info variables'
|
269
|
-
debug_proc(@example)
|
270
|
-
check_output_includes 'a = *Error in evaluation*',
|
271
|
-
/self = #<Byebug::InfoExample:\S*.../,
|
272
|
-
'@bla = "blabla"',
|
273
|
-
'@foo = "bar"'
|
274
|
-
end
|
275
|
-
|
276
|
-
def test_info_variables_correctly_print_variables_containing_percentage
|
277
|
-
enter 'break 22', 'cont', 'info variables'
|
278
|
-
debug_proc(@example)
|
279
|
-
check_output_includes 'e = "%.2f"'
|
280
|
-
end
|
281
|
-
|
282
232
|
def test_shows_help_when_typing_just_info
|
283
233
|
enter 'info', 'cont'
|
284
234
|
debug_proc(@example)
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Byebug
|
2
|
+
class IrbTestCase < TestCase
|
3
|
+
def setup
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
6
|
+
a = 2
|
7
|
+
a = 3
|
8
|
+
a = 4
|
9
|
+
end
|
10
|
+
|
11
|
+
super
|
12
|
+
|
13
|
+
interface.stubs(:kind_of?).with(LocalInterface).returns(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_irb_command_starts_an_irb_session
|
17
|
+
IrbCommand.any_instance.expects(:execute)
|
18
|
+
enter 'irb'
|
19
|
+
debug_proc(@example)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_autoirb_calls_irb_automatically_after_every_stop
|
23
|
+
IrbCommand.any_instance.expects(:execute)
|
24
|
+
enter 'set autoirb', 'break 8', 'cont'
|
25
|
+
debug_proc(@example)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -32,7 +32,7 @@ module Byebug
|
|
32
32
|
Process.expects(:kill).with('KILL', Process.pid)
|
33
33
|
enter 'kill', 'y'
|
34
34
|
debug_proc(@example)
|
35
|
-
|
35
|
+
check_confirm_includes 'Really kill? (y/n)'
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_kill_does_not_send_an_unknown_signal
|
@@ -32,7 +32,7 @@ module Byebug
|
|
32
32
|
def lines_between(min, max, mark_current = true)
|
33
33
|
lines = [*File.open(__FILE__)][min-1..max-1]
|
34
34
|
numbers = (min..max).to_a
|
35
|
-
output = numbers.zip(lines).map { |l|
|
35
|
+
output = numbers.zip(lines).map { |l| format("%2d: %s", l[0], l[1]) }
|
36
36
|
if mark_current
|
37
37
|
middle = (output.size/2.0).ceil
|
38
38
|
output[middle] = "=> #{output[middle]}"
|
File without changes
|
@@ -19,19 +19,15 @@ module Byebug
|
|
19
19
|
super
|
20
20
|
end
|
21
21
|
|
22
|
-
def teardown
|
23
|
-
Byebug.post_mortem = false
|
24
|
-
end
|
25
|
-
|
26
22
|
def test_rises_before_exit_in_post_mortem_mode
|
27
|
-
enter 'set post_mortem', 'cont'
|
23
|
+
enter 'set post_mortem', 'cont', 'set nopost_mortem'
|
28
24
|
assert_raises(RuntimeError) do
|
29
25
|
debug_proc(@example)
|
30
26
|
end
|
31
27
|
end
|
32
28
|
|
33
29
|
def test_post_mortem_mode_sets_post_mortem_flag_to_true
|
34
|
-
enter 'set post_mortem', 'cont'
|
30
|
+
enter 'set post_mortem', 'cont', 'set nopost_mortem'
|
35
31
|
begin
|
36
32
|
debug_proc(@example)
|
37
33
|
rescue
|
@@ -40,7 +36,7 @@ module Byebug
|
|
40
36
|
end
|
41
37
|
|
42
38
|
def test_execution_is_stop_at_the_correct_line_after_exception
|
43
|
-
enter 'set post_mortem', 'cont'
|
39
|
+
enter 'set post_mortem', 'cont', 'set nopost_mortem'
|
44
40
|
begin
|
45
41
|
debug_proc(@example)
|
46
42
|
rescue
|
@@ -50,8 +46,8 @@ module Byebug
|
|
50
46
|
|
51
47
|
%w(step next finish break condition display reload).each do |cmd|
|
52
48
|
define_method "test_#{cmd}_is_forbidden_in_post_mortem_mode" do
|
53
|
-
enter 'set noautoeval', cmd
|
54
|
-
|
49
|
+
enter 'set noautoeval', 'set post_mortem', "#{cmd}", 'set no_postmortem'
|
50
|
+
Context.any_instance.stubs(:dead?).returns(:true)
|
55
51
|
begin
|
56
52
|
debug_proc(@example)
|
57
53
|
rescue RuntimeError
|
@@ -64,7 +60,7 @@ module Byebug
|
|
64
60
|
'var class', 'list', 'method', 'kill', 'eval', 'set', 'save', 'show',
|
65
61
|
'trace', 'thread list'].each do |cmd|
|
66
62
|
define_method "test_#{cmd}_is_permitted_in_post_mortem_mode" do
|
67
|
-
enter "#{cmd}"
|
63
|
+
enter 'set post_mortem', "#{cmd}", 'set no_postmortem'
|
68
64
|
class_name = cmd.gsub(/(^| )\w/) { |b| b[-1,1].upcase } + 'Command'
|
69
65
|
|
70
66
|
Byebug.const_get(class_name).any_instance.stubs(:execute)
|
@@ -13,26 +13,17 @@ module Byebug
|
|
13
13
|
a = 2
|
14
14
|
a = 3
|
15
15
|
a = 4
|
16
|
-
a = 5
|
17
|
-
a = 6
|
18
16
|
end
|
19
17
|
|
20
18
|
super
|
21
19
|
|
22
20
|
interface.stubs(:kind_of?).with(LocalInterface).returns(true)
|
23
|
-
PryCommand.any_instance.expects(:pry)
|
24
21
|
end
|
25
22
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def test_pry_supports_step_command
|
31
|
-
skip 'TODO'
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_pry_supports_cont_command
|
35
|
-
skip 'TODO'
|
23
|
+
def test_pry_command_starts_a_pry_session
|
24
|
+
PryCommand.any_instance.expects(:execute)
|
25
|
+
enter 'pry'
|
26
|
+
debug_proc(@example)
|
36
27
|
end
|
37
28
|
|
38
29
|
def test_autopry_calls_pry_automatically_after_every_stop
|