byebug 3.5.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.rubocop.yml +18 -1
- data/.travis.yml +21 -1
- data/CHANGELOG.md +356 -308
- data/CONTRIBUTING.md +31 -15
- data/GUIDE.md +859 -475
- data/Gemfile +8 -10
- data/LICENSE +1 -1
- data/README.md +41 -45
- data/Rakefile +30 -28
- data/byebug.gemspec +18 -18
- data/ext/byebug/breakpoint.c +88 -75
- data/ext/byebug/byebug.c +253 -252
- data/ext/byebug/byebug.h +53 -53
- data/ext/byebug/context.c +188 -159
- data/ext/byebug/extconf.rb +9 -6
- data/ext/byebug/locker.c +53 -11
- data/ext/byebug/threads.c +137 -39
- data/lib/byebug/attacher.rb +7 -2
- data/lib/byebug/breakpoint.rb +30 -0
- data/lib/byebug/command.rb +36 -32
- data/lib/byebug/commands/break.rb +49 -48
- data/lib/byebug/commands/catch.rb +64 -0
- data/lib/byebug/commands/condition.rb +13 -9
- data/lib/byebug/commands/continue.rb +8 -4
- data/lib/byebug/commands/delete.rb +10 -4
- data/lib/byebug/commands/display.rb +33 -25
- data/lib/byebug/commands/edit.rb +18 -13
- data/lib/byebug/commands/enable_disable.rb +26 -24
- data/lib/byebug/commands/eval.rb +77 -35
- data/lib/byebug/commands/finish.rb +9 -5
- data/lib/byebug/commands/frame.rb +66 -125
- data/lib/byebug/commands/help.rb +14 -21
- data/lib/byebug/commands/history.rb +5 -1
- data/lib/byebug/commands/info.rb +41 -106
- data/lib/byebug/commands/interrupt.rb +6 -2
- data/lib/byebug/commands/irb.rb +5 -2
- data/lib/byebug/commands/kill.rb +6 -2
- data/lib/byebug/commands/list.rb +21 -14
- data/lib/byebug/commands/method.rb +17 -9
- data/lib/byebug/commands/pry.rb +13 -3
- data/lib/byebug/commands/quit.rb +10 -5
- data/lib/byebug/commands/restart.rb +12 -19
- data/lib/byebug/commands/save.rb +10 -6
- data/lib/byebug/commands/set.rb +15 -14
- data/lib/byebug/commands/show.rb +8 -8
- data/lib/byebug/commands/source.rb +14 -8
- data/lib/byebug/commands/stepping.rb +15 -29
- data/lib/byebug/commands/threads.rb +73 -49
- data/lib/byebug/commands/tracevar.rb +56 -0
- data/lib/byebug/commands/undisplay.rb +8 -4
- data/lib/byebug/commands/untracevar.rb +38 -0
- data/lib/byebug/commands/var.rb +107 -0
- data/lib/byebug/context.rb +78 -42
- data/lib/byebug/core.rb +78 -40
- data/lib/byebug/helper.rb +58 -42
- data/lib/byebug/history.rb +12 -1
- data/lib/byebug/interface.rb +91 -11
- data/lib/byebug/interfaces/local_interface.rb +12 -19
- data/lib/byebug/interfaces/remote_interface.rb +12 -15
- data/lib/byebug/interfaces/script_interface.rb +14 -18
- data/lib/byebug/interfaces/test_interface.rb +54 -0
- data/lib/byebug/printers/base.rb +64 -0
- data/lib/byebug/printers/plain.rb +53 -0
- data/lib/byebug/processor.rb +20 -1
- data/lib/byebug/processors/command_processor.rb +57 -172
- data/lib/byebug/processors/control_command_processor.rb +16 -43
- data/lib/byebug/remote.rb +13 -7
- data/lib/byebug/runner.rb +102 -54
- data/lib/byebug/setting.rb +45 -68
- data/lib/byebug/settings/autoeval.rb +2 -0
- data/lib/byebug/settings/autoirb.rb +3 -0
- data/lib/byebug/settings/autolist.rb +3 -0
- data/lib/byebug/settings/autosave.rb +2 -0
- data/lib/byebug/settings/basename.rb +2 -0
- data/lib/byebug/settings/callstyle.rb +2 -0
- data/lib/byebug/settings/fullpath.rb +2 -0
- data/lib/byebug/settings/histfile.rb +2 -0
- data/lib/byebug/settings/histsize.rb +2 -0
- data/lib/byebug/settings/linetrace.rb +2 -0
- data/lib/byebug/settings/listsize.rb +2 -0
- data/lib/byebug/settings/post_mortem.rb +7 -2
- data/lib/byebug/settings/stack_on_error.rb +2 -0
- data/lib/byebug/settings/verbose.rb +2 -0
- data/lib/byebug/settings/width.rb +2 -0
- data/lib/byebug/state.rb +12 -0
- data/lib/byebug/states/control_state.rb +26 -0
- data/lib/byebug/states/regular_state.rb +178 -0
- data/lib/byebug/version.rb +1 -1
- metadata +24 -109
- data/lib/byebug/commands/catchpoint.rb +0 -53
- data/lib/byebug/commands/reload.rb +0 -29
- data/lib/byebug/commands/trace.rb +0 -50
- data/lib/byebug/commands/variables.rb +0 -206
- data/lib/byebug/options.rb +0 -46
- data/lib/byebug/settings/autoreload.rb +0 -12
- data/lib/byebug/settings/forcestep.rb +0 -14
- data/lib/byebug/settings/testing.rb +0 -12
- data/lib/byebug/settings/tracing_plus.rb +0 -11
- data/test/commands/break_test.rb +0 -364
- data/test/commands/condition_test.rb +0 -85
- data/test/commands/continue_test.rb +0 -47
- data/test/commands/delete_test.rb +0 -26
- data/test/commands/display_test.rb +0 -37
- data/test/commands/edit_test.rb +0 -52
- data/test/commands/eval_test.rb +0 -89
- data/test/commands/finish_test.rb +0 -74
- data/test/commands/frame_test.rb +0 -223
- data/test/commands/help_test.rb +0 -66
- data/test/commands/history_test.rb +0 -61
- data/test/commands/info_test.rb +0 -238
- data/test/commands/interrupt_test.rb +0 -45
- data/test/commands/irb_test.rb +0 -28
- data/test/commands/kill_test.rb +0 -50
- data/test/commands/list_test.rb +0 -174
- data/test/commands/method_test.rb +0 -52
- data/test/commands/post_mortem_test.rb +0 -71
- data/test/commands/pry_test.rb +0 -26
- data/test/commands/quit_test.rb +0 -53
- data/test/commands/reload_test.rb +0 -39
- data/test/commands/restart_test.rb +0 -46
- data/test/commands/save_test.rb +0 -67
- data/test/commands/set_test.rb +0 -140
- data/test/commands/show_test.rb +0 -76
- data/test/commands/source_test.rb +0 -46
- data/test/commands/stepping_test.rb +0 -192
- data/test/commands/thread_test.rb +0 -164
- data/test/commands/trace_test.rb +0 -71
- data/test/commands/undisplay_test.rb +0 -75
- data/test/commands/variables_test.rb +0 -105
- data/test/debugger_alias_test.rb +0 -7
- data/test/runner_test.rb +0 -150
- data/test/support/matchers.rb +0 -65
- data/test/support/test_interface.rb +0 -59
- data/test/support/utils.rb +0 -122
- data/test/test_helper.rb +0 -58
data/test/commands/help_test.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class HelpTestCase < TestCase
|
3
|
-
include Columnize
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@example = -> do
|
7
|
-
byebug
|
8
|
-
end
|
9
|
-
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
def available_cmds
|
14
|
-
@available_cmds ||= Command.commands.map(&:names).flatten.uniq.sort
|
15
|
-
end
|
16
|
-
|
17
|
-
%w(help h).each do |cmd_alias|
|
18
|
-
define_method(:"test_#{cmd_alias}_shows_help_for_help_command_itself") do
|
19
|
-
enter 'set width 50', cmd_alias
|
20
|
-
debug_proc(@example)
|
21
|
-
check_output_includes \
|
22
|
-
'Type "help <command-name>" for help on a specific command',
|
23
|
-
'Available commands:', columnize(available_cmds, 50)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_help_with_specific_command_shows_help_for_it
|
28
|
-
enter 'help break'
|
29
|
-
debug_proc(@example)
|
30
|
-
check_output_includes \
|
31
|
-
"b[reak] file:line [if expr]\n" \
|
32
|
-
"b[reak] class(.|#)method [if expr]\n\n" \
|
33
|
-
"Set breakpoint to some position, (optionally) if expr == true\n"
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_help_with_undefined_command_shows_an_error
|
37
|
-
enter 'help foobar'
|
38
|
-
debug_proc(@example)
|
39
|
-
check_error_includes 'Undefined command: "foobar". Try "help"'
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_help_with_command_and_subcommand_shows_subcommands_help
|
43
|
-
enter 'help info breakpoints'
|
44
|
-
debug_proc(@example)
|
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/)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class HistoryTestCase < TestCase
|
3
|
-
def setup
|
4
|
-
@example = -> do
|
5
|
-
byebug
|
6
|
-
a = 2
|
7
|
-
a = 3
|
8
|
-
end
|
9
|
-
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_history_displays_latest_records_from_readline_history
|
14
|
-
enter 'show', 'history'
|
15
|
-
debug_proc(@example)
|
16
|
-
check_output_includes("1 show\n 2 history")
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_history_n_displays_whole_history_if_n_is_bigger_than_history_size
|
20
|
-
enter 'show', 'history 3'
|
21
|
-
debug_proc(@example)
|
22
|
-
|
23
|
-
check_output_includes("1 show\n 2 history 3")
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_history_n_displays_lastest_n_records_from_readline_history
|
27
|
-
enter 'show width', 'show autolist', 'history 2'
|
28
|
-
debug_proc(@example)
|
29
|
-
|
30
|
-
check_output_includes("2 show autolist\n 3 history 2")
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_history_does_not_save_empty_commands
|
34
|
-
enter 'show', 'show width', '', 'history 3'
|
35
|
-
debug_proc(@example)
|
36
|
-
|
37
|
-
check_output_includes("1 show\n 2 show width\n 3 history 3")
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_history_does_not_save_duplicated_consecutive_commands
|
41
|
-
enter 'show', 'show width', 'show width', 'history 3'
|
42
|
-
debug_proc(@example)
|
43
|
-
|
44
|
-
check_output_includes("1 show\n 2 show width\n 3 history 3")
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_cmds_from_previous_repls_are_remembered_if_autosave_enabled
|
48
|
-
enter 'set autosave', 'next', 'history 2'
|
49
|
-
debug_proc(@example)
|
50
|
-
|
51
|
-
check_output_includes("2 next\n 3 history 2")
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_cmds_from_previous_repls_are_not_remembered_if_autosave_disabled
|
55
|
-
enter 'set noautosave', 'next', 'history 2'
|
56
|
-
debug_proc(@example)
|
57
|
-
|
58
|
-
check_output_includes("1 history 2")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
data/test/commands/info_test.rb
DELETED
@@ -1,238 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class InfoExample
|
3
|
-
def initialize
|
4
|
-
@foo = 'bar'
|
5
|
-
@bla = 'blabla'
|
6
|
-
end
|
7
|
-
|
8
|
-
def a(y, z)
|
9
|
-
w = '1' * 45
|
10
|
-
x = 2
|
11
|
-
w + x.to_s + y + z + @foo
|
12
|
-
end
|
13
|
-
|
14
|
-
def c
|
15
|
-
a = BasicObject.new
|
16
|
-
a
|
17
|
-
end
|
18
|
-
|
19
|
-
def b
|
20
|
-
a('a', 'b')
|
21
|
-
e = "%.2f"
|
22
|
-
e
|
23
|
-
end
|
24
|
-
|
25
|
-
def d
|
26
|
-
raise 'bang'
|
27
|
-
rescue
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class InfoTestCase < TestCase
|
32
|
-
include Columnize
|
33
|
-
|
34
|
-
def setup
|
35
|
-
@example = -> do
|
36
|
-
byebug
|
37
|
-
i = InfoExample.new
|
38
|
-
i.b
|
39
|
-
i.c
|
40
|
-
i.d
|
41
|
-
end
|
42
|
-
|
43
|
-
super
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_info_about_all_args
|
47
|
-
enter 'break 11', 'cont', 'info args'
|
48
|
-
debug_proc(@example)
|
49
|
-
check_output_includes 'y = "a"', 'z = "b"'
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_info_about_all_breakpoints
|
53
|
-
enter 'break 38', 'break 39 if y == z', 'info breakpoints'
|
54
|
-
debug_proc(@example)
|
55
|
-
check_output_includes 'Num Enb What',
|
56
|
-
/\d+ +y at #{__FILE__}:38/,
|
57
|
-
/\d+ +y at #{__FILE__}:39 if y == z/
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_info_about_specific_breakpoints
|
61
|
-
enter 'b 38', 'b 39', -> { "info breakpoints #{Breakpoint.first.id}" }
|
62
|
-
debug_proc(@example)
|
63
|
-
check_output_includes 'Num Enb What', /\d+ +y at #{__FILE__}:38/
|
64
|
-
check_output_doesnt_include(/\d+ +y at #{__FILE__}:39/)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_info_breakpoints_shows_a_message_when_no_breakpoints_found
|
68
|
-
enter 'info breakpoints'
|
69
|
-
debug_proc(@example)
|
70
|
-
check_output_includes 'No breakpoints.'
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_info_breakpoints_shows_error_if_specific_breakpoint_do_not_exist
|
74
|
-
enter 'break 38', 'info breakpoints 100'
|
75
|
-
debug_proc(@example)
|
76
|
-
check_error_includes 'No breakpoints found among list given'
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_info_breakpoints_shows_hit_counts
|
80
|
-
enter 'break 39', 'cont', 'info breakpoints'
|
81
|
-
debug_proc(@example)
|
82
|
-
check_output_includes(
|
83
|
-
/\d+ +y at #{__FILE__}:39/, 'breakpoint already hit 1 time')
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_info_display_shows_all_display_expressions
|
87
|
-
enter 'display 3 + 3', 'display a + b', 'info display'
|
88
|
-
debug_proc(@example)
|
89
|
-
check_output_includes "Auto-display expressions now in effect:",
|
90
|
-
'Num Enb Expression',
|
91
|
-
'1: y 3 + 3',
|
92
|
-
'2: y a + b'
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_info_display_shows_a_message_when_no_display_expressions_found
|
96
|
-
enter 'info display'
|
97
|
-
debug_proc(@example)
|
98
|
-
check_output_includes 'There are no auto-display expressions now.'
|
99
|
-
end
|
100
|
-
|
101
|
-
def files
|
102
|
-
@files ||= SCRIPT_LINES__.keys.uniq.sort
|
103
|
-
end
|
104
|
-
|
105
|
-
%w(file files).each do |subcmd_alias|
|
106
|
-
define_method(:"test_info_#{subcmd_alias}_shows_all_files_read_in") do
|
107
|
-
enter 'list' # list command explicitly reloads current file into cache
|
108
|
-
enter "info #{subcmd_alias}"
|
109
|
-
debug_proc(@example)
|
110
|
-
check_output_includes "File #{__FILE__}", File.stat(__FILE__).mtime.to_s
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def filename
|
115
|
-
@filename ||= "File #{__FILE__}"
|
116
|
-
end
|
117
|
-
|
118
|
-
def lines
|
119
|
-
@lines ||= "#{File.foreach(__FILE__).count} lines"
|
120
|
-
end
|
121
|
-
|
122
|
-
def mtime
|
123
|
-
@mtime ||= File.stat(__FILE__).mtime.to_s
|
124
|
-
end
|
125
|
-
|
126
|
-
def sha1
|
127
|
-
@sha1 ||= Digest::SHA1.hexdigest(__FILE__)
|
128
|
-
end
|
129
|
-
|
130
|
-
def breakpoint_line_numbers
|
131
|
-
@breakpoint_line_numbers ||=
|
132
|
-
columnize(LineCache.trace_line_numbers(__FILE__).to_a.sort,
|
133
|
-
Byebug::Setting[:width])
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_info_file_basic_shows_basic_info_about_a_specific_file
|
137
|
-
enter "info file #{__FILE__} basic"
|
138
|
-
debug_proc(@example)
|
139
|
-
check_output_includes filename, lines
|
140
|
-
check_output_doesnt_include breakpoint_line_numbers, mtime, sha1
|
141
|
-
end
|
142
|
-
|
143
|
-
def test_info_file_lines_shows_number_of_lines_in_a_specific_file
|
144
|
-
enter "info file #{__FILE__} lines"
|
145
|
-
debug_proc(@example)
|
146
|
-
check_output_includes filename, lines
|
147
|
-
check_output_doesnt_include breakpoint_line_numbers, mtime, sha1
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_info_file_mtime_shows_mtime_of_a_specific_file
|
151
|
-
enter "info file #{__FILE__} mtime"
|
152
|
-
debug_proc(@example)
|
153
|
-
check_output_includes filename, mtime
|
154
|
-
check_output_doesnt_include lines, breakpoint_line_numbers, sha1
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_info_file_sha1_shows_sha1_signature_of_a_specific_file
|
158
|
-
enter "info file #{__FILE__} sha1"
|
159
|
-
debug_proc(@example)
|
160
|
-
check_output_includes filename, sha1
|
161
|
-
check_output_doesnt_include lines, breakpoint_line_numbers, mtime
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_info_file_breakpoints_shows_breakpoints_in_a_specific_file
|
165
|
-
enter 'break 38', 'break 39', "info file #{__FILE__} breakpoints"
|
166
|
-
debug_proc(@example)
|
167
|
-
check_output_includes(
|
168
|
-
/Created breakpoint \d+ at #{__FILE__}:38/,
|
169
|
-
/Created breakpoint \d+ at #{__FILE__}:39/,
|
170
|
-
filename,
|
171
|
-
'breakpoint line numbers:', breakpoint_line_numbers)
|
172
|
-
check_output_doesnt_include lines, mtime, sha1
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_info_file_all_shows_all_available_info_about_a_specific_file
|
176
|
-
enter "info file #{__FILE__} all"
|
177
|
-
debug_proc(@example)
|
178
|
-
check_output_includes \
|
179
|
-
filename, lines, breakpoint_line_numbers, mtime, sha1
|
180
|
-
end
|
181
|
-
|
182
|
-
def test_info_file_does_not_show_any_info_if_parameter_is_invalid
|
183
|
-
enter "info file #{__FILE__} blabla"
|
184
|
-
debug_proc(@example)
|
185
|
-
check_error_includes 'Invalid parameter blabla'
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_info_line_shows_info_about_the_current_line
|
189
|
-
enter 'break 11', 'cont', 'info line'
|
190
|
-
debug_proc(@example)
|
191
|
-
check_output_includes "Line 11 of \"#{__FILE__}\""
|
192
|
-
end
|
193
|
-
|
194
|
-
def test_info_program_shows_the_initial_stop_reason
|
195
|
-
enter 'info program'
|
196
|
-
debug_proc(@example)
|
197
|
-
check_output_includes \
|
198
|
-
"It stopped after stepping, next'ing or initial start."
|
199
|
-
end
|
200
|
-
|
201
|
-
def test_info_program_shows_the_step_stop_reason
|
202
|
-
enter 'step', 'info program'
|
203
|
-
debug_proc(@example)
|
204
|
-
check_output_includes \
|
205
|
-
'Program stopped.',
|
206
|
-
"It stopped after stepping, next'ing or initial start."
|
207
|
-
end
|
208
|
-
|
209
|
-
def test_info_program_shows_the_breakpoint_stop_reason
|
210
|
-
enter 'break 38', 'cont', 'info program'
|
211
|
-
debug_proc(@example)
|
212
|
-
check_output_includes 'Program stopped.', 'It stopped at a breakpoint.'
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_info_program_shows_the_catchpoint_stop_reason
|
216
|
-
enter 'catch Exception', 'cont', 'info program'
|
217
|
-
debug_proc(@example)
|
218
|
-
check_output_includes 'Program stopped.', 'It stopped at a catchpoint.'
|
219
|
-
end
|
220
|
-
|
221
|
-
def test_info_program_shows_the_unknown_stop_reason
|
222
|
-
enter 'break 39', 'cont',
|
223
|
-
->{ context.stubs(:stop_reason).returns('blabla'); 'info program' }
|
224
|
-
debug_proc(@example)
|
225
|
-
check_output_includes 'Program stopped.', 'Unknown reason: blabla'
|
226
|
-
end
|
227
|
-
|
228
|
-
def test_shows_an_error_if_the_program_is_crashed
|
229
|
-
skip('TODO')
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_shows_help_when_typing_just_info
|
233
|
-
enter 'info', 'cont'
|
234
|
-
debug_proc(@example)
|
235
|
-
check_output_includes(/List of "info" subcommands:/)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class InterruptExample
|
3
|
-
def self.a(num)
|
4
|
-
num += 2
|
5
|
-
b(num)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.b(num)
|
9
|
-
v2 = 5 if 1 == num ; [1, 2, v2].map { |a| a.to_f }
|
10
|
-
c(num)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.c(num)
|
14
|
-
num += 4
|
15
|
-
num
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class InterruptTestCase < TestCase
|
20
|
-
def setup
|
21
|
-
@example = -> do
|
22
|
-
byebug
|
23
|
-
ex = InterruptExample.a(7)
|
24
|
-
2.times do
|
25
|
-
ex += 1
|
26
|
-
end
|
27
|
-
InterruptExample.b(ex)
|
28
|
-
end
|
29
|
-
|
30
|
-
super
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_interrupt_stops_at_the_next_statement
|
34
|
-
enter 'interrupt', 'continue'
|
35
|
-
debug_proc(@example) do
|
36
|
-
assert_equal [__FILE__, 4], [state.file, state.line]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_interrupt_steps_into_blocks
|
41
|
-
enter 'break 24', 'cont', 'interrupt', 'cont'
|
42
|
-
debug_proc(@example) { assert_equal 25, state.line }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/test/commands/irb_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
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
|
data/test/commands/kill_test.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class KillExample
|
3
|
-
def self.kill_me
|
4
|
-
'dieeee'
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
class KillTestCase < TestCase
|
9
|
-
def setup
|
10
|
-
@example = -> do
|
11
|
-
byebug
|
12
|
-
KillExample.kill_me
|
13
|
-
end
|
14
|
-
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_kill_sends_signal_to_some_pid
|
19
|
-
Process.expects(:kill).with('USR1', Process.pid)
|
20
|
-
enter 'kill USR1'
|
21
|
-
debug_proc(@example)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_kill_closes_interface_when_sending_KILL_signal_explicitly
|
25
|
-
Process.stubs(:kill).with('KILL', Process.pid)
|
26
|
-
interface.expects(:close)
|
27
|
-
enter 'kill KILL'
|
28
|
-
debug_proc(@example)
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_kill_asks_confirmation_when_sending_kill_implicitly
|
32
|
-
Process.expects(:kill).with('KILL', Process.pid)
|
33
|
-
enter 'kill', 'y'
|
34
|
-
debug_proc(@example)
|
35
|
-
check_confirm_includes 'Really kill? (y/n)'
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_kill_does_not_send_an_unknown_signal
|
39
|
-
Process.expects(:kill).with('BLA', Process.pid).never
|
40
|
-
enter 'kill BLA'
|
41
|
-
debug_proc(@example)
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_kill_shows_an_error_when_the_signal_in_unknown
|
45
|
-
enter 'kill BLA'
|
46
|
-
debug_proc(@example)
|
47
|
-
check_error_includes 'signal name BLA is not a signal I know about'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|