byebug 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -11
- data/Rakefile +0 -6
- data/bin/byebug +83 -136
- data/ext/byebug/byebug.c +182 -96
- data/ext/byebug/byebug.h +5 -7
- data/ext/byebug/context.c +52 -40
- data/lib/byebug.rb +81 -81
- data/lib/byebug/command.rb +18 -35
- data/lib/byebug/commands/control.rb +1 -1
- data/lib/byebug/commands/display.rb +0 -2
- data/lib/byebug/commands/enable.rb +4 -16
- data/lib/byebug/commands/eval.rb +5 -3
- data/lib/byebug/commands/frame.rb +68 -69
- data/lib/byebug/commands/help.rb +2 -1
- data/lib/byebug/commands/info.rb +43 -42
- data/lib/byebug/commands/method.rb +4 -3
- data/lib/byebug/commands/set.rb +10 -19
- data/lib/byebug/commands/show.rb +6 -13
- data/lib/byebug/interface.rb +1 -1
- data/lib/byebug/processor.rb +14 -17
- data/lib/byebug/version.rb +1 -2
- data/old_doc/byebug.texi +576 -847
- data/test/breakpoints_test.rb +0 -1
- data/test/conditions_test.rb +35 -33
- data/test/display_test.rb +14 -13
- data/test/edit_test.rb +28 -25
- data/test/eval_test.rb +0 -2
- data/test/finish_test.rb +4 -3
- data/test/frame_test.rb +20 -21
- data/test/help_test.rb +26 -23
- data/test/info_test.rb +105 -108
- data/test/irb_test.rb +26 -25
- data/test/kill_test.rb +19 -19
- data/test/list_test.rb +140 -156
- data/test/method_test.rb +21 -22
- data/test/post_mortem_test.rb +2 -5
- data/test/quit_test.rb +16 -17
- data/test/reload_test.rb +2 -2
- data/test/restart_test.rb +0 -1
- data/test/save_test.rb +31 -32
- data/test/set_test.rb +50 -47
- data/test/show_test.rb +67 -66
- data/test/source_test.rb +31 -34
- data/test/stepping_test.rb +32 -34
- data/test/support/test_dsl.rb +1 -1
- data/test/trace_test.rb +1 -2
- data/test/variables_test.rb +36 -34
- metadata +2 -4
- data/lib/byebug/commands/tmate.rb +0 -36
- data/test/tmate_test.rb +0 -44
data/test/kill_test.rb
CHANGED
@@ -1,48 +1,48 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Kill Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
it
|
7
|
-
Process.expects(:kill).with(
|
6
|
+
it 'must send signal to some pid' do
|
7
|
+
Process.expects(:kill).with('USR1', Process.pid)
|
8
8
|
enter 'kill USR1'
|
9
9
|
debug_file('kill')
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
Process.stubs(:kill).with(
|
12
|
+
it 'must finalize interface when sending KILL signal explicitly' do
|
13
|
+
Process.stubs(:kill).with('KILL', Process.pid)
|
14
14
|
interface.expects(:finalize)
|
15
15
|
enter 'kill KILL'
|
16
16
|
debug_file('kill')
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
Process.expects(:kill).with(
|
19
|
+
it 'must ask confirmation when sending KILL implicitly' do
|
20
|
+
Process.expects(:kill).with('KILL', Process.pid)
|
21
21
|
enter 'kill', 'y'
|
22
22
|
debug_file('kill')
|
23
|
-
check_output_includes
|
23
|
+
check_output_includes 'Really kill? (y/n)', interface.confirm_queue
|
24
24
|
end
|
25
25
|
|
26
|
-
describe
|
27
|
-
it
|
28
|
-
Process.expects(:kill).with(
|
26
|
+
describe 'unknown signal' do
|
27
|
+
it 'must not send the signal' do
|
28
|
+
Process.expects(:kill).with('BLA', Process.pid).never
|
29
29
|
enter 'kill BLA'
|
30
30
|
debug_file('kill')
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it 'must show an error' do
|
34
34
|
enter 'kill BLA'
|
35
35
|
debug_file('kill')
|
36
|
-
check_output_includes
|
36
|
+
check_output_includes \
|
37
|
+
'signal name BLA is not a signal I know about', interface.error_queue
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
describe
|
41
|
-
it
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
#debug_file "post_mortem"
|
41
|
+
describe 'Post Mortem' do
|
42
|
+
it 'must work in post-mortem mode' do
|
43
|
+
Process.expects(:kill).with('USR1', Process.pid)
|
44
|
+
enter 'cont', 'kill USR1'
|
45
|
+
debug_file 'post_mortem'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/test/list_test.rb
CHANGED
@@ -3,196 +3,180 @@ require_relative 'test_helper'
|
|
3
3
|
describe 'List Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
before do
|
12
|
-
Byebug::Command.settings[:listsize] = 3
|
13
|
-
Byebug::Command.settings[:autolist] = 0
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'must show lines according to :listsize setting' do
|
17
|
-
enter 'set listsize 4', 'break 5', 'cont', 'list'
|
18
|
-
debug_file 'list'
|
19
|
-
check_output_includes "[3, 6] in #{fullpath('list')}"
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'must not set it if the param is not an integer' do
|
23
|
-
enter 'set listsize 4.0', 'break 5', 'cont', 'list'
|
24
|
-
debug_file 'list'
|
25
|
-
check_output_includes "[4, 6] in #{fullpath('list')}"
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'must move range up when it goes before begining of file' do
|
29
|
-
enter 'set listsize 10', 'break 3', 'cont', 'list'
|
30
|
-
debug_file 'list'
|
31
|
-
check_output_includes "[1, 10] in #{fullpath('list')}"
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'must move range down when it goes after end of file' do
|
35
|
-
enter 'set listsize 10', 'break 10', 'cont', 'list'
|
36
|
-
debug_file 'list'
|
37
|
-
check_output_includes "[3, 12] in #{fullpath('list')}"
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'must list whole file if number of lines is smaller than listsize' do
|
41
|
-
enter 'set listsize 13', 'list'
|
42
|
-
debug_file 'list'
|
43
|
-
check_output_includes "[1, 12] in #{fullpath('list')}"
|
44
|
-
end
|
6
|
+
def after_setup
|
7
|
+
LineCache.clear_file_cache
|
8
|
+
Byebug::Command.settings[:listsize] = 3
|
9
|
+
Byebug::Command.settings[:autolist] = 0
|
10
|
+
end
|
45
11
|
|
12
|
+
describe 'listsize' do
|
13
|
+
it 'must show lines according to :listsize setting' do
|
14
|
+
enter 'set listsize 4', 'break 5', 'cont', 'list'
|
15
|
+
debug_file 'list'
|
16
|
+
check_output_includes "[3, 6] in #{fullpath('list')}"
|
46
17
|
end
|
47
18
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
enter 'break 5', 'cont', 'list'
|
53
|
-
debug_file 'list'
|
54
|
-
check_output_includes \
|
55
|
-
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'must list forward after second call' do
|
59
|
-
enter 'break 5', 'cont', 'list', 'list'
|
60
|
-
debug_file 'list'
|
61
|
-
check_output_includes \
|
62
|
-
"[7, 9] in #{fullpath('list')}", '7 7', '8 8', '9 9'
|
63
|
-
end
|
19
|
+
it 'must not set it if the param is not an integer' do
|
20
|
+
enter 'set listsize 4.0', 'break 5', 'cont', 'list'
|
21
|
+
debug_file 'list'
|
22
|
+
check_output_includes "[4, 6] in #{fullpath('list')}"
|
64
23
|
end
|
65
24
|
|
66
|
-
|
67
|
-
|
25
|
+
it 'must move range up when it goes before begining of file' do
|
26
|
+
enter 'set listsize 10', 'break 3', 'cont', 'list'
|
27
|
+
debug_file 'list'
|
28
|
+
check_output_includes "[1, 10] in #{fullpath('list')}"
|
29
|
+
end
|
68
30
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
31
|
+
it 'must move range down when it goes after end of file' do
|
32
|
+
enter 'set listsize 10', 'break 10', 'cont', 'list'
|
33
|
+
debug_file 'list'
|
34
|
+
check_output_includes "[3, 12] in #{fullpath('list')}"
|
35
|
+
end
|
75
36
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
"[1, 3] in #{fullpath('list')}", '1 byebug', '2 2', '3 3'
|
81
|
-
end
|
37
|
+
it 'must list whole file if number of lines is smaller than listsize' do
|
38
|
+
enter 'set listsize 13', 'list'
|
39
|
+
debug_file 'list'
|
40
|
+
check_output_includes "[1, 12] in #{fullpath('list')}"
|
82
41
|
end
|
83
42
|
|
43
|
+
end
|
84
44
|
|
85
|
-
|
86
|
-
|
45
|
+
describe 'without arguments' do
|
46
|
+
it 'must show surrounding lines with the first call' do
|
47
|
+
enter 'break 5', 'cont', 'list'
|
48
|
+
debug_file 'list'
|
49
|
+
check_output_includes \
|
50
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
51
|
+
end
|
87
52
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
53
|
+
it 'must list forward after second call' do
|
54
|
+
enter 'break 5', 'cont', 'list', 'list'
|
55
|
+
debug_file 'list'
|
56
|
+
check_output_includes \
|
57
|
+
"[7, 9] in #{fullpath('list')}", '7 7', '8 8', '9 9'
|
94
58
|
end
|
59
|
+
end
|
95
60
|
|
96
|
-
|
97
|
-
|
61
|
+
describe 'list backward' do
|
62
|
+
it 'must show surrounding lines with the first call' do
|
63
|
+
enter 'break 5', 'cont', 'list -'
|
64
|
+
debug_file 'list'
|
65
|
+
check_output_includes \
|
66
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
67
|
+
end
|
98
68
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
69
|
+
it 'must list backward after second call' do
|
70
|
+
enter 'break 5', 'cont', 'list -', 'list -'
|
71
|
+
debug_file 'list'
|
72
|
+
check_output_includes \
|
73
|
+
"[1, 3] in #{fullpath('list')}", '1 byebug', '2 2', '3 3'
|
105
74
|
end
|
75
|
+
end
|
106
76
|
|
107
|
-
describe 'specified lines' do
|
108
|
-
before { Byebug::Command.settings[:listsize] = 3 }
|
109
77
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
78
|
+
describe 'list surrounding' do
|
79
|
+
it 'must show the surrounding lines with =' do
|
80
|
+
enter 'break 5', 'cont', 'list ='
|
81
|
+
debug_file 'list'
|
82
|
+
check_output_includes \
|
83
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
84
|
+
end
|
85
|
+
end
|
116
86
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
87
|
+
describe 'autolist' do
|
88
|
+
it 'must show the surronding lines after stop if autolist is enabled' do
|
89
|
+
enter 'set autolist', 'break 5', 'cont'
|
90
|
+
debug_file 'list'
|
91
|
+
check_output_includes \
|
92
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
93
|
+
end
|
94
|
+
end
|
123
95
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
96
|
+
describe 'specified lines' do
|
97
|
+
it 'must show with mm-nn' do
|
98
|
+
enter 'list 4-6'
|
99
|
+
debug_file 'list'
|
100
|
+
check_output_includes \
|
101
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '5 5', '6 6'
|
102
|
+
end
|
130
103
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
104
|
+
it 'must show with mm,nn' do
|
105
|
+
enter 'list 4,6'
|
106
|
+
debug_file 'list'
|
107
|
+
check_output_includes \
|
108
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '5 5', '6 6'
|
109
|
+
end
|
137
110
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
111
|
+
it 'must show surroundings with mm-' do
|
112
|
+
enter 'list 4-'
|
113
|
+
debug_file 'list'
|
114
|
+
check_output_includes \
|
115
|
+
"[3, 5] in #{fullpath('list')}", '3 3', '4 4', '5 5'
|
116
|
+
end
|
145
117
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
check_output_doesnt_include '4 4'
|
152
|
-
end
|
118
|
+
it 'must show surroundings with mm,' do
|
119
|
+
enter 'list 4,'
|
120
|
+
debug_file 'list'
|
121
|
+
check_output_includes \
|
122
|
+
"[3, 5] in #{fullpath('list')}", '3 3', '4 4', '5 5'
|
153
123
|
end
|
154
124
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
125
|
+
it 'must show nothing if there is no such lines' do
|
126
|
+
enter 'list 44,44'
|
127
|
+
debug_file 'list'
|
128
|
+
check_error_includes 'Invalid line range'
|
129
|
+
check_output_doesnt_include "[44, 44] in #{fullpath('list')}"
|
130
|
+
check_output_doesnt_include /^44 \S/
|
131
|
+
end
|
160
132
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
133
|
+
it 'must show nothing if range is incorrect' do
|
134
|
+
enter 'list 5,4'
|
135
|
+
debug_file 'list'
|
136
|
+
check_output_includes "[5, 4] in #{fullpath('list')}"
|
137
|
+
check_output_doesnt_include '5 5'
|
138
|
+
check_output_doesnt_include '4 4'
|
139
|
+
end
|
140
|
+
end
|
169
141
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
end
|
175
|
-
debug_file 'list'
|
176
|
-
check_output_includes '4 100'
|
177
|
-
end
|
142
|
+
describe 'reload source' do
|
143
|
+
after do
|
144
|
+
change_line_in_file(fullpath('list'), 4, '4')
|
145
|
+
Byebug::Command.settings[:reload_source_on_change] = true
|
178
146
|
end
|
179
147
|
|
180
|
-
it 'must
|
181
|
-
enter
|
148
|
+
it 'must not reload if setting is false' do
|
149
|
+
enter 'set noautoreload', -> do
|
150
|
+
change_line_in_file(fullpath('list'), 4, '100')
|
151
|
+
'list 4-4'
|
152
|
+
end
|
182
153
|
debug_file 'list'
|
183
|
-
check_output_includes '
|
184
|
-
interface.error_queue
|
154
|
+
check_output_includes '4 4'
|
185
155
|
end
|
186
156
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
debug_file 'post_mortem'
|
192
|
-
check_output_includes "[7, 9] in #{fullpath('post_mortem')}"
|
157
|
+
it 'must reload if setting is true' do
|
158
|
+
enter 'set autoreload', -> do
|
159
|
+
change_line_in_file(fullpath('list'), 4, '100')
|
160
|
+
'list 4-4'
|
193
161
|
end
|
162
|
+
debug_file 'list'
|
163
|
+
check_output_includes '4 100'
|
194
164
|
end
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'must show an error when there is no such file' do
|
168
|
+
enter ->{state.file = 'blabla'; 'list 4-4'}
|
169
|
+
debug_file 'list'
|
170
|
+
check_output_includes 'No sourcefile available for blabla',
|
171
|
+
interface.error_queue
|
172
|
+
end
|
195
173
|
|
174
|
+
describe 'Post Mortem' do
|
175
|
+
it 'must work in post-mortem mode' do
|
176
|
+
enter 'cont', 'list'
|
177
|
+
debug_file 'post_mortem'
|
178
|
+
check_output_includes "[7, 9] in #{fullpath('post_mortem')}"
|
179
|
+
end
|
196
180
|
end
|
197
181
|
|
198
182
|
end
|
data/test/method_test.rb
CHANGED
@@ -1,71 +1,70 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Method Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
# TODO: Need to write tests for 'method signature' command, but I can't
|
7
|
-
# install the 'ruby-internal' gem on my machine, it fails to build gem native
|
8
|
-
# extension.
|
9
|
-
|
10
6
|
def after_setup
|
11
7
|
Byebug::Command.settings[:autolist] = 0
|
12
8
|
end
|
13
9
|
|
14
|
-
describe
|
15
|
-
it
|
16
|
-
enter 'break 15', 'cont', '
|
10
|
+
describe 'show instance method of a class' do
|
11
|
+
it 'must show using full command name' do
|
12
|
+
enter 'break 15', 'cont', 'method MethodEx'
|
17
13
|
debug_file 'method'
|
18
14
|
check_output_includes /bla/
|
19
15
|
check_output_doesnt_include /foo/
|
20
16
|
end
|
21
17
|
|
22
|
-
it
|
23
|
-
enter 'break 15', 'cont', '
|
18
|
+
it 'must show using shortcut' do
|
19
|
+
enter 'break 15', 'cont', 'm MethodEx'
|
24
20
|
debug_file 'method'
|
25
21
|
check_output_includes /bla/
|
26
22
|
end
|
27
23
|
|
28
|
-
it
|
24
|
+
it 'must show an error if specified object is not a class or module' do
|
29
25
|
enter 'break 15', 'cont', 'm a'
|
30
26
|
debug_file 'method'
|
31
|
-
check_output_includes
|
27
|
+
check_output_includes 'Should be Class/Module: a'
|
32
28
|
end
|
33
29
|
end
|
34
30
|
|
35
|
-
|
36
|
-
|
37
|
-
it "must show using full command name" do
|
31
|
+
describe 'show methods of an object' do
|
32
|
+
it 'must show using full command name' do
|
38
33
|
enter 'break 15', 'cont', 'method instance a'
|
39
34
|
debug_file 'method'
|
40
35
|
check_output_includes /bla/
|
41
36
|
check_output_doesnt_include /foo/
|
42
37
|
end
|
43
38
|
|
44
|
-
it
|
39
|
+
it 'must show using shortcut' do
|
45
40
|
enter 'break 15', 'cont', 'm i a'
|
46
41
|
debug_file 'method'
|
47
42
|
check_output_includes /bla/
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
46
|
+
describe 'show signature of a method' do
|
47
|
+
it 'must work' do
|
48
|
+
skip('TODO, can\'t install ruby-internal gem')
|
49
|
+
end
|
50
|
+
end
|
51
51
|
|
52
|
-
describe
|
53
|
-
it
|
52
|
+
describe 'show instance variables of an object' do
|
53
|
+
it 'must show using full name command' do
|
54
54
|
enter 'break 15', 'cont', 'method iv a'
|
55
55
|
debug_file 'method'
|
56
56
|
check_output_includes '@a = "b"', '@c = "d"'
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
59
|
+
it 'must show using shortcut' do
|
60
60
|
enter 'break 15', 'cont', 'm iv a'
|
61
61
|
debug_file 'method'
|
62
62
|
check_output_includes '@a = "b"', '@c = "d"'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
describe
|
67
|
-
it
|
68
|
-
skip("No post morten mode for now")
|
66
|
+
describe 'Post Mortem' do
|
67
|
+
it 'must work in post-mortem mode' do
|
69
68
|
enter 'cont', 'm i self'
|
70
69
|
debug_file 'post_mortem'
|
71
70
|
check_output_includes /to_s/
|