byebug 1.8.2 → 2.0.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/CHANGELOG.md +8 -1
- data/GUIDE.md +14 -22
- data/README.md +69 -6
- data/bin/byebug +3 -20
- data/ext/byebug/breakpoint.c +185 -101
- data/ext/byebug/byebug.c +393 -214
- data/ext/byebug/byebug.h +34 -15
- data/ext/byebug/context.c +327 -102
- data/ext/byebug/extconf.rb +1 -1
- data/ext/byebug/locker.c +54 -0
- data/ext/byebug/threads.c +113 -0
- data/lib/byebug.rb +19 -58
- data/lib/byebug/command.rb +18 -19
- data/lib/byebug/commands/breakpoints.rb +1 -4
- data/lib/byebug/commands/catchpoint.rb +1 -1
- data/lib/byebug/commands/condition.rb +1 -1
- data/lib/byebug/commands/control.rb +2 -3
- data/lib/byebug/commands/display.rb +2 -7
- data/lib/byebug/commands/edit.rb +1 -1
- data/lib/byebug/commands/enable.rb +12 -12
- data/lib/byebug/commands/eval.rb +4 -4
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/frame.rb +12 -8
- data/lib/byebug/commands/info.rb +20 -52
- data/lib/byebug/commands/kill.rb +1 -5
- data/lib/byebug/commands/list.rb +2 -1
- data/lib/byebug/commands/quit.rb +1 -1
- data/lib/byebug/commands/repl.rb +2 -2
- data/lib/byebug/commands/save.rb +1 -1
- data/lib/byebug/commands/set.rb +84 -90
- data/lib/byebug/commands/show.rb +44 -53
- data/lib/byebug/commands/skip.rb +1 -1
- data/lib/byebug/commands/stepping.rb +5 -4
- data/lib/byebug/commands/threads.rb +202 -0
- data/lib/byebug/commands/trace.rb +1 -1
- data/lib/byebug/helper.rb +3 -3
- data/lib/byebug/interface.rb +2 -20
- data/lib/byebug/processor.rb +21 -100
- data/lib/byebug/remote.rb +3 -3
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.1 +0 -6
- data/old_doc/byebug.texi +29 -46
- data/test/breakpoints_test.rb +44 -65
- data/test/conditions_test.rb +0 -9
- data/test/continue_test.rb +2 -2
- data/test/display_test.rb +4 -23
- data/test/edit_test.rb +2 -16
- data/test/eval_test.rb +4 -13
- data/test/examples/thread.rb +32 -0
- data/test/finish_test.rb +1 -13
- data/test/frame_test.rb +5 -12
- data/test/help_test.rb +2 -12
- data/test/info_test.rb +8 -18
- data/test/kill_test.rb +1 -10
- data/test/list_test.rb +5 -14
- data/test/method_test.rb +1 -10
- data/test/post_mortem_test.rb +247 -14
- data/test/quit_test.rb +0 -9
- data/test/reload_test.rb +1 -15
- data/test/repl_test.rb +1 -9
- data/test/restart_test.rb +3 -18
- data/test/save_test.rb +1 -13
- data/test/set_test.rb +35 -32
- data/test/show_test.rb +8 -27
- data/test/source_test.rb +1 -8
- data/test/stepping_test.rb +65 -96
- data/test/support/test_dsl.rb +12 -17
- data/test/test_helper.rb +1 -1
- data/test/thread_test.rb +106 -0
- data/test/trace_test.rb +5 -17
- data/test/variables_test.rb +1 -10
- metadata +9 -7
- data/lib/byebug/commands/jump.rb +0 -52
- data/test/jump_test.rb +0 -77
- data/test/support/context.rb +0 -15
data/test/method_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
3
|
class TestMethod < TestDsl::TestCase
|
4
|
-
temporary_change_hash Byebug
|
4
|
+
temporary_change_hash Byebug.settings, :autolist, 0
|
5
5
|
|
6
6
|
describe 'show instance method of a class' do
|
7
7
|
it 'must show using full command name' do
|
@@ -58,13 +58,4 @@ class TestMethod < TestDsl::TestCase
|
|
58
58
|
check_output_includes '@a = "b"', '@c = "d"'
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
62
|
-
describe 'Post Mortem' do
|
63
|
-
it 'must work in post-mortem mode' do
|
64
|
-
enter 'cont', 'm i self'
|
65
|
-
debug_file 'post_mortem'
|
66
|
-
check_output_includes /to_s/
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
61
|
end
|
data/test/post_mortem_test.rb
CHANGED
@@ -2,24 +2,257 @@ require_relative 'test_helper'
|
|
2
2
|
|
3
3
|
class TestPostMortem < TestDsl::TestCase
|
4
4
|
|
5
|
-
|
6
|
-
enter '
|
7
|
-
|
8
|
-
|
5
|
+
describe 'Features' do
|
6
|
+
it 'must enter into post-mortem mode' do
|
7
|
+
enter 'cont'
|
8
|
+
debug_file('post_mortem') { Byebug.post_mortem?.must_equal true }
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'must stop at the correct line' do
|
12
|
+
enter 'cont'
|
13
|
+
debug_file('post_mortem') { $state.line.must_equal 8 }
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'must exit from post-mortem mode after stepping command' do
|
17
|
+
enter 'cont', 'break 12', 'cont'
|
18
|
+
debug_file('post_mortem') { Byebug.post_mortem?.must_equal false }
|
19
|
+
end
|
9
20
|
|
10
|
-
|
11
|
-
|
12
|
-
|
21
|
+
it 'must save the raised exception' do
|
22
|
+
enter 'cont'
|
23
|
+
debug_file('post_mortem') {
|
24
|
+
Byebug.last_exception.must_be_kind_of RuntimeError }
|
25
|
+
end
|
13
26
|
end
|
14
27
|
|
15
|
-
|
16
|
-
|
17
|
-
|
28
|
+
describe 'Unavailable commands' do
|
29
|
+
temporary_change_hash Byebug.settings, :autoeval, false
|
30
|
+
|
31
|
+
describe 'step' do
|
32
|
+
it 'must not work in post-mortem mode' do
|
33
|
+
enter 'cont', 'step'
|
34
|
+
debug_file 'post_mortem'
|
35
|
+
check_error_includes 'Unknown command: "step". Try "help".'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'next' do
|
40
|
+
it 'must not work in post-mortem mode' do
|
41
|
+
enter 'cont', 'next'
|
42
|
+
debug_file 'post_mortem'
|
43
|
+
check_error_includes 'Unknown command: "next". Try "help".'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'finish' do
|
48
|
+
it 'must not work in post-mortem mode' do
|
49
|
+
enter 'cont', 'finish'
|
50
|
+
debug_file 'post_mortem'
|
51
|
+
check_error_includes 'Unknown command: "finish". Try "help".'
|
52
|
+
end
|
53
|
+
end
|
18
54
|
end
|
19
55
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
56
|
+
describe 'Available commands' do
|
57
|
+
before { @tst_file = fullpath('post_mortem') }
|
58
|
+
|
59
|
+
describe 'restart' do
|
60
|
+
it 'must work in post-mortem mode' do
|
61
|
+
must_restart
|
62
|
+
enter 'cont', 'restart'
|
63
|
+
debug_file 'post_mortem'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'display' do
|
68
|
+
it 'must be able to set display expressions in post-mortem mode' do
|
69
|
+
enter 'cont', 'display 2 + 2'
|
70
|
+
debug_file 'post_mortem'
|
71
|
+
check_output_includes '1:', '2 + 2 = 4'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'frame' do
|
76
|
+
it 'must work in post-mortem mode' do
|
77
|
+
enter 'cont', 'frame'
|
78
|
+
debug_file('post_mortem') { $state.line.must_equal 8 }
|
79
|
+
check_output_includes \
|
80
|
+
/--> #0 block in CatchExample\.a\s+at #{@tst_file}:8/
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'condition' do
|
85
|
+
it 'must be able to set conditions in post-mortem mode' do
|
86
|
+
enter 'cont', 'break 12',
|
87
|
+
->{ "cond #{Byebug.breakpoints.first.id} true" }, 'cont'
|
88
|
+
debug_file('post_mortem') { $state.line.must_equal 12 }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe 'break' do
|
93
|
+
it 'must be able to set breakpoints in post-mortem mode' do
|
94
|
+
enter 'cont', 'break 12', 'cont'
|
95
|
+
debug_file('post_mortem') { $state.line.must_equal 12 }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe 'exit' do
|
100
|
+
it 'must work in post-mortem mode' do
|
101
|
+
Byebug::QuitCommand.any_instance.expects(:exit!)
|
102
|
+
enter 'cont', 'exit!'
|
103
|
+
debug_file 'post_mortem'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe 'reload' do
|
108
|
+
after { change_line_in_file(@tst_file, 7, ' z = 4') }
|
109
|
+
|
110
|
+
it 'must work in post-mortem mode' do
|
111
|
+
enter 'cont', -> do
|
112
|
+
change_line_in_file(@tst_file, 7, 'z = 100')
|
113
|
+
'reload'
|
114
|
+
end, 'l 7-7'
|
115
|
+
debug_file 'post_mortem'
|
116
|
+
check_output_includes '7: z = 100'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'edit' do
|
121
|
+
temporary_change_hash ENV, 'EDITOR', 'editr'
|
122
|
+
|
123
|
+
it 'must work in post-mortem mode' do
|
124
|
+
Byebug::Edit.any_instance.
|
125
|
+
expects(:system).with("editr +2 #{fullpath('edit')}")
|
126
|
+
enter 'cont', "edit #{fullpath('edit')}:2", 'cont'
|
127
|
+
debug_file 'post_mortem'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe 'info' do
|
132
|
+
it 'must work in post-mortem mode' do
|
133
|
+
enter 'cont', 'info line'
|
134
|
+
debug_file 'post_mortem'
|
135
|
+
check_output_includes "Line 8 of \"#{@tst_file}\""
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe 'irb' do
|
140
|
+
let(:irb) { stub(context: ->{}) }
|
141
|
+
|
142
|
+
it 'must work in post-mortem mode' do
|
143
|
+
irb.stubs(:eval_input).throws(:IRB_EXIT, :cont)
|
144
|
+
enter 'cont', 'break 12', 'irb'
|
145
|
+
debug_file('post_mortem') { $state.line.must_equal 12 }
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'source' do
|
150
|
+
before { File.open(filename, 'w') do |f|
|
151
|
+
f.puts 'break 2'
|
152
|
+
f.puts 'break 3 if true'
|
153
|
+
end }
|
154
|
+
after { FileUtils.rm(filename) }
|
155
|
+
|
156
|
+
let(:filename) { 'source_example.txt' }
|
157
|
+
|
158
|
+
it 'must work in post-mortem mode' do
|
159
|
+
enter 'cont', "so #{filename}"
|
160
|
+
debug_file('post_mortem') { Byebug.breakpoints[0].pos.must_equal 3 }
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
describe 'help' do
|
165
|
+
it 'must work in post-mortem mode' do
|
166
|
+
enter 'cont', 'help'
|
167
|
+
debug_file 'post_mortem'
|
168
|
+
check_output_includes 'Available commands:'
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe 'var' do
|
173
|
+
it 'must work in post-mortem mode' do
|
174
|
+
enter 'cont', 'var local'
|
175
|
+
debug_file 'post_mortem'
|
176
|
+
check_output_includes 'x => nil', 'z => 4'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe 'list' do
|
181
|
+
it 'must work in post-mortem mode' do
|
182
|
+
enter 'cont'
|
183
|
+
debug_file 'post_mortem'
|
184
|
+
check_output_includes "[3, 12] in #{@tst_file}"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe 'method' do
|
189
|
+
it 'must work in post-mortem mode' do
|
190
|
+
enter 'cont', 'm i self'
|
191
|
+
debug_file 'post_mortem'
|
192
|
+
check_output_includes /to_s/
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe 'kill' do
|
197
|
+
it 'must work in post-mortem mode' do
|
198
|
+
Process.expects(:kill).with('USR1', Process.pid)
|
199
|
+
enter 'cont', 'kill USR1'
|
200
|
+
debug_file 'post_mortem'
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
describe 'eval' do
|
205
|
+
it 'must work in post-mortem mode' do
|
206
|
+
enter 'cont', 'eval 2 + 2'
|
207
|
+
debug_file 'post_mortem'
|
208
|
+
check_output_includes '4'
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe 'set' do
|
213
|
+
temporary_change_hash Byebug.settings, :autolist, 0
|
214
|
+
|
215
|
+
it 'must work in post-mortem mode' do
|
216
|
+
enter 'cont', 'set autolist on'
|
217
|
+
debug_file 'post_mortem'
|
218
|
+
check_output_includes 'autolist is on.'
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe 'save' do
|
223
|
+
let(:file_name) { 'save_output.txt' }
|
224
|
+
let(:file_contents) { File.read(file_name) }
|
225
|
+
after { FileUtils.rm(file_name) }
|
226
|
+
|
227
|
+
it 'must work in post-mortem mode' do
|
228
|
+
enter 'cont', "save #{file_name}"
|
229
|
+
debug_file 'post_mortem'
|
230
|
+
file_contents.must_include 'set autoirb off'
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe 'show' do
|
235
|
+
it 'must work in post-mortem mode' do
|
236
|
+
enter 'cont', 'show autolist'
|
237
|
+
debug_file 'post_mortem'
|
238
|
+
check_output_includes 'autolist is on.'
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
describe 'trace' do
|
243
|
+
it 'must work in post-mortem mode' do
|
244
|
+
enter 'cont', 'trace on'
|
245
|
+
debug_file 'post_mortem'
|
246
|
+
check_output_includes 'line tracing is on.'
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
describe 'thread' do
|
251
|
+
it "must work in post-mortem mode" do
|
252
|
+
enter 'cont', 'thread list'
|
253
|
+
debug_file('post_mortem')
|
254
|
+
check_output_includes /\+ \d+ #<Thread:(\S+) run/
|
255
|
+
end
|
256
|
+
end
|
24
257
|
end
|
25
258
|
end
|
data/test/quit_test.rb
CHANGED
@@ -42,13 +42,4 @@ class TestQuit < TestDsl::TestCase
|
|
42
42
|
enter 'exit!'
|
43
43
|
debug_file 'quit'
|
44
44
|
end
|
45
|
-
|
46
|
-
describe 'Post Mortem' do
|
47
|
-
it 'must work in post-mortem mode' do
|
48
|
-
Byebug::QuitCommand.any_instance.expects(:exit!)
|
49
|
-
enter 'cont', 'exit!'
|
50
|
-
debug_file 'post_mortem'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
45
|
end
|
data/test/reload_test.rb
CHANGED
@@ -3,7 +3,7 @@ require_relative 'test_helper'
|
|
3
3
|
class TestReload < TestDsl::TestCase
|
4
4
|
|
5
5
|
describe 'autoreloading' do
|
6
|
-
after { Byebug
|
6
|
+
after { Byebug.settings[:autoreload] = true }
|
7
7
|
|
8
8
|
it 'must notify that automatic reloading is on by default' do
|
9
9
|
enter 'reload'
|
@@ -31,18 +31,4 @@ class TestReload < TestDsl::TestCase
|
|
31
31
|
check_output_includes '4: a = 100'
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
35
|
-
describe 'Post Mortem' do
|
36
|
-
after { change_line_in_file(fullpath('post_mortem'), 7, ' z = 4') }
|
37
|
-
|
38
|
-
it 'must work in post-mortem mode' do
|
39
|
-
enter 'cont', -> do
|
40
|
-
change_line_in_file(fullpath('post_mortem'), 7, 'z = 100')
|
41
|
-
'reload'
|
42
|
-
end, 'l 7-7'
|
43
|
-
debug_file 'post_mortem'
|
44
|
-
check_output_includes '7: z = 100'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
34
|
end
|
data/test/repl_test.rb
CHANGED
@@ -35,14 +35,6 @@ class TestRepl < TestDsl::TestCase
|
|
35
35
|
debug_file 'repl'
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
describe 'Post Mortem' do
|
40
|
-
it 'must work in post-mortem mode' do
|
41
|
-
irb.stubs(:eval_input).throws(:IRB_EXIT, :cont)
|
42
|
-
enter 'cont', 'break 12', 'irb'
|
43
|
-
debug_file('post_mortem') { $state.line.must_equal 12 }
|
44
|
-
end
|
45
|
-
end
|
46
38
|
end
|
47
39
|
|
48
40
|
@has_pry = false
|
@@ -66,7 +58,7 @@ class TestRepl < TestDsl::TestCase
|
|
66
58
|
end
|
67
59
|
end
|
68
60
|
|
69
|
-
describe '
|
61
|
+
describe 'post-mortem' do
|
70
62
|
it 'must work in post-mortem mode' do
|
71
63
|
skip 'TODO'
|
72
64
|
end
|
data/test/restart_test.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
3
|
class TestRestart < TestDsl::TestCase
|
4
|
-
|
5
|
-
def must_restart
|
6
|
-
Byebug::RestartCommand.any_instance.unstub(:exec)
|
7
|
-
Byebug::RestartCommand.any_instance.expects(:exec)
|
8
|
-
end
|
9
|
-
|
10
4
|
describe 'usual restarting' do
|
11
5
|
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
12
6
|
|
@@ -18,7 +12,7 @@ class TestRestart < TestDsl::TestCase
|
|
18
12
|
end
|
19
13
|
|
20
14
|
describe 'when arguments have spaces' do
|
21
|
-
temporary_change_hash Byebug
|
15
|
+
temporary_change_hash Byebug.settings, :argv, ['argv1', 'argv 2']
|
22
16
|
|
23
17
|
it 'must be correctly escaped' do
|
24
18
|
Byebug::RestartCommand.any_instance.expects(:exec).with \
|
@@ -29,7 +23,7 @@ class TestRestart < TestDsl::TestCase
|
|
29
23
|
end
|
30
24
|
|
31
25
|
describe 'when arguments specified by set command' do
|
32
|
-
temporary_change_hash Byebug
|
26
|
+
temporary_change_hash Byebug.settings, :argv, []
|
33
27
|
|
34
28
|
it 'must specify arguments by "set" command' do
|
35
29
|
Byebug::RestartCommand.any_instance.expects(:exec).
|
@@ -47,7 +41,7 @@ class TestRestart < TestDsl::TestCase
|
|
47
41
|
temporary_change_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
48
42
|
|
49
43
|
describe 'with set args' do
|
50
|
-
temporary_change_hash Byebug
|
44
|
+
temporary_change_hash Byebug.settings, :argv, ['argv']
|
51
45
|
|
52
46
|
it 'must restart and show a message about reexecing' do
|
53
47
|
must_restart
|
@@ -141,13 +135,4 @@ class TestRestart < TestDsl::TestCase
|
|
141
135
|
end
|
142
136
|
end
|
143
137
|
end
|
144
|
-
|
145
|
-
describe 'Post Mortem' do
|
146
|
-
it 'must work in post-mortem mode' do
|
147
|
-
must_restart
|
148
|
-
enter 'cont', 'restart'
|
149
|
-
debug_file 'post_mortem'
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
138
|
end
|
data/test/save_test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
3
|
class TestSave < TestDsl::TestCase
|
4
|
+
|
4
5
|
describe 'successful saving' do
|
5
6
|
let(:file_name) { 'save_output.txt' }
|
6
7
|
let(:file_contents) { File.read(file_name) }
|
@@ -54,7 +55,6 @@ class TestSave < TestDsl::TestCase
|
|
54
55
|
it 'must show a message about successful saving' do
|
55
56
|
check_output_includes "Saved to '#{file_name}'"
|
56
57
|
end
|
57
|
-
|
58
58
|
end
|
59
59
|
|
60
60
|
describe 'without filename' do
|
@@ -73,16 +73,4 @@ class TestSave < TestDsl::TestCase
|
|
73
73
|
check_output_includes "Saved to '#{interface.restart_file}'"
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
77
|
-
describe 'Post Mortem' do
|
78
|
-
let(:file_name) { 'save_output.txt' }
|
79
|
-
let(:file_contents) { File.read(file_name) }
|
80
|
-
after { FileUtils.rm(file_name) }
|
81
|
-
it 'must work in post-mortem mode' do
|
82
|
-
enter 'cont', "save #{file_name}"
|
83
|
-
debug_file 'post_mortem'
|
84
|
-
file_contents.must_include 'set autoirb off'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
76
|
end
|
data/test/set_test.rb
CHANGED
@@ -3,63 +3,63 @@ require_relative 'test_helper'
|
|
3
3
|
class TestSet < TestDsl::TestCase
|
4
4
|
|
5
5
|
describe 'setting to on' do
|
6
|
-
temporary_change_hash Byebug
|
6
|
+
temporary_change_hash Byebug.settings, :autolist, 0
|
7
7
|
|
8
8
|
it 'must set a setting to on' do
|
9
9
|
enter 'set autolist on'
|
10
10
|
debug_file 'set'
|
11
|
-
Byebug
|
11
|
+
Byebug.settings[:autolist].must_equal 1
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'must set a setting to on by 1' do
|
15
15
|
enter 'set autolist 1'
|
16
16
|
debug_file 'set'
|
17
|
-
Byebug
|
17
|
+
Byebug.settings[:autolist].must_equal 1
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'must set a setting to on by default' do
|
21
21
|
enter 'set autolist'
|
22
22
|
debug_file 'set'
|
23
|
-
Byebug
|
23
|
+
Byebug.settings[:autolist].must_equal 1
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'must set a setting using shortcut' do
|
27
27
|
enter 'set autol'
|
28
28
|
debug_file 'set'
|
29
|
-
Byebug
|
29
|
+
Byebug.settings[:autolist].must_equal 1
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
describe 'setting to off' do
|
34
|
-
temporary_change_hash Byebug
|
34
|
+
temporary_change_hash Byebug.settings, :autolist, 1
|
35
35
|
|
36
36
|
it 'must set a setting to off' do
|
37
37
|
enter 'set autolist off'
|
38
38
|
debug_file 'set'
|
39
|
-
Byebug
|
39
|
+
Byebug.settings[:autolist].must_equal 0
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'must set a setting to off by 0' do
|
43
43
|
enter 'set autolist 0'
|
44
44
|
debug_file 'set'
|
45
|
-
Byebug
|
45
|
+
Byebug.settings[:autolist].must_equal 0
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'must set a setting to off by "no" prefix' do
|
49
49
|
enter 'set noautolist'
|
50
50
|
debug_file 'set'
|
51
|
-
Byebug
|
51
|
+
Byebug.settings[:autolist].must_equal 0
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'must set a setting to off by "no" prefix and shortcut' do
|
55
55
|
enter 'set noautol'
|
56
56
|
debug_file 'set'
|
57
|
-
Byebug
|
57
|
+
Byebug.settings[:autolist].must_equal 0
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
describe 'messages' do
|
62
|
-
temporary_change_hash Byebug
|
62
|
+
temporary_change_hash Byebug.settings, :autolist, 0
|
63
63
|
|
64
64
|
it 'must show a message after setting' do
|
65
65
|
enter 'set autolist on'
|
@@ -71,7 +71,7 @@ class TestSet < TestDsl::TestCase
|
|
71
71
|
describe 'testing' do
|
72
72
|
describe '$state' do
|
73
73
|
describe 'when setting "testing" to on' do
|
74
|
-
temporary_change_hash Byebug
|
74
|
+
temporary_change_hash Byebug.settings, :testing, false
|
75
75
|
|
76
76
|
it 'must get set' do
|
77
77
|
enter 'set testing', 'break 3', 'cont'
|
@@ -81,7 +81,7 @@ class TestSet < TestDsl::TestCase
|
|
81
81
|
end
|
82
82
|
|
83
83
|
describe 'when setting "testing" to off' do
|
84
|
-
temporary_change_hash Byebug
|
84
|
+
temporary_change_hash Byebug.settings, :testing, true
|
85
85
|
|
86
86
|
it 'must get unset' do
|
87
87
|
enter 'set notesting', 'break 3', 'cont'
|
@@ -99,6 +99,12 @@ class TestSet < TestDsl::TestCase
|
|
99
99
|
interface.history_save.must_equal true
|
100
100
|
end
|
101
101
|
|
102
|
+
it 'must set history save to on when no param' do
|
103
|
+
enter 'set history save'
|
104
|
+
debug_file 'set'
|
105
|
+
interface.history_save.must_equal true
|
106
|
+
end
|
107
|
+
|
102
108
|
it 'must show a message' do
|
103
109
|
enter 'set history save on'
|
104
110
|
debug_file 'set'
|
@@ -124,6 +130,12 @@ class TestSet < TestDsl::TestCase
|
|
124
130
|
debug_file 'set'
|
125
131
|
check_output_includes 'Byebug history size is 250'
|
126
132
|
end
|
133
|
+
|
134
|
+
it 'must show an error message if no size provided' do
|
135
|
+
enter 'set history size'
|
136
|
+
debug_file 'set'
|
137
|
+
check_output_includes 'You need to specify the history size'
|
138
|
+
end
|
127
139
|
end
|
128
140
|
|
129
141
|
describe 'filename' do
|
@@ -141,29 +153,30 @@ class TestSet < TestDsl::TestCase
|
|
141
153
|
debug_file 'set'
|
142
154
|
check_output_includes "The command history file is \"#{filename}\""
|
143
155
|
end
|
156
|
+
|
157
|
+
it 'must show an error message if no filenmae provided' do
|
158
|
+
enter 'set history filename'
|
159
|
+
debug_file 'set'
|
160
|
+
check_output_includes 'You need to specify a filename'
|
161
|
+
end
|
162
|
+
|
144
163
|
end
|
145
164
|
|
146
165
|
it 'must show an error message if used wrong subcommand' do
|
147
166
|
enter 'set history bla 2'
|
148
167
|
debug_file 'set'
|
149
168
|
check_output_includes \
|
150
|
-
'Invalid history parameter bla. Should be "filename", "save" or "size"
|
151
|
-
end
|
152
|
-
|
153
|
-
it 'must show an error message if provided only one argument' do
|
154
|
-
enter 'set history save'
|
155
|
-
debug_file 'set'
|
156
|
-
check_output_includes 'Need two parameters for "set history"; got 1.'
|
169
|
+
'Invalid history parameter bla. Should be "filename", "save" or "size"'
|
157
170
|
end
|
158
171
|
end
|
159
172
|
|
160
173
|
describe 'width' do
|
161
|
-
temporary_change_hash Byebug
|
174
|
+
temporary_change_hash Byebug.settings, :width, 20
|
162
175
|
|
163
176
|
it 'must get correctly set' do
|
164
177
|
enter 'set width 10'
|
165
178
|
debug_file('set')
|
166
|
-
Byebug
|
179
|
+
Byebug.settings[:width].must_equal 10
|
167
180
|
end
|
168
181
|
end
|
169
182
|
|
@@ -174,14 +187,4 @@ class TestSet < TestDsl::TestCase
|
|
174
187
|
check_output_includes /List of "set" subcommands:/
|
175
188
|
end
|
176
189
|
end
|
177
|
-
|
178
|
-
describe 'Post Mortem' do
|
179
|
-
temporary_change_hash Byebug::Command.settings, :autolist, 0
|
180
|
-
|
181
|
-
it 'must work in post-mortem mode' do
|
182
|
-
enter 'cont', 'set autolist on'
|
183
|
-
debug_file 'post_mortem'
|
184
|
-
check_output_includes 'autolist is on.'
|
185
|
-
end
|
186
|
-
end
|
187
190
|
end
|