byebug 3.1.2 → 3.2.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/.travis.yml +4 -2
- data/CHANGELOG.md +15 -0
- data/GUIDE.md +17 -35
- data/Gemfile +8 -5
- data/LICENSE +1 -1
- data/README.md +10 -22
- data/Rakefile +1 -1
- data/ext/byebug/byebug.c +3 -2
- data/lib/byebug.rb +3 -38
- data/lib/byebug/commands/break.rb +83 -0
- data/lib/byebug/commands/catchpoint.rb +0 -1
- data/lib/byebug/commands/condition.rb +10 -6
- data/lib/byebug/commands/continue.rb +3 -6
- data/lib/byebug/commands/delete.rb +38 -0
- data/lib/byebug/commands/edit.rb +0 -2
- data/lib/byebug/commands/enable.rb +7 -8
- data/lib/byebug/commands/finish.rb +0 -2
- data/lib/byebug/commands/frame.rb +13 -15
- data/lib/byebug/commands/help.rb +1 -3
- data/lib/byebug/commands/history.rb +3 -3
- data/lib/byebug/commands/info.rb +4 -13
- data/lib/byebug/commands/interrupt.rb +25 -0
- data/lib/byebug/commands/kill.rb +0 -2
- data/lib/byebug/commands/list.rb +2 -4
- data/lib/byebug/commands/method.rb +2 -8
- data/lib/byebug/commands/quit.rb +0 -2
- data/lib/byebug/commands/reload.rb +2 -15
- data/lib/byebug/commands/repl.rb +0 -3
- data/lib/byebug/commands/{control.rb → restart.rb} +2 -26
- data/lib/byebug/commands/save.rb +0 -1
- data/lib/byebug/commands/set.rb +4 -7
- data/lib/byebug/commands/show.rb +0 -3
- data/lib/byebug/commands/source.rb +0 -3
- data/lib/byebug/commands/stepping.rb +3 -4
- data/lib/byebug/commands/trace.rb +0 -1
- data/lib/byebug/commands/variables.rb +3 -4
- data/lib/byebug/context.rb +0 -1
- data/lib/byebug/helper.rb +23 -0
- data/lib/byebug/interfaces/script_interface.rb +1 -1
- data/lib/byebug/processors/command_processor.rb +9 -9
- data/lib/byebug/remote.rb +2 -2
- data/lib/byebug/setting.rb +3 -1
- data/lib/byebug/settings/autoeval.rb +3 -1
- data/lib/byebug/settings/autoirb.rb +3 -1
- data/lib/byebug/settings/autolist.rb +3 -1
- data/lib/byebug/settings/autoreload.rb +1 -3
- data/lib/byebug/settings/autosave.rb +1 -3
- data/lib/byebug/settings/callstyle.rb +2 -4
- data/lib/byebug/settings/fullpath.rb +1 -3
- data/lib/byebug/settings/histfile.rb +1 -3
- data/lib/byebug/settings/histsize.rb +0 -4
- data/lib/byebug/settings/listsize.rb +1 -3
- data/lib/byebug/settings/post_mortem.rb +14 -1
- data/lib/byebug/settings/width.rb +1 -17
- data/lib/byebug/version.rb +1 -1
- data/test/break_test.rb +376 -0
- data/test/condition_test.rb +82 -0
- data/test/continue_test.rb +27 -30
- data/test/debugger_alias_test.rb +4 -4
- data/test/delete_test.rb +26 -0
- data/test/display_test.rb +80 -102
- data/test/edit_test.rb +28 -31
- data/test/eval_test.rb +50 -80
- data/test/finish_test.rb +23 -23
- data/test/frame_test.rb +172 -186
- data/test/help_test.rb +27 -37
- data/test/history_test.rb +32 -41
- data/test/info_test.rb +198 -230
- data/test/interrupt_test.rb +17 -36
- data/test/irb_test.rb +47 -0
- data/test/kill_test.rb +19 -19
- data/test/list_test.rb +126 -133
- data/test/method_test.rb +21 -54
- data/test/post_mortem_test.rb +44 -46
- data/test/pry_test.rb +42 -0
- data/test/quit_test.rb +17 -15
- data/test/reload_test.rb +23 -28
- data/test/restart_test.rb +35 -63
- data/test/save_test.rb +46 -62
- data/test/set_test.rb +93 -144
- data/test/show_test.rb +50 -71
- data/test/source_test.rb +23 -26
- data/test/stepping_test.rb +125 -153
- data/test/support/matchers.rb +1 -6
- data/test/support/test_interface.rb +1 -1
- data/test/support/{test_dsl.rb → utils.rb} +17 -64
- data/test/test_helper.rb +25 -7
- data/test/thread_test.rb +101 -89
- data/test/trace_test.rb +48 -85
- data/test/variables_test.rb +43 -80
- metadata +18 -13
- data/lib/byebug/commands/breakpoints.rb +0 -137
- data/lib/byebug/commands/skip.rb +0 -30
- data/test/breakpoints_test.rb +0 -474
- data/test/conditions_test.rb +0 -82
- data/test/repl_test.rb +0 -75
data/test/help_test.rb
CHANGED
@@ -1,59 +1,49 @@
|
|
1
|
-
module
|
2
|
-
class HelpTestCase <
|
1
|
+
module Byebug
|
2
|
+
class HelpTestCase < TestCase
|
3
3
|
include Columnize
|
4
4
|
|
5
|
-
|
5
|
+
def setup
|
6
6
|
@example = -> do
|
7
7
|
byebug
|
8
8
|
end
|
9
|
-
end
|
10
9
|
|
11
|
-
|
12
|
-
Byebug::Command.commands.map(&:names).flatten.uniq.sort
|
10
|
+
super
|
13
11
|
end
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
def available_cmds
|
14
|
+
@available_cmds ||=
|
15
|
+
Command.commands.map(&:names).flatten.uniq.sort
|
16
|
+
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
%w(help h).each do |cmd_alias|
|
19
|
+
define_method(:"test_#{cmd_alias}_shows_help_for_help_command_itself") do
|
20
|
+
enter 'set width 50', cmd_alias
|
20
21
|
debug_proc(@example)
|
21
22
|
check_output_includes \
|
22
23
|
'Type "help <command-name>" for help on a specific command',
|
23
24
|
'Available commands:', columnize(available_cmds, 50)
|
24
25
|
end
|
25
|
-
|
26
|
-
it 'must work when shortcut used' do
|
27
|
-
enter 'h'
|
28
|
-
debug_proc(@example)
|
29
|
-
check_output_includes \
|
30
|
-
'Type "help <command-name>" for help on a specific command'
|
31
|
-
end
|
32
26
|
end
|
33
27
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
28
|
+
def test_help_with_specific_command_shows_help_for_it
|
29
|
+
enter 'help break'
|
30
|
+
debug_proc(@example)
|
31
|
+
check_output_includes \
|
32
|
+
"b[reak] file:line [if expr]\n" \
|
33
|
+
"b[reak] class(.|#)method [if expr]\n\n" \
|
34
|
+
"Set breakpoint to some position, (optionally) if expr == true\n"
|
35
|
+
end
|
40
36
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
"b[reak] file:line [if expr]\n" \
|
46
|
-
"b[reak] class(.|#)method [if expr]\n\n" \
|
47
|
-
"Set breakpoint to some position, (optionally) if expr == true\n"
|
48
|
-
end
|
37
|
+
def test_help_with_undefined_command_shows_an_error
|
38
|
+
enter 'help foobar'
|
39
|
+
debug_proc(@example)
|
40
|
+
check_error_includes 'Undefined command: "foobar". Try "help".'
|
49
41
|
end
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
check_output_includes "Status of user-settable breakpoints.\n"
|
56
|
-
end
|
43
|
+
def test_help_with_command_and_subcommand_shows_subcommands_help
|
44
|
+
enter 'help info breakpoints'
|
45
|
+
debug_proc(@example)
|
46
|
+
check_output_includes "Status of user-settable breakpoints.\n"
|
57
47
|
end
|
58
48
|
end
|
59
49
|
end
|
data/test/history_test.rb
CHANGED
@@ -1,54 +1,45 @@
|
|
1
|
-
module
|
2
|
-
class HistoryTestCase <
|
3
|
-
|
1
|
+
module Byebug
|
2
|
+
class HistoryTestCase < TestCase
|
3
|
+
def setup
|
4
4
|
@example = -> do
|
5
5
|
byebug
|
6
6
|
end
|
7
|
-
end
|
8
7
|
|
9
|
-
|
10
|
-
temporary_change_const Readline, 'HISTORY', %w(aaa bbb ccc ddd)
|
8
|
+
super
|
11
9
|
|
12
|
-
|
13
|
-
|
10
|
+
@old_readline = Readline::HISTORY
|
11
|
+
force_set_const(Readline, 'HISTORY', %w(aaa bbb ccc ddd))
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
check_error_includes "Not currently saving history. " \
|
19
|
-
'Enable it with "set autosave"'
|
20
|
-
end
|
21
|
-
end
|
14
|
+
def teardown
|
15
|
+
force_set_const(Readline, 'HISTORY', @old_readline)
|
16
|
+
end
|
22
17
|
|
23
|
-
|
24
|
-
|
18
|
+
def test_history_displays_latest_records_from_readline_history
|
19
|
+
enter 'set histsize 3', 'history'
|
20
|
+
debug_proc(@example)
|
21
|
+
check_output_includes(/2 bbb\n 3 ccc\n 4 ddd/)
|
22
|
+
check_output_doesnt_include(/1 aaa/)
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
check_output_doesnt_include(/1 aaa/)
|
32
|
-
end
|
33
|
-
end
|
25
|
+
def test_history_displays_whole_history_if_max_size_is_bigger_than_readline
|
26
|
+
enter 'set histsize 7', 'history'
|
27
|
+
debug_proc(@example)
|
28
|
+
check_output_includes(/1 aaa\n 2 bbb\n 3 ccc\n 4 ddd/)
|
29
|
+
end
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
31
|
+
def test_history_n_displays_lastest_n_records_from_readline_history
|
32
|
+
enter 'history 2'
|
33
|
+
debug_proc(@example)
|
34
|
+
check_output_includes(/3 ccc\n 4 ddd/)
|
35
|
+
check_output_doesnt_include(/1 aaa\n 2 bbb/)
|
36
|
+
end
|
42
37
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
check_output_doesnt_include(/1 aaa\n 2 bbb/)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
38
|
+
def test_history_with_autosave_disabled_does_not_show_records_from_readline
|
39
|
+
enter 'set noautosave', 'history'
|
40
|
+
debug_proc(@example)
|
41
|
+
check_error_includes "Not currently saving history. " \
|
42
|
+
'Enable it with "set autosave"'
|
52
43
|
end
|
53
44
|
end
|
54
45
|
end
|
data/test/info_test.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
module
|
2
|
-
class
|
1
|
+
module Byebug
|
2
|
+
class InfoExample
|
3
3
|
def initialize
|
4
4
|
@foo = 'bar'
|
5
5
|
@bla = 'blabla'
|
6
6
|
end
|
7
7
|
|
8
8
|
def a(y, z)
|
9
|
-
w = '1' *
|
9
|
+
w = '1' * 45
|
10
10
|
x = 2
|
11
11
|
w + x.to_s + y + z + @foo
|
12
12
|
end
|
@@ -28,293 +28,261 @@ module InfoTest
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
class InfoTestCase <
|
31
|
+
class InfoTestCase < TestCase
|
32
32
|
include Columnize
|
33
33
|
|
34
|
-
|
34
|
+
def setup
|
35
35
|
@example = -> do
|
36
36
|
byebug
|
37
|
-
i =
|
37
|
+
i = InfoExample.new
|
38
38
|
i.b
|
39
39
|
i.c
|
40
40
|
i.d
|
41
41
|
end
|
42
|
-
end
|
43
42
|
|
44
|
-
|
45
|
-
it 'must show info about all args' do
|
46
|
-
enter 'break 11', 'cont', 'info args'
|
47
|
-
debug_proc(@example)
|
48
|
-
check_output_includes 'y = "a"', 'z = "b"'
|
49
|
-
end
|
43
|
+
super
|
50
44
|
end
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
/\d+ +y at #{__FILE__}:38/,
|
58
|
-
/\d+ +y at #{__FILE__}:39 if y == z/
|
59
|
-
end
|
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
|
60
51
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
68
59
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
60
|
+
def test_info_about_specific_breakpoints
|
61
|
+
enter 'break 38', 'break 39',
|
62
|
+
-> { "info breakpoints #{first_brkpt.id}" }
|
63
|
+
debug_proc(@example)
|
64
|
+
check_output_includes 'Num Enb What', /\d+ +y at #{__FILE__}:38/
|
65
|
+
check_output_doesnt_include(/\d+ +y at #{__FILE__}:39/)
|
66
|
+
end
|
74
67
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
68
|
+
def test_info_breakpoints_shows_a_message_when_no_breakpoints_found
|
69
|
+
enter 'info breakpoints'
|
70
|
+
debug_proc(@example)
|
71
|
+
check_output_includes 'No breakpoints.'
|
72
|
+
end
|
80
73
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
/\d+ +y at #{__FILE__}:39/, 'breakpoint already hit 1 time')
|
86
|
-
end
|
74
|
+
def test_info_breakpoints_shows_error_if_specific_breakpoint_do_not_exist
|
75
|
+
enter 'break 38', 'info breakpoints 100'
|
76
|
+
debug_proc(@example)
|
77
|
+
check_error_includes 'No breakpoints found among list given.'
|
87
78
|
end
|
88
79
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
'1: y 3 + 3',
|
96
|
-
'2: y a + b'
|
97
|
-
end
|
80
|
+
def test_info_breakpoints_shows_hit_counts
|
81
|
+
enter 'break 39', 'cont', 'info breakpoints'
|
82
|
+
debug_proc(@example)
|
83
|
+
check_output_includes(
|
84
|
+
/\d+ +y at #{__FILE__}:39/, 'breakpoint already hit 1 time')
|
85
|
+
end
|
98
86
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
87
|
+
def test_info_display_shows_all_display_expressions
|
88
|
+
enter 'display 3 + 3', 'display a + b', 'info display'
|
89
|
+
debug_proc(@example)
|
90
|
+
check_output_includes "Auto-display expressions now in effect:\n" \
|
91
|
+
'Num Enb Expression',
|
92
|
+
'1: y 3 + 3',
|
93
|
+
'2: y a + b'
|
104
94
|
end
|
105
95
|
|
106
|
-
|
107
|
-
|
96
|
+
def test_info_display_shows_a_message_when_no_display_expressions_found
|
97
|
+
enter 'info display'
|
98
|
+
debug_proc(@example)
|
99
|
+
check_output_includes 'There are no auto-display expressions now.'
|
100
|
+
end
|
108
101
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
check_output_includes files.map { |f| "File #{f}" }
|
113
|
-
end
|
102
|
+
def files
|
103
|
+
@files ||= SCRIPT_LINES__.keys.uniq.sort
|
104
|
+
end
|
114
105
|
|
115
|
-
|
116
|
-
|
106
|
+
%w(file files).each do |subcmd_alias|
|
107
|
+
define_method(:"test_info_#{subcmd_alias}_shows_all_files_read_in") do
|
108
|
+
enter 'list' # list command explicitly reloads current file into cache
|
109
|
+
enter "info #{subcmd_alias}"
|
117
110
|
debug_proc(@example)
|
118
|
-
check_output_includes
|
111
|
+
check_output_includes "File #{__FILE__}", File.stat(__FILE__).mtime.to_s
|
119
112
|
end
|
113
|
+
end
|
120
114
|
|
121
|
-
|
122
|
-
|
123
|
-
debug_proc(@example)
|
124
|
-
check_output_includes "File #{__FILE__}",
|
125
|
-
LineCache.stat(__FILE__).mtime.to_s
|
126
|
-
end
|
115
|
+
def filename
|
116
|
+
@filename ||= "File #{__FILE__}"
|
127
117
|
end
|
128
118
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
let(:lines) { "#{LineCache.size(file)} lines" }
|
133
|
-
let(:mtime) { LineCache.stat(file).mtime.to_s }
|
134
|
-
let(:sha1) { LineCache.sha1(file) }
|
135
|
-
let(:breakpoint_line_numbers) {
|
136
|
-
columnize(LineCache.trace_line_numbers(file).to_a.sort,
|
137
|
-
Byebug::Setting[:width]) }
|
119
|
+
def lines
|
120
|
+
@lines ||= "#{File.foreach(__FILE__).count} lines"
|
121
|
+
end
|
138
122
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
check_output_includes filename, lines
|
143
|
-
check_output_doesnt_include breakpoint_line_numbers, mtime, sha1
|
144
|
-
end
|
123
|
+
def mtime
|
124
|
+
@mtime ||= File.stat(__FILE__).mtime.to_s
|
125
|
+
end
|
145
126
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
check_output_includes filename, lines
|
150
|
-
check_output_doesnt_include breakpoint_line_numbers, mtime, sha1
|
151
|
-
end
|
127
|
+
def sha1
|
128
|
+
@sha1 ||= Digest::SHA1.hexdigest(__FILE__)
|
129
|
+
end
|
152
130
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
end
|
131
|
+
def breakpoint_line_numbers
|
132
|
+
@breakpoint_line_numbers ||=
|
133
|
+
columnize(LineCache.trace_line_numbers(__FILE__).to_a.sort,
|
134
|
+
Setting[:width])
|
135
|
+
end
|
159
136
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
137
|
+
def test_info_file_basic_shows_basic_info_about_a_specific_file
|
138
|
+
enter "info file #{__FILE__} basic"
|
139
|
+
debug_proc(@example)
|
140
|
+
check_output_includes filename, lines
|
141
|
+
check_output_doesnt_include breakpoint_line_numbers, mtime, sha1
|
142
|
+
end
|
166
143
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
'breakpoint line numbers:', breakpoint_line_numbers)
|
174
|
-
check_output_doesnt_include lines, mtime, sha1
|
175
|
-
end
|
144
|
+
def test_info_file_lines_shows_number_of_lines_in_a_specific_file
|
145
|
+
enter "info file #{__FILE__} lines"
|
146
|
+
debug_proc(@example)
|
147
|
+
check_output_includes filename, lines
|
148
|
+
check_output_doesnt_include breakpoint_line_numbers, mtime, sha1
|
149
|
+
end
|
176
150
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
151
|
+
def test_info_file_mtime_shows_mtime_of_a_specific_file
|
152
|
+
enter "info file #{__FILE__} mtime"
|
153
|
+
debug_proc(@example)
|
154
|
+
check_output_includes filename, mtime
|
155
|
+
check_output_doesnt_include lines, breakpoint_line_numbers, sha1
|
156
|
+
end
|
183
157
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
158
|
+
def test_info_file_sha1_shows_sha1_signature_of_a_specific_file
|
159
|
+
enter "info file #{__FILE__} sha1"
|
160
|
+
debug_proc(@example)
|
161
|
+
check_output_includes filename, sha1
|
162
|
+
check_output_doesnt_include lines, breakpoint_line_numbers, mtime
|
189
163
|
end
|
190
164
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
165
|
+
def test_info_file_breakpoints_shows_breakpoints_in_a_specific_file
|
166
|
+
enter 'break 38', 'break 39', "info file #{__FILE__} breakpoints"
|
167
|
+
debug_proc(@example)
|
168
|
+
check_output_includes(
|
169
|
+
/Created breakpoint \d+ at #{__FILE__}:38/,
|
170
|
+
/Created breakpoint \d+ at #{__FILE__}:39/,
|
171
|
+
filename,
|
172
|
+
'breakpoint line numbers:', breakpoint_line_numbers)
|
173
|
+
check_output_doesnt_include lines, mtime, sha1
|
197
174
|
end
|
198
175
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
end
|
176
|
+
def test_info_file_all_shows_all_available_info_about_a_specific_file
|
177
|
+
enter "info file #{__FILE__} all"
|
178
|
+
debug_proc(@example)
|
179
|
+
check_output_includes \
|
180
|
+
filename, lines, breakpoint_line_numbers, mtime, sha1
|
205
181
|
end
|
206
182
|
|
207
|
-
|
208
|
-
|
183
|
+
def test_info_file_does_not_show_any_info_if_parameter_is_invalid
|
184
|
+
enter "info file #{__FILE__} blabla"
|
185
|
+
debug_proc(@example)
|
186
|
+
check_error_includes 'Invalid parameter blabla'
|
187
|
+
end
|
209
188
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
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
|
215
194
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
end
|
195
|
+
def test_info_line_shows_info_about_the_current_line
|
196
|
+
enter 'break 11', 'cont', 'info line'
|
197
|
+
debug_proc(@example)
|
198
|
+
check_output_includes "Line 11 of \"#{__FILE__}\""
|
221
199
|
end
|
222
200
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
"It stopped after stepping, next'ing or initial start."
|
229
|
-
end
|
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
|
230
206
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
"It stopped after stepping, next'ing or initial start."
|
237
|
-
end
|
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
|
238
212
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
213
|
+
def test_info_program_shows_the_initial_stop_reason
|
214
|
+
enter 'info program'
|
215
|
+
debug_proc(@example)
|
216
|
+
check_output_includes \
|
217
|
+
"It stopped after stepping, next'ing or initial start."
|
218
|
+
end
|
244
219
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
220
|
+
def test_info_program_shows_the_step_stop_reason
|
221
|
+
enter 'step', 'info program'
|
222
|
+
debug_proc(@example)
|
223
|
+
check_output_includes \
|
224
|
+
'Program stopped.',
|
225
|
+
"It stopped after stepping, next'ing or initial start."
|
226
|
+
end
|
250
227
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
end
|
228
|
+
def test_info_program_shows_the_breakpoint_stop_reason
|
229
|
+
enter 'break 38', 'cont', 'info program'
|
230
|
+
debug_proc(@example)
|
231
|
+
check_output_includes 'Program stopped.', 'It stopped at a breakpoint.'
|
232
|
+
end
|
257
233
|
|
258
|
-
|
259
|
-
|
260
|
-
|
234
|
+
def test_info_program_shows_the_catchpoint_stop_reason
|
235
|
+
enter 'catch Exception', 'cont', 'info program'
|
236
|
+
debug_proc(@example)
|
237
|
+
check_output_includes 'Program stopped.', 'It stopped at a catchpoint.'
|
261
238
|
end
|
262
239
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
check_output_includes(
|
269
|
-
/--> #0 InfoTest::Example.a\(y#String, z#String\)\s+at #{file}:9/,
|
270
|
-
/#1 InfoTest::Example.b\s+at #{file}:20/,
|
271
|
-
/#2 block \(2 levels\) in <class:InfoTestCase>\s+at #{file}:38/)
|
272
|
-
end
|
240
|
+
def test_info_program_shows_the_unknown_stop_reason
|
241
|
+
enter 'break 39', 'cont',
|
242
|
+
->{ context.stubs(:stop_reason).returns('blabla'); 'info program' }
|
243
|
+
debug_proc(@example)
|
244
|
+
check_output_includes 'Program stopped.', 'unknown reason: blabla'
|
273
245
|
end
|
274
246
|
|
275
|
-
|
276
|
-
|
277
|
-
enter 'info global_variables'
|
278
|
-
debug_proc(@example)
|
279
|
-
check_output_includes "$$ = #{Process.pid}"
|
280
|
-
end
|
247
|
+
def test_shows_an_error_if_the_program_is_crashed
|
248
|
+
skip('TODO')
|
281
249
|
end
|
282
250
|
|
283
|
-
|
284
|
-
|
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
|
285
256
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
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
|
295
266
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
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
|
304
275
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
end
|
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"'
|
310
280
|
end
|
311
281
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
check_output_includes(/List of "info" subcommands:/)
|
317
|
-
end
|
282
|
+
def test_shows_help_when_typing_just_info
|
283
|
+
enter 'info', 'cont'
|
284
|
+
debug_proc(@example)
|
285
|
+
check_output_includes(/List of "info" subcommands:/)
|
318
286
|
end
|
319
287
|
end
|
320
288
|
end
|