byebug 2.7.0 → 3.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 +2 -6
- data/.travis.yml +1 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile +9 -0
- data/README.md +35 -32
- data/Rakefile +1 -3
- data/byebug.gemspec +0 -6
- data/ext/byebug/byebug.c +64 -51
- data/ext/byebug/byebug.h +12 -13
- data/ext/byebug/context.c +28 -43
- data/ext/byebug/extconf.rb +6 -6
- data/lib/byebug.rb +34 -38
- data/lib/byebug/command.rb +4 -2
- data/lib/byebug/commands/continue.rb +0 -1
- data/lib/byebug/commands/control.rb +0 -1
- data/lib/byebug/commands/edit.rb +1 -1
- data/lib/byebug/commands/finish.rb +10 -16
- data/lib/byebug/commands/help.rb +1 -1
- data/lib/byebug/commands/kill.rb +1 -1
- data/lib/byebug/commands/quit.rb +1 -1
- data/lib/byebug/commands/repl.rb +3 -3
- data/lib/byebug/commands/set.rb +24 -39
- data/lib/byebug/commands/show.rb +39 -112
- data/lib/byebug/commands/stepping.rb +0 -2
- data/lib/byebug/commands/threads.rb +0 -5
- data/lib/byebug/commands/trace.rb +1 -1
- data/lib/byebug/commands/variables.rb +1 -1
- data/lib/byebug/context.rb +8 -12
- data/lib/byebug/helper.rb +1 -1
- data/lib/byebug/history.rb +46 -0
- data/lib/byebug/interface.rb +5 -5
- data/lib/byebug/interfaces/local_interface.rb +11 -62
- data/lib/byebug/interfaces/remote_interface.rb +6 -22
- data/lib/byebug/interfaces/script_interface.rb +2 -17
- data/lib/byebug/processor.rb +4 -4
- data/lib/byebug/{command_processor.rb → processors/command_processor.rb} +7 -14
- data/lib/byebug/{control_command_processor.rb → processors/control_command_processor.rb} +3 -7
- data/lib/byebug/version.rb +1 -1
- data/test/edit_test.rb +6 -6
- data/test/examples/breakpoint_deep.rb +1 -1
- data/test/finish_test.rb +6 -6
- data/test/help_test.rb +1 -1
- data/test/info_test.rb +0 -1
- data/test/kill_test.rb +2 -2
- data/test/post_mortem_test.rb +35 -219
- data/test/quit_test.rb +2 -2
- data/test/restart_test.rb +12 -33
- data/test/set_test.rb +80 -107
- data/test/show_test.rb +42 -77
- data/test/stepping_test.rb +1 -1
- data/test/support/test_dsl.rb +4 -25
- data/test/support/test_interface.rb +40 -48
- data/test/test_helper.rb +1 -3
- data/test/timeout_test.rb +9 -0
- metadata +8 -75
data/test/quit_test.rb
CHANGED
@@ -27,9 +27,9 @@ class TestQuit < TestDsl::TestCase
|
|
27
27
|
check_output_doesnt_include 'Really quit? (y/n)', interface.confirm_queue
|
28
28
|
end
|
29
29
|
|
30
|
-
it 'must
|
30
|
+
it 'must close interface before quitting' do
|
31
31
|
Byebug::QuitCommand.any_instance.stubs(:exit!)
|
32
|
-
interface.expects(:
|
32
|
+
interface.expects(:close)
|
33
33
|
enter 'quit!'
|
34
34
|
debug_file 'quit'
|
35
35
|
end
|
data/test/restart_test.rb
CHANGED
@@ -60,47 +60,26 @@ class TestRestart < TestDsl::TestCase
|
|
60
60
|
describe 'no script specified' do
|
61
61
|
temporary_change_const Byebug, 'PROG_SCRIPT', :__undefined__
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
it 'must not restart and show error messages instead' do
|
68
|
-
must_restart.never
|
69
|
-
debug_file 'restart'
|
70
|
-
check_output_includes 'Don\'t know name of debugged program',
|
71
|
-
interface.error_queue
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe 'but initialized from $0' do
|
76
|
-
it 'must use prog_script from $0' do
|
77
|
-
old_prog_name = $0
|
78
|
-
$0 = 'prog-0'
|
79
|
-
debug_file 'restart'
|
80
|
-
check_output_includes 'Ruby program prog-0 doesn\'t exist',
|
63
|
+
it 'must not restart and show error messages instead' do
|
64
|
+
must_restart.never
|
65
|
+
debug_file 'restart'
|
66
|
+
check_output_includes 'Don\'t know name of debugged program',
|
81
67
|
interface.error_queue
|
82
|
-
$0 = old_prog_name
|
83
|
-
end
|
84
68
|
end
|
85
69
|
end
|
86
70
|
|
87
71
|
describe 'no script at the specified path' do
|
88
72
|
temporary_change_const Byebug, 'PROG_SCRIPT', 'blabla'
|
89
73
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
it 'must not restart' do
|
95
|
-
must_restart.never
|
96
|
-
debug_file 'restart'
|
97
|
-
end
|
74
|
+
it 'must not restart' do
|
75
|
+
must_restart.never
|
76
|
+
debug_file 'restart'
|
77
|
+
end
|
98
78
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
end
|
79
|
+
it 'must show an error message' do
|
80
|
+
debug_file 'restart'
|
81
|
+
check_output_includes 'Ruby program blabla doesn\'t exist',
|
82
|
+
interface.error_queue
|
104
83
|
end
|
105
84
|
end
|
106
85
|
|
data/test/set_test.rb
CHANGED
@@ -1,58 +1,64 @@
|
|
1
1
|
class TestSet < TestDsl::TestCase
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
[:autoeval, :autoreload, :autosave, :basename, :forcestep, :fullpath,
|
4
|
+
:linetrace_plus, :stack_on_error].each do |setting|
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
debug_file 'set'
|
9
|
-
Byebug.settings[:autolist].must_equal 1
|
10
|
-
end
|
6
|
+
describe "setting #{setting} to on" do
|
7
|
+
temporary_change_hash Byebug.settings, setting, false
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
it "must set #{setting} to on using on" do
|
10
|
+
enter "set #{setting} on"
|
11
|
+
debug_file 'set'
|
12
|
+
Byebug.settings[setting].must_equal true
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
it "must set #{setting} to on using 1" do
|
16
|
+
enter "set #{setting} 1"
|
17
|
+
debug_file 'set'
|
18
|
+
Byebug.settings[setting].must_equal true
|
19
|
+
end
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
it "must set #{setting} to on by default" do
|
22
|
+
enter "set #{setting}"
|
23
|
+
debug_file 'set'
|
24
|
+
Byebug.settings[setting].must_equal true
|
25
|
+
end
|
26
|
+
|
27
|
+
it "must set #{setting} using shortcut" do
|
28
|
+
skip 'it for now until I make it work'
|
29
|
+
enter "set autol"
|
30
|
+
debug_file 'set'
|
31
|
+
Byebug.settings[setting].must_equal 1
|
32
|
+
end
|
28
33
|
end
|
29
|
-
end
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
describe "setting #{setting} to off" do
|
36
|
+
temporary_change_hash Byebug.settings, setting, true
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
it "must set #{setting} to off using off" do
|
39
|
+
enter "set #{setting} off"
|
40
|
+
debug_file 'set'
|
41
|
+
Byebug.settings[setting].must_equal false
|
42
|
+
end
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
it "must set #{setting} to on using 0" do
|
45
|
+
enter "set #{setting} 0"
|
46
|
+
debug_file 'set'
|
47
|
+
Byebug.settings[setting].must_equal false
|
48
|
+
end
|
45
49
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
it "must set #{setting} to off using 'no' prefix" do
|
51
|
+
enter "set no#{setting}"
|
52
|
+
debug_file 'set'
|
53
|
+
Byebug.settings[setting].must_equal false
|
54
|
+
end
|
51
55
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
it "must set #{setting} off using 'no' prefix and shortcut" do
|
57
|
+
skip 'it for now until I make it work'
|
58
|
+
enter 'set noautol'
|
59
|
+
debug_file 'set'
|
60
|
+
Byebug.settings[setting].must_equal 0
|
61
|
+
end
|
56
62
|
end
|
57
63
|
end
|
58
64
|
|
@@ -89,82 +95,49 @@ class TestSet < TestDsl::TestCase
|
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|
92
|
-
describe '
|
93
|
-
|
94
|
-
it 'must set history save to on' do
|
95
|
-
enter 'set history save on'
|
96
|
-
debug_file 'set'
|
97
|
-
interface.history_save.must_equal true
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'must set history save to on when no param' do
|
101
|
-
enter 'set history save'
|
102
|
-
debug_file 'set'
|
103
|
-
interface.history_save.must_equal true
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'must show a message' do
|
107
|
-
enter 'set history save on'
|
108
|
-
debug_file 'set'
|
109
|
-
check_output_includes 'Saving of history save is on.'
|
110
|
-
end
|
98
|
+
describe 'histsize' do
|
99
|
+
after { Byebug::History.max_size = Byebug::History::DEFAULT_MAX_SIZE }
|
111
100
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
101
|
+
it 'must set maximum history size' do
|
102
|
+
enter 'set histsize 250'
|
103
|
+
debug_file 'set'
|
104
|
+
Byebug::History.max_size.must_equal 250
|
117
105
|
end
|
118
106
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
interface.history_length.must_equal 250
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'must show a message' do
|
127
|
-
enter 'set history size 250'
|
128
|
-
debug_file 'set'
|
129
|
-
check_output_includes 'Byebug history size is 250'
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'must show an error message if no size provided' do
|
133
|
-
enter 'set history size'
|
134
|
-
debug_file 'set'
|
135
|
-
check_output_includes 'You need to specify the history size'
|
136
|
-
end
|
107
|
+
it 'must show a message' do
|
108
|
+
enter 'set histsize 250'
|
109
|
+
debug_file 'set'
|
110
|
+
check_output_includes "Byebug history's maximum size is 250"
|
137
111
|
end
|
138
112
|
|
139
|
-
|
140
|
-
|
141
|
-
|
113
|
+
it 'must show an error message if no size provided' do
|
114
|
+
enter 'set histsize'
|
115
|
+
debug_file 'set'
|
116
|
+
check_output_includes 'You need to specify the history size'
|
117
|
+
end
|
118
|
+
end
|
142
119
|
|
143
|
-
|
144
|
-
|
145
|
-
debug_file 'set'
|
146
|
-
interface.histfile.must_equal filename
|
147
|
-
end
|
120
|
+
describe 'histfile' do
|
121
|
+
let(:filename) { File.expand_path('./.custom-byebug-hist') }
|
148
122
|
|
149
|
-
|
150
|
-
enter 'set history filename .byebug-hist'
|
151
|
-
debug_file 'set'
|
152
|
-
check_output_includes "The command history file is \"#{filename}\""
|
153
|
-
end
|
123
|
+
after { Byebug::History.file = Byebug::History::DEFAULT_FILE }
|
154
124
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
125
|
+
it 'must set history filename' do
|
126
|
+
enter "set histfile #{filename}"
|
127
|
+
debug_file 'set'
|
128
|
+
Byebug::History.file.must_equal filename
|
129
|
+
end
|
160
130
|
|
131
|
+
it 'must show a message' do
|
132
|
+
enter "set histfile #{filename}"
|
133
|
+
debug_file 'set'
|
134
|
+
check_output_includes "The command history file is \"#{filename}\""
|
161
135
|
end
|
162
136
|
|
163
|
-
it 'must show an error message if
|
164
|
-
enter 'set
|
137
|
+
it 'must show an error message if no filename provided' do
|
138
|
+
enter 'set histfile'
|
165
139
|
debug_file 'set'
|
166
|
-
check_output_includes
|
167
|
-
'Invalid history parameter bla. Should be "filename", "save" or "size"'
|
140
|
+
check_output_includes 'You need to specify a filename'
|
168
141
|
end
|
169
142
|
end
|
170
143
|
|
data/test/show_test.rb
CHANGED
@@ -48,7 +48,7 @@ class TestShow < TestDsl::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
describe 'autoirb' do
|
51
|
-
before { Byebug::
|
51
|
+
before { Byebug::IrbCommand.any_instance.stubs(:execute) }
|
52
52
|
|
53
53
|
it 'must show default value' do
|
54
54
|
enter 'show autoirb'
|
@@ -135,7 +135,7 @@ class TestShow < TestDsl::TestCase
|
|
135
135
|
it 'must show default width' do
|
136
136
|
enter 'show width'
|
137
137
|
debug_file 'show'
|
138
|
-
check_output_includes "
|
138
|
+
check_output_includes "Width is #{cols}."
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -147,109 +147,74 @@ class TestShow < TestDsl::TestCase
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
describe '
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
debug_file 'show'
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'must show history file' do
|
161
|
-
check_output_includes(
|
162
|
-
/filename: The command history file is "hist_file\.txt"/)
|
163
|
-
end
|
150
|
+
describe 'autosave' do
|
151
|
+
it 'must show default value' do
|
152
|
+
enter 'show autosave'
|
153
|
+
debug_file 'show'
|
154
|
+
check_output_includes 'Saving history is on.'
|
155
|
+
end
|
156
|
+
end
|
164
157
|
|
165
|
-
|
166
|
-
|
167
|
-
end
|
158
|
+
describe 'histfile' do
|
159
|
+
before { @filename = Byebug::History::DEFAULT_FILE }
|
168
160
|
|
169
|
-
|
170
|
-
|
171
|
-
|
161
|
+
it 'must show history filename' do
|
162
|
+
enter 'show histfile'
|
163
|
+
debug_file 'show'
|
164
|
+
check_output_includes "The command history file is \"#{@filename}\""
|
172
165
|
end
|
166
|
+
end
|
173
167
|
|
174
|
-
|
175
|
-
|
176
|
-
interface.histfile = 'hist_file.txt'
|
177
|
-
enter 'show history filename'
|
178
|
-
debug_file 'show'
|
179
|
-
check_output_includes 'The command history file is "hist_file.txt"'
|
180
|
-
end
|
181
|
-
|
182
|
-
it 'must show history save setting' do
|
183
|
-
interface.history_save = true
|
184
|
-
enter 'show history save'
|
185
|
-
debug_file 'show'
|
186
|
-
check_output_includes 'Saving of history save is on.'
|
187
|
-
end
|
168
|
+
describe 'histsize' do
|
169
|
+
before { @max_size = Byebug::History::DEFAULT_MAX_SIZE }
|
188
170
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
check_output_includes 'Byebug history size is 30'
|
194
|
-
end
|
171
|
+
it "must show history's max size" do
|
172
|
+
enter 'show histsize'
|
173
|
+
debug_file 'show'
|
174
|
+
check_output_includes "Byebug history's maximum size is #{@max_size}"
|
195
175
|
end
|
196
176
|
end
|
197
177
|
|
198
178
|
describe 'commands' do
|
199
|
-
|
200
|
-
|
179
|
+
temporary_change_const Readline, 'HISTORY', %w(aaa bbb ccc ddd)
|
180
|
+
|
181
|
+
describe 'with history disabled' do
|
182
|
+
temporary_change_hash Byebug.settings, :autosave, false
|
201
183
|
|
202
184
|
it 'must not show records from readline' do
|
203
185
|
enter 'show commands'
|
204
186
|
debug_file 'show'
|
205
|
-
check_output_includes
|
187
|
+
check_output_includes "Not currently saving history. " \
|
188
|
+
'Enable it with "set autosave"'
|
206
189
|
end
|
207
190
|
end
|
208
191
|
|
209
|
-
describe '
|
210
|
-
|
192
|
+
describe 'with history enabled' do
|
193
|
+
temporary_change_hash Byebug.settings, :autosave, true
|
211
194
|
|
212
195
|
describe 'show records' do
|
213
|
-
|
214
|
-
|
215
|
-
it 'must show records from readline history' do
|
216
|
-
enter 'show commands'
|
196
|
+
it 'displays last max_size records from readline history' do
|
197
|
+
enter 'set histsize 3', 'show commands'
|
217
198
|
debug_file 'show'
|
218
|
-
check_output_includes(/
|
219
|
-
|
199
|
+
check_output_includes(/2 bbb\n 3 ccc\n 4 ddd/)
|
200
|
+
check_output_doesnt_include(/1 aaa/)
|
220
201
|
end
|
221
202
|
end
|
222
203
|
|
223
204
|
describe 'max records' do
|
224
|
-
|
225
|
-
|
226
|
-
it 'must show last 10 records from readline history' do
|
227
|
-
enter 'show commands'
|
205
|
+
it 'displays whole history if max_size is bigger than Readline::HISTORY' do
|
206
|
+
enter 'set histsize 7', 'show commands'
|
228
207
|
debug_file 'show'
|
229
|
-
|
230
|
-
check_output_includes(/4 eee/)
|
231
|
-
check_output_includes(/13 nnn/)
|
208
|
+
check_output_includes(/1 aaa\n 2 bbb\n 3 ccc\n 4 ddd/)
|
232
209
|
end
|
233
210
|
end
|
234
211
|
|
235
|
-
describe 'with specified
|
236
|
-
|
237
|
-
|
238
|
-
it 'must show records within boundaries' do
|
239
|
-
# Really don't know why it substracts 4, and shows starting from position 6
|
240
|
-
enter 'show commands 10'
|
241
|
-
debug_file 'show'
|
242
|
-
check_output_doesnt_include(/5 fff/)
|
243
|
-
check_output_includes(/6 ggg/)
|
244
|
-
check_output_includes(/13 nnn/)
|
245
|
-
end
|
246
|
-
|
247
|
-
it 'must adjust first line if it is < 0' do
|
248
|
-
enter 'show commands 3'
|
212
|
+
describe 'with specified size' do
|
213
|
+
it 'displays the specified number of entries most recent first' do
|
214
|
+
enter 'show commands 2'
|
249
215
|
debug_file 'show'
|
250
|
-
check_output_includes(/
|
251
|
-
|
252
|
-
check_output_doesnt_include(/9 jjj/)
|
216
|
+
check_output_includes(/3 ccc\n 4 ddd/)
|
217
|
+
check_output_doesnt_include(/1 aaa\n 2 bbb/)
|
253
218
|
end
|
254
219
|
end
|
255
220
|
end
|