byebug 2.1.1 → 2.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/.gitignore +1 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +13 -1
- data/GUIDE.md +181 -1
- data/README.md +67 -211
- data/Rakefile +1 -0
- data/bin/byebug +1 -8
- data/ext/byebug/byebug.c +66 -25
- data/ext/byebug/context.c +16 -20
- data/ext/byebug/extconf.rb +2 -1
- data/lib/byebug.rb +16 -9
- data/lib/byebug/command.rb +3 -3
- data/lib/byebug/commands/condition.rb +2 -2
- data/lib/byebug/commands/edit.rb +12 -9
- data/lib/byebug/commands/eval.rb +0 -16
- data/lib/byebug/commands/frame.rb +7 -17
- data/lib/byebug/commands/info.rb +2 -9
- data/lib/byebug/commands/list.rb +1 -1
- data/lib/byebug/commands/reload.rb +11 -0
- data/lib/byebug/commands/repl.rb +3 -6
- data/lib/byebug/commands/set.rb +5 -5
- data/lib/byebug/commands/show.rb +5 -0
- data/lib/byebug/commands/threads.rb +4 -4
- data/lib/byebug/commands/trace.rb +2 -1
- data/lib/byebug/context.rb +14 -5
- data/lib/byebug/interface.rb +1 -1
- data/lib/byebug/processor.rb +1 -1
- data/lib/byebug/remote.rb +1 -24
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +0 -3
- data/old_doc/byebug.texi +2 -3
- data/test/breakpoints_test.rb +75 -52
- data/test/conditions_test.rb +2 -3
- data/test/continue_test.rb +6 -0
- data/test/edit_test.rb +3 -3
- data/test/eval_test.rb +14 -5
- data/test/examples/breakpoint.rb +4 -13
- data/test/examples/breakpoint_deep.rb +1 -21
- data/test/examples/conditions.rb +1 -1
- data/test/examples/continue.rb +2 -1
- data/test/examples/edit.rb +1 -0
- data/test/examples/eval.rb +1 -11
- data/test/examples/finish.rb +0 -17
- data/test/examples/frame.rb +2 -26
- data/test/examples/frame_deep.rb +0 -19
- data/test/examples/help.rb +0 -1
- data/test/examples/info.rb +4 -36
- data/test/examples/kill.rb +1 -1
- data/test/examples/list.rb +1 -1
- data/test/examples/method.rb +2 -13
- data/test/examples/post_mortem.rb +1 -16
- data/test/examples/quit.rb +1 -1
- data/test/examples/reload.rb +1 -1
- data/test/examples/restart.rb +1 -1
- data/test/examples/show.rb +0 -1
- data/test/examples/stepping.rb +2 -19
- data/test/examples/thread.rb +0 -27
- data/test/examples/variables.rb +0 -22
- data/test/finish_test.rb +22 -6
- data/test/frame_test.rb +89 -56
- data/test/info_test.rb +71 -46
- data/test/kill_test.rb +6 -1
- data/test/list_test.rb +1 -2
- data/test/method_test.rb +32 -13
- data/test/post_mortem_test.rb +34 -21
- data/test/quit_test.rb +0 -1
- data/test/restart_test.rb +6 -0
- data/test/set_test.rb +1 -1
- data/test/show_test.rb +17 -17
- data/test/source_test.rb +2 -3
- data/test/stepping_test.rb +31 -7
- data/test/support/test_dsl.rb +11 -1
- data/test/test_helper.rb +9 -0
- data/test/thread_test.rb +57 -23
- data/test/trace_test.rb +0 -1
- data/test/variables_test.rb +36 -17
- metadata +3 -9
- data/test/examples/breakpoint2.rb +0 -7
- data/test/examples/jump.rb +0 -14
- data/test/examples/set_annotate.rb +0 -12
data/test/finish_test.rb
CHANGED
@@ -1,29 +1,45 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class FinishExample
|
4
|
+
def a
|
5
|
+
b
|
6
|
+
end
|
7
|
+
def b
|
8
|
+
c
|
9
|
+
2
|
10
|
+
end
|
11
|
+
def c
|
12
|
+
d
|
13
|
+
3
|
14
|
+
end
|
15
|
+
def d
|
16
|
+
5
|
17
|
+
end
|
18
|
+
end
|
4
19
|
|
20
|
+
class TestFinish < TestDsl::TestCase
|
5
21
|
it 'must stop at the next frame by default' do
|
6
|
-
enter
|
22
|
+
enter "break #{__FILE__}:16", 'cont', 'finish'
|
7
23
|
debug_file('finish') { $state.line.must_equal 13 }
|
8
24
|
end
|
9
25
|
|
10
26
|
it 'must stop at the #0 frame by default' do
|
11
|
-
enter
|
27
|
+
enter "break #{__FILE__}:16", 'cont', 'finish 0'
|
12
28
|
debug_file('finish') { $state.line.must_equal 13 }
|
13
29
|
end
|
14
30
|
|
15
31
|
it 'must stop at the specified frame' do
|
16
|
-
enter
|
32
|
+
enter "break #{__FILE__}:16", 'cont', 'finish 1'
|
17
33
|
debug_file('finish') { $state.line.must_equal 9 }
|
18
34
|
end
|
19
35
|
|
20
36
|
it 'must stop at the next frame if the current frame was changed' do
|
21
|
-
enter
|
37
|
+
enter "break #{__FILE__}:16", 'cont', 'up', 'finish'
|
22
38
|
debug_file('finish') { $state.line.must_equal 9 }
|
23
39
|
end
|
24
40
|
|
25
41
|
describe 'not a number is specified for frame' do
|
26
|
-
before { enter
|
42
|
+
before { enter "break #{__FILE__}:16", 'cont', 'finish foo' }
|
27
43
|
|
28
44
|
it 'must show an error' do
|
29
45
|
debug_file('finish')
|
data/test/frame_test.rb
CHANGED
@@ -1,10 +1,53 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
+
class FrameExample
|
4
|
+
def initialize(f)
|
5
|
+
@f = f
|
6
|
+
end
|
7
|
+
|
8
|
+
def a
|
9
|
+
b
|
10
|
+
end
|
11
|
+
|
12
|
+
def b
|
13
|
+
c
|
14
|
+
2
|
15
|
+
end
|
16
|
+
|
17
|
+
def c
|
18
|
+
d('a')
|
19
|
+
3
|
20
|
+
end
|
21
|
+
|
22
|
+
def d(e)
|
23
|
+
5
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class FrameDeepExample
|
28
|
+
def a
|
29
|
+
z = 1
|
30
|
+
z += b
|
31
|
+
end
|
32
|
+
def b
|
33
|
+
z = 2
|
34
|
+
z += c
|
35
|
+
end
|
36
|
+
def c
|
37
|
+
z = 3
|
38
|
+
byebug
|
39
|
+
z += d('a')
|
40
|
+
end
|
41
|
+
def d(e)
|
42
|
+
4
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
3
46
|
class TestFrame < TestDsl::TestCase
|
4
47
|
describe 'when byebug started at the beginning' do
|
5
48
|
before do
|
6
49
|
@tst_file = fullpath('frame')
|
7
|
-
enter
|
50
|
+
enter "break #{__FILE__}:23", 'cont'
|
8
51
|
end
|
9
52
|
|
10
53
|
it 'must go up' do
|
@@ -35,7 +78,7 @@ class TestFrame < TestDsl::TestCase
|
|
35
78
|
it 'must print current stack frame when without arguments' do
|
36
79
|
enter 'up', 'frame'
|
37
80
|
debug_file('frame')
|
38
|
-
check_output_includes
|
81
|
+
check_output_includes(/#1 FrameExample\.c\s+at #{__FILE__}:18/)
|
39
82
|
end
|
40
83
|
|
41
84
|
it 'must set frame to the first one' do
|
@@ -45,7 +88,7 @@ class TestFrame < TestDsl::TestCase
|
|
45
88
|
|
46
89
|
it 'must set frame to the last one' do
|
47
90
|
enter 'frame -1'
|
48
|
-
debug_file('frame') { $state.file.must_match
|
91
|
+
debug_file('frame') { $state.file.must_match(/minitest\/unit.rb/) }
|
49
92
|
end
|
50
93
|
|
51
94
|
it 'must not set frame if the frame number is too low' do
|
@@ -63,21 +106,16 @@ class TestFrame < TestDsl::TestCase
|
|
63
106
|
end
|
64
107
|
|
65
108
|
describe 'fullpath' do
|
66
|
-
def short_path(fullpath)
|
67
|
-
separator = File::ALT_SEPARATOR || File::SEPARATOR
|
68
|
-
"...#{separator}" + fullpath.split(separator)[-3..-1].join(separator)
|
69
|
-
end
|
70
|
-
|
71
109
|
describe 'when set' do
|
72
110
|
temporary_change_hash Byebug.settings, :fullpath, true
|
73
111
|
|
74
112
|
it 'must display current backtrace with fullpaths' do
|
75
113
|
enter 'where'
|
76
114
|
debug_file 'frame'
|
77
|
-
check_output_includes
|
78
|
-
/--> #0 FrameExample\.d\(e#String\)\s+at #{
|
79
|
-
/#1 FrameExample\.c\s+at #{
|
80
|
-
/#2 FrameExample\.b\s+at #{
|
115
|
+
check_output_includes(
|
116
|
+
/--> #0 FrameExample\.d\(e#String\)\s+at #{__FILE__}:23/,
|
117
|
+
/#1 FrameExample\.c\s+at #{__FILE__}:18/,
|
118
|
+
/#2 FrameExample\.b\s+at #{__FILE__}:13/)
|
81
119
|
end
|
82
120
|
end
|
83
121
|
|
@@ -87,11 +125,11 @@ class TestFrame < TestDsl::TestCase
|
|
87
125
|
it 'must display current backtrace with shortpaths' do
|
88
126
|
enter 'where'
|
89
127
|
debug_file 'frame'
|
90
|
-
check_output_includes
|
91
|
-
/--> #0 FrameExample\.d\(e#String\)\s+at #{
|
92
|
-
/#1 FrameExample\.c\s+at #{
|
93
|
-
/#2 FrameExample\.b\s+at #{
|
94
|
-
/#3 FrameExample\.a\s+at #{
|
128
|
+
check_output_includes(
|
129
|
+
/--> #0 FrameExample\.d\(e#String\)\s+at #{shortpath(__FILE__)}:23/,
|
130
|
+
/#1 FrameExample\.c\s+at #{shortpath(__FILE__)}:18/,
|
131
|
+
/#2 FrameExample\.b\s+at #{shortpath(__FILE__)}:13/,
|
132
|
+
/#3 FrameExample\.a\s+at #{shortpath(__FILE__)}:9/)
|
95
133
|
end
|
96
134
|
end
|
97
135
|
end
|
@@ -103,11 +141,11 @@ class TestFrame < TestDsl::TestCase
|
|
103
141
|
it 'displays current backtrace with callstyle "long"' do
|
104
142
|
enter 'where'
|
105
143
|
debug_file 'frame'
|
106
|
-
check_output_includes
|
107
|
-
/--> #0 FrameExample\.d\(e#String\)\s+at #{
|
108
|
-
/#1 FrameExample\.c\s+at #{
|
109
|
-
/#2 FrameExample\.b\s+at #{
|
110
|
-
/#3 FrameExample\.a\s+at #{
|
144
|
+
check_output_includes(
|
145
|
+
/--> #0 FrameExample\.d\(e#String\)\s+at #{__FILE__}:23/,
|
146
|
+
/#1 FrameExample\.c\s+at #{__FILE__}:18/,
|
147
|
+
/#2 FrameExample\.b\s+at #{__FILE__}:13/,
|
148
|
+
/#3 FrameExample\.a\s+at #{__FILE__}:9/)
|
111
149
|
end
|
112
150
|
end
|
113
151
|
|
@@ -117,81 +155,76 @@ class TestFrame < TestDsl::TestCase
|
|
117
155
|
it 'displays current backtrace with callstyle "short"' do
|
118
156
|
enter 'where'
|
119
157
|
debug_file 'frame'
|
120
|
-
check_output_includes
|
121
|
-
/#1 c\s+at #{
|
122
|
-
/#2 b\s+at #{
|
123
|
-
/#3 a\s+at #{
|
158
|
+
check_output_includes(/--> #0 d\(e\)\s+at #{__FILE__}:23/,
|
159
|
+
/#1 c\s+at #{__FILE__}:18/,
|
160
|
+
/#2 b\s+at #{__FILE__}:13/,
|
161
|
+
/#3 a\s+at #{__FILE__}:9/)
|
124
162
|
end
|
125
163
|
end
|
126
164
|
end
|
127
165
|
end
|
128
166
|
|
129
167
|
describe 'when byebug is started deep in the callstack' do
|
130
|
-
before {
|
168
|
+
before { enter "break #{__FILE__}:42", 'cont' }
|
131
169
|
|
132
170
|
it 'must print backtrace' do
|
133
|
-
enter '
|
171
|
+
enter 'where'
|
134
172
|
debug_file 'frame_deep'
|
135
|
-
check_output_includes
|
136
|
-
/--> #0 FrameDeepExample\.d\(e#String\)\s+at #{
|
137
|
-
/#1 FrameDeepExample\.c\s+at #{
|
138
|
-
/#2 FrameDeepExample\.b\s+at #{
|
173
|
+
check_output_includes(
|
174
|
+
/--> #0 FrameDeepExample\.d\(e#String\)\s+at #{__FILE__}:42/,
|
175
|
+
/#1 FrameDeepExample\.c\s+at #{__FILE__}:39/,
|
176
|
+
/#2 FrameDeepExample\.b\s+at #{__FILE__}:34/)
|
139
177
|
end
|
140
178
|
|
141
179
|
it 'must go up' do
|
142
|
-
enter '
|
143
|
-
debug_file('frame_deep') { $state.line.must_equal
|
180
|
+
enter 'up'
|
181
|
+
debug_file('frame_deep') { $state.line.must_equal 39 }
|
144
182
|
end
|
145
183
|
|
146
184
|
it 'must go down' do
|
147
|
-
enter '
|
148
|
-
debug_file('frame_deep') { $state.line.must_equal
|
185
|
+
enter 'up', 'down'
|
186
|
+
debug_file('frame_deep') { $state.line.must_equal 42 }
|
149
187
|
end
|
150
188
|
|
151
189
|
it 'must set frame' do
|
152
|
-
enter '
|
153
|
-
debug_file('frame_deep') { $state.line.must_equal
|
190
|
+
enter 'frame 2'
|
191
|
+
debug_file('frame_deep') { $state.line.must_equal 34 }
|
154
192
|
end
|
155
193
|
|
156
194
|
it 'must eval properly when scaling the stack' do
|
157
|
-
enter '
|
195
|
+
enter 'p z', 'up', 'p z', 'up', 'p z'
|
158
196
|
debug_file('frame_deep')
|
159
197
|
check_output_includes 'nil', '3', '2'
|
160
198
|
end
|
161
199
|
end
|
162
200
|
|
163
|
-
describe 'c-frames
|
164
|
-
before do
|
165
|
-
@tst_file = fullpath('frame')
|
166
|
-
enter 'break 5', 'cont'
|
167
|
-
end
|
168
|
-
|
201
|
+
describe 'c-frames' do
|
169
202
|
it 'must mark c-frames when printing the stack' do
|
203
|
+
enter "break #{__FILE__}:5", 'cont', 'where'
|
170
204
|
enter 'where'
|
171
205
|
debug_file 'frame'
|
172
|
-
check_output_includes
|
173
|
-
/--> #0 FrameExample.initialize\(f#String\)\s+at #{
|
174
|
-
/ͱ-- #1 Class.new\(\*args\)\s+at #{
|
175
|
-
/#2 <top \(required\)>\s+at #{
|
206
|
+
check_output_includes(
|
207
|
+
/--> #0 FrameExample.initialize\(f#String\)\s+at #{__FILE__}:5/,
|
208
|
+
/ͱ-- #1 Class.new\(\*args\)\s+at #{fullpath('frame')}:3/,
|
209
|
+
/#2 <top \(required\)>\s+at #{fullpath('frame')}:3/)
|
176
210
|
end
|
177
211
|
|
178
|
-
it '
|
179
|
-
enter 'up', 'eval
|
212
|
+
it '"up" skips c-frames' do
|
213
|
+
enter "break #{__FILE__}:9", 'cont', 'up', 'eval fr_ex.class.to_s'
|
180
214
|
debug_file 'frame'
|
181
|
-
check_output_includes '"
|
215
|
+
check_output_includes '"FrameExample"'
|
182
216
|
end
|
183
217
|
|
184
|
-
it '
|
185
|
-
enter 'up', 'down', 'eval f'
|
218
|
+
it '"down" skips c-frames' do
|
219
|
+
enter "break #{__FILE__}:9", 'cont', 'up', 'down', 'eval @f'
|
186
220
|
debug_file 'frame'
|
187
221
|
check_output_includes '"f"'
|
188
222
|
end
|
189
223
|
|
190
224
|
it 'must not jump straigh to c-frames' do
|
191
|
-
enter 'frame 1'
|
225
|
+
enter "break #{__FILE__}:5", 'cont', 'frame 1'
|
192
226
|
debug_file 'frame'
|
193
227
|
check_output_includes "Can't navigate to c-frame", interface.error_queue
|
194
228
|
end
|
195
229
|
end
|
196
|
-
|
197
230
|
end
|
data/test/info_test.rb
CHANGED
@@ -1,33 +1,61 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
+
class InfoExample
|
4
|
+
def initialize
|
5
|
+
@foo = "bar"
|
6
|
+
@bla = "blabla"
|
7
|
+
end
|
8
|
+
|
9
|
+
def a(y, z)
|
10
|
+
w = "1" * 30
|
11
|
+
x = 2
|
12
|
+
w + x.to_s + y + z + @foo
|
13
|
+
end
|
14
|
+
|
15
|
+
def c
|
16
|
+
a = BasicObject.new
|
17
|
+
a
|
18
|
+
end
|
19
|
+
|
20
|
+
def b
|
21
|
+
a('a', 'b')
|
22
|
+
e = "%.2f"
|
23
|
+
e
|
24
|
+
end
|
25
|
+
|
26
|
+
def d
|
27
|
+
raise "bang"
|
28
|
+
rescue
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
3
33
|
class TestInfo < TestDsl::TestCase
|
4
34
|
include Columnize
|
5
35
|
|
6
36
|
describe 'Args info' do
|
7
|
-
temporary_change_hash Byebug.settings, :width, 15
|
8
|
-
|
9
37
|
it 'must show info about all args' do
|
10
|
-
enter
|
38
|
+
enter "break #{__FILE__}:12", 'cont', 'info args'
|
11
39
|
debug_file 'info'
|
12
|
-
check_output_includes '
|
40
|
+
check_output_includes 'y = "a"', 'z = "b"'
|
13
41
|
end
|
14
42
|
end
|
15
43
|
|
16
44
|
describe 'Breakpoints info' do
|
17
45
|
it 'must show info about all breakpoints' do
|
18
|
-
enter 'break
|
46
|
+
enter 'break 4', 'break 5 if y == z', 'info breakpoints'
|
19
47
|
debug_file 'info'
|
20
48
|
check_output_includes 'Num Enb What',
|
21
|
-
/\d+ +y at #{fullpath('info')}:
|
22
|
-
/\d+ +y at #{fullpath('info')}:
|
49
|
+
/\d+ +y at #{fullpath('info')}:4/,
|
50
|
+
/\d+ +y at #{fullpath('info')}:5 if y == z/
|
23
51
|
end
|
24
52
|
|
25
53
|
it 'must show info about specific breakpoint' do
|
26
|
-
enter 'break
|
54
|
+
enter 'break 4', 'break 5',
|
27
55
|
->{ "info breakpoints #{Byebug.breakpoints.first.id}" }
|
28
56
|
debug_file 'info'
|
29
|
-
check_output_includes 'Num Enb What', /\d+ +y at #{fullpath('info')}:
|
30
|
-
check_output_doesnt_include
|
57
|
+
check_output_includes 'Num Enb What', /\d+ +y at #{fullpath('info')}:4/
|
58
|
+
check_output_doesnt_include(/\d+ +y at #{fullpath('info')}:5/)
|
31
59
|
end
|
32
60
|
|
33
61
|
it 'must show an error if no breakpoints are found' do
|
@@ -37,16 +65,16 @@ class TestInfo < TestDsl::TestCase
|
|
37
65
|
end
|
38
66
|
|
39
67
|
it 'must show an error if no breakpoints are found' do
|
40
|
-
enter 'break
|
68
|
+
enter 'break 4', 'info breakpoints 123'
|
41
69
|
debug_file 'info'
|
42
70
|
check_error_includes 'No breakpoints found among list given.'
|
43
71
|
end
|
44
72
|
|
45
73
|
it 'must show hit count' do
|
46
|
-
enter 'break
|
74
|
+
enter 'break 5', 'cont', 'info breakpoints'
|
47
75
|
debug_file 'info'
|
48
|
-
check_output_includes
|
49
|
-
/\d+ +y at #{fullpath('info')}:
|
76
|
+
check_output_includes(
|
77
|
+
/\d+ +y at #{fullpath('info')}:5/, 'breakpoint already hit 1 time')
|
50
78
|
end
|
51
79
|
end
|
52
80
|
|
@@ -68,7 +96,7 @@ class TestInfo < TestDsl::TestCase
|
|
68
96
|
end
|
69
97
|
|
70
98
|
describe 'Files info' do
|
71
|
-
let(:files) {
|
99
|
+
let(:files) { SCRIPT_LINES__.keys.uniq.sort }
|
72
100
|
|
73
101
|
it 'must show all files read in' do
|
74
102
|
enter 'info files'
|
@@ -129,12 +157,12 @@ class TestInfo < TestDsl::TestCase
|
|
129
157
|
end
|
130
158
|
|
131
159
|
it 'must show breakpoints in the file' do
|
132
|
-
enter 'break
|
160
|
+
enter 'break 4', 'break 5', "info file #{file} breakpoints"
|
133
161
|
debug_file 'info'
|
134
|
-
check_output_includes
|
135
|
-
/Created breakpoint \d+ at #{file}:
|
162
|
+
check_output_includes(/Created breakpoint \d+ at #{file}:4/,
|
163
|
+
/Created breakpoint \d+ at #{file}:5/,
|
136
164
|
filename,
|
137
|
-
'breakpoint line numbers:', breakpoint_line_numbers
|
165
|
+
'breakpoint line numbers:', breakpoint_line_numbers)
|
138
166
|
check_output_doesnt_include lines, mtime, sha1
|
139
167
|
end
|
140
168
|
|
@@ -145,12 +173,6 @@ class TestInfo < TestDsl::TestCase
|
|
145
173
|
filename, lines, breakpoint_line_numbers, mtime, sha1
|
146
174
|
end
|
147
175
|
|
148
|
-
it 'must not show info about the file if the file is not loaded' do
|
149
|
-
enter "info file #{fullpath('info2')} basic"
|
150
|
-
debug_file 'info'
|
151
|
-
check_output_includes "File #{fullpath('info2')} is not cached"
|
152
|
-
end
|
153
|
-
|
154
176
|
it 'must not show any info if the parameter is invalid' do
|
155
177
|
enter "info file #{file} blabla"
|
156
178
|
debug_file 'info'
|
@@ -160,7 +182,7 @@ class TestInfo < TestDsl::TestCase
|
|
160
182
|
|
161
183
|
describe 'Instance variables info' do
|
162
184
|
it 'must show instance variables' do
|
163
|
-
enter
|
185
|
+
enter "break #{__FILE__}:12", 'cont', 'info instance_variables'
|
164
186
|
debug_file 'info'
|
165
187
|
check_output_includes '@bla = "blabla"', '@foo = "bar"'
|
166
188
|
end
|
@@ -168,9 +190,9 @@ class TestInfo < TestDsl::TestCase
|
|
168
190
|
|
169
191
|
describe 'Line info' do
|
170
192
|
it 'must show the current line' do
|
171
|
-
enter
|
193
|
+
enter "break #{__FILE__}:12", 'cont', 'info line'
|
172
194
|
debug_file 'info'
|
173
|
-
check_output_includes "Line
|
195
|
+
check_output_includes "Line 12 of \"#{__FILE__}\""
|
174
196
|
end
|
175
197
|
end
|
176
198
|
|
@@ -178,13 +200,13 @@ class TestInfo < TestDsl::TestCase
|
|
178
200
|
temporary_change_hash Byebug.settings, :width, 28
|
179
201
|
|
180
202
|
it 'must show the current local variables' do
|
181
|
-
enter
|
203
|
+
enter "break #{__FILE__}:12", 'cont', 'info locals'
|
182
204
|
debug_file 'info'
|
183
|
-
check_output_includes '
|
205
|
+
check_output_includes 'w = "11111111111111111111...', 'x = 2'
|
184
206
|
end
|
185
207
|
|
186
208
|
it 'must fail if local variable doesn\'t respond to #to_s or to #inspect' do
|
187
|
-
enter
|
209
|
+
enter "break #{__FILE__}:17", 'cont', 'info locals'
|
188
210
|
debug_file 'info'
|
189
211
|
check_output_includes 'a = *Error in evaluation*'
|
190
212
|
end
|
@@ -207,17 +229,19 @@ class TestInfo < TestDsl::TestCase
|
|
207
229
|
end
|
208
230
|
|
209
231
|
it 'must show the breakpoint stop reason' do
|
210
|
-
enter 'break
|
232
|
+
enter 'break 4', 'cont', 'info program'
|
211
233
|
debug_file 'info'
|
212
234
|
check_output_includes 'Program stopped.', 'It stopped at a breakpoint.'
|
213
235
|
end
|
214
236
|
|
215
237
|
it 'must show the catchpoint stop reason' do
|
216
|
-
|
238
|
+
enter 'catch Exception', 'cont', 'info program'
|
239
|
+
debug_file 'info'
|
240
|
+
check_output_includes 'Program stopped.', 'It stopped at a catchpoint.'
|
217
241
|
end
|
218
242
|
|
219
243
|
it 'must show the unknown stop reason' do
|
220
|
-
enter 'break
|
244
|
+
enter 'break 5', 'cont',
|
221
245
|
->{ context.stubs(:stop_reason).returns('blabla'); 'info program' }
|
222
246
|
debug_file 'info'
|
223
247
|
check_output_includes 'Program stopped.', 'unknown reason: blabla'
|
@@ -230,11 +254,12 @@ class TestInfo < TestDsl::TestCase
|
|
230
254
|
|
231
255
|
describe 'Stack info' do
|
232
256
|
it 'must show stack info' do
|
233
|
-
enter 'set fullpath',
|
257
|
+
enter 'set fullpath', "break #{__FILE__}:10", 'cont', 'info stack'
|
234
258
|
debug_file 'info'
|
235
|
-
check_output_includes
|
236
|
-
|
237
|
-
|
259
|
+
check_output_includes(
|
260
|
+
/--> #0 InfoExample.a\(y\#String, z\#String\)\s+at #{__FILE__}:10/,
|
261
|
+
/#1 InfoExample.b\s+at #{__FILE__}:21/,
|
262
|
+
/#2 <top \(required\)>\s+at #{fullpath('info')}:4/)
|
238
263
|
end
|
239
264
|
end
|
240
265
|
|
@@ -250,17 +275,17 @@ class TestInfo < TestDsl::TestCase
|
|
250
275
|
temporary_change_hash Byebug.settings, :width, 30
|
251
276
|
|
252
277
|
it 'must show all variables' do
|
253
|
-
enter
|
278
|
+
enter "break #{__FILE__}:12", 'cont', 'info variables'
|
254
279
|
debug_file 'info'
|
255
|
-
check_output_includes
|
256
|
-
'
|
257
|
-
|
280
|
+
check_output_includes(/self = #<InfoExample:\S+.../,
|
281
|
+
'w = "1111111111111111111111...',
|
282
|
+
'x = 2',
|
258
283
|
'@bla = "blabla"',
|
259
|
-
'@foo = "bar"'
|
284
|
+
'@foo = "bar"')
|
260
285
|
end
|
261
286
|
|
262
287
|
it 'must fail if the variable doesn\'t respond to #to_s or to #inspect' do
|
263
|
-
enter
|
288
|
+
enter "break #{__FILE__}:17", 'cont', 'info variables'
|
264
289
|
debug_file 'info'
|
265
290
|
check_output_includes 'a = *Error in evaluation*',
|
266
291
|
/self = #<InfoExample:\S+.../,
|
@@ -269,7 +294,7 @@ class TestInfo < TestDsl::TestCase
|
|
269
294
|
end
|
270
295
|
|
271
296
|
it 'must correctly print variables containing % sign' do
|
272
|
-
enter
|
297
|
+
enter "break #{__FILE__}:23", 'cont', 'info variables'
|
273
298
|
debug_file 'info'
|
274
299
|
check_output_includes 'e = "%.2f"'
|
275
300
|
end
|
@@ -279,7 +304,7 @@ class TestInfo < TestDsl::TestCase
|
|
279
304
|
it 'must show help when typing just "info"' do
|
280
305
|
enter 'info', 'cont'
|
281
306
|
debug_file 'info'
|
282
|
-
check_output_includes
|
307
|
+
check_output_includes(/List of "info" subcommands:/)
|
283
308
|
end
|
284
309
|
end
|
285
310
|
end
|