byebug 1.2.0 → 1.3.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 +5 -0
- data/GUIDE.md +210 -4
- data/README.md +93 -64
- data/bin/byebug +10 -4
- data/byebug.gemspec +1 -1
- data/ext/byebug/breakpoint.c +22 -20
- data/lib/byebug/command.rb +5 -3
- data/lib/byebug/commands/frame.rb +2 -1
- data/lib/byebug/commands/kill.rb +0 -1
- data/lib/byebug/commands/set.rb +5 -6
- data/lib/byebug/commands/show.rb +11 -11
- data/lib/byebug/version.rb +1 -1
- data/logo.png +0 -0
- data/old_doc/byebug.texi +2 -2
- data/old_doc/{test-tri2.rb → test-triangle.rb} +4 -5
- data/old_doc/tri3.rb +3 -5
- data/old_doc/triangle.rb +4 -2
- data/test/breakpoints_test.rb +1 -2
- data/test/conditions_test.rb +3 -4
- data/test/continue_test.rb +6 -8
- data/test/display_test.rb +1 -2
- data/test/edit_test.rb +1 -2
- data/test/eval_test.rb +1 -2
- data/test/examples/stepping.rb +4 -0
- data/test/finish_test.rb +1 -2
- data/test/frame_test.rb +1 -2
- data/test/help_test.rb +1 -2
- data/test/info_test.rb +1 -2
- data/test/jump_test.rb +1 -2
- data/test/kill_test.rb +1 -2
- data/test/list_test.rb +1 -2
- data/test/method_test.rb +1 -2
- data/test/post_mortem_test.rb +1 -2
- data/test/quit_test.rb +1 -2
- data/test/reload_test.rb +1 -2
- data/test/repl_test.rb +1 -2
- data/test/restart_test.rb +1 -2
- data/test/save_test.rb +1 -2
- data/test/set_test.rb +6 -11
- data/test/show_test.rb +5 -4
- data/test/source_test.rb +1 -2
- data/test/stepping_test.rb +81 -55
- data/test/support/test_dsl.rb +54 -54
- data/test/test_helper.rb +0 -1
- data/test/trace_test.rb +75 -80
- data/test/variables_test.rb +1 -2
- metadata +6 -5
data/test/frame_test.rb
CHANGED
data/test/help_test.rb
CHANGED
data/test/info_test.rb
CHANGED
data/test/jump_test.rb
CHANGED
data/test/kill_test.rb
CHANGED
data/test/list_test.rb
CHANGED
data/test/method_test.rb
CHANGED
data/test/post_mortem_test.rb
CHANGED
data/test/quit_test.rb
CHANGED
data/test/reload_test.rb
CHANGED
data/test/repl_test.rb
CHANGED
data/test/restart_test.rb
CHANGED
data/test/save_test.rb
CHANGED
data/test/set_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
include TestDsl
|
3
|
+
class TestSet < TestDsl::TestCase
|
5
4
|
|
6
5
|
describe 'setting to on' do
|
7
6
|
temporary_change_hash Byebug::Command.settings, :autolist, 0
|
@@ -170,15 +169,11 @@ describe 'Set Command' do
|
|
170
169
|
|
171
170
|
describe 'width' do
|
172
171
|
temporary_change_hash Byebug::Command.settings, :width, 20
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
debug_file('set') { ENV['COLUMNS'].must_equal '10' }
|
179
|
-
ensure
|
180
|
-
ENV['COLUMNS'] = old_columns
|
181
|
-
end
|
172
|
+
|
173
|
+
it 'must get correctly set' do
|
174
|
+
enter 'set width 10'
|
175
|
+
debug_file('set')
|
176
|
+
Byebug::Command.settings[:width].must_equal 10
|
182
177
|
end
|
183
178
|
end
|
184
179
|
|
data/test/show_test.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
include TestDsl
|
3
|
+
class TestShow < TestDsl::TestCase
|
5
4
|
|
6
5
|
describe 'annotate' do
|
7
6
|
it 'must show annotate setting' do
|
@@ -143,10 +142,12 @@ describe 'Show Command' do
|
|
143
142
|
end
|
144
143
|
|
145
144
|
describe 'width' do
|
146
|
-
|
145
|
+
let(:cols) { `stty size`.scan(/\d+/)[1].to_i }
|
146
|
+
|
147
|
+
it 'must show default width' do
|
147
148
|
enter 'show width'
|
148
149
|
debug_file 'show'
|
149
|
-
check_output_includes
|
150
|
+
check_output_includes "width is #{cols}."
|
150
151
|
end
|
151
152
|
end
|
152
153
|
|
data/test/source_test.rb
CHANGED
data/test/stepping_test.rb
CHANGED
@@ -1,51 +1,63 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
include TestDsl
|
3
|
+
class TestStepping < TestDsl::TestCase
|
5
4
|
|
6
5
|
describe 'Next Command' do
|
7
6
|
|
8
7
|
describe 'Usual mode' do
|
9
|
-
before { enter 'break 10', 'cont' }
|
10
8
|
|
11
|
-
|
12
|
-
enter '
|
13
|
-
debug_file('stepping') { state.line.must_equal 10 }
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'must go to the next line if forced by "plus" sign' do
|
17
|
-
enter 'next+'
|
18
|
-
debug_file('stepping') { state.line.must_equal 11 }
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'must leave on the same line if forced by "minus" sign' do
|
22
|
-
enter 'next-'
|
23
|
-
debug_file('stepping') { state.line.must_equal 10 }
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'when force_stepping is set' do
|
27
|
-
temporary_change_hash Byebug::Command.settings, :force_stepping, true
|
9
|
+
describe 'method call behaviour' do
|
10
|
+
before { enter 'break 10', 'cont' }
|
28
11
|
|
29
|
-
it 'must
|
12
|
+
it 'must leave on the same line by default' do
|
30
13
|
enter 'next'
|
31
|
-
debug_file('stepping') { state.line.must_equal
|
14
|
+
debug_file('stepping') { state.line.must_equal 10 }
|
32
15
|
end
|
33
16
|
|
34
|
-
it 'must go to the next line
|
35
|
-
enter '
|
17
|
+
it 'must go to the next line if forced by "plus" sign' do
|
18
|
+
enter 'next+'
|
36
19
|
debug_file('stepping') { state.line.must_equal 11 }
|
37
20
|
end
|
38
21
|
|
39
|
-
it 'must
|
40
|
-
enter 'next 2'
|
41
|
-
debug_file('stepping') { state.line.must_equal 21 }
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'must ignore it if "minus" is specified' do
|
22
|
+
it 'must leave on the same line if forced by "minus" sign' do
|
45
23
|
enter 'next-'
|
46
24
|
debug_file('stepping') { state.line.must_equal 10 }
|
47
25
|
end
|
26
|
+
|
27
|
+
describe 'when force_stepping is set' do
|
28
|
+
temporary_change_hash Byebug::Command.settings, :force_stepping, true
|
29
|
+
|
30
|
+
it 'must go to the next line' do
|
31
|
+
enter 'next'
|
32
|
+
debug_file('stepping') { state.line.must_equal 11 }
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'must go to the next line (by shortcut)' do
|
36
|
+
enter 'n'
|
37
|
+
debug_file('stepping') { state.line.must_equal 11 }
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'must go the specified number of lines forward by default' do
|
41
|
+
enter 'next 2'
|
42
|
+
debug_file('stepping') { state.line.must_equal 21 }
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'must ignore it if "minus" is specified' do
|
46
|
+
enter 'next-'
|
47
|
+
debug_file('stepping') { state.line.must_equal 10 }
|
48
|
+
end
|
49
|
+
end
|
48
50
|
end
|
51
|
+
|
52
|
+
describe 'block behaviour' do
|
53
|
+
before { enter 'break 21', 'cont' }
|
54
|
+
|
55
|
+
it 'must step over blocks' do
|
56
|
+
enter 'next'
|
57
|
+
debug_file('stepping') { state.line.must_equal 25 }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
49
61
|
end
|
50
62
|
|
51
63
|
describe 'Post Mortem' do
|
@@ -58,46 +70,60 @@ describe 'Stepping Commands' do
|
|
58
70
|
'Unknown command: "next". Try "help".', interface.error_queue
|
59
71
|
end
|
60
72
|
end
|
73
|
+
|
61
74
|
end
|
62
75
|
|
63
76
|
describe 'Step Command' do
|
64
77
|
|
65
78
|
describe 'Usual mode' do
|
66
|
-
before { enter 'break 10', 'cont' }
|
67
|
-
|
68
|
-
it 'must leave on the same line if forced by a setting' do
|
69
|
-
enter 'step'
|
70
|
-
debug_file('stepping') { state.line.must_equal 10 }
|
71
|
-
end
|
72
79
|
|
73
|
-
|
74
|
-
enter '
|
75
|
-
debug_file('stepping') { state.line.must_equal 11 }
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'must leave on the same line if forced to do that by "minus" sign' do
|
79
|
-
enter 'step-'
|
80
|
-
debug_file('stepping') { state.line.must_equal 10 }
|
81
|
-
end
|
80
|
+
describe 'method call behaviour' do
|
81
|
+
before { enter 'break 10', 'cont' }
|
82
82
|
|
83
|
-
|
84
|
-
temporary_change_hash Byebug::Command.settings, :force_stepping, true
|
85
|
-
|
86
|
-
it 'must go to the step line if forced by a setting' do
|
83
|
+
it 'must leave on the same line if forced by a setting' do
|
87
84
|
enter 'step'
|
88
|
-
debug_file('stepping') { state.line.must_equal
|
85
|
+
debug_file('stepping') { state.line.must_equal 10 }
|
89
86
|
end
|
90
87
|
|
91
|
-
it 'must go to the
|
92
|
-
enter '
|
88
|
+
it 'must go to the step line if forced to do that by "plus" sign' do
|
89
|
+
enter 'step+'
|
93
90
|
debug_file('stepping') { state.line.must_equal 11 }
|
94
91
|
end
|
95
92
|
|
96
|
-
it 'must
|
97
|
-
enter 'step
|
98
|
-
debug_file('stepping') { state.line.must_equal
|
93
|
+
it 'must leave on the same line if forced to do that by "minus" sign' do
|
94
|
+
enter 'step-'
|
95
|
+
debug_file('stepping') { state.line.must_equal 10 }
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'when force_stepping is set' do
|
99
|
+
temporary_change_hash Byebug::Command.settings, :force_stepping, true
|
100
|
+
|
101
|
+
it 'must go to the step line if forced by a setting' do
|
102
|
+
enter 'step'
|
103
|
+
debug_file('stepping') { state.line.must_equal 11 }
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'must go to the next line if forced by a setting (by shortcut)' do
|
107
|
+
enter 's'
|
108
|
+
debug_file('stepping') { state.line.must_equal 11 }
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'must go the specified number of lines forward by default' do
|
112
|
+
enter 'step 2'
|
113
|
+
debug_file('stepping') { state.line.must_equal 15 }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe 'block behaviour' do
|
119
|
+
before { enter 'break 21', 'cont' }
|
120
|
+
|
121
|
+
it 'must step into blocks' do
|
122
|
+
enter 'step'
|
123
|
+
debug_file('stepping') { state.line.must_equal 22 }
|
99
124
|
end
|
100
125
|
end
|
126
|
+
|
101
127
|
end
|
102
128
|
|
103
129
|
describe 'Post Mortem' do
|
data/test/support/test_dsl.rb
CHANGED
@@ -1,12 +1,60 @@
|
|
1
1
|
module TestDsl
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module ClassUtils
|
4
|
+
|
5
|
+
def temporary_change_hash hash, key, value
|
6
|
+
mod = Module.new do
|
7
|
+
extend Minitest::Spec::DSL
|
8
|
+
|
9
|
+
before do
|
10
|
+
@old_hashes ||= {}
|
11
|
+
@old_hashes.merge!({ hash => { key => hash[key] } }) do |k, v1, v2|
|
12
|
+
v1.merge(v2)
|
13
|
+
end
|
14
|
+
hash[key] = value
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
hash[key] = @old_hashes[hash][key]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
include mod
|
23
|
+
end
|
24
|
+
|
25
|
+
def temporary_change_const klass, const, value
|
26
|
+
mod = Module.new do
|
27
|
+
extend Minitest::Spec::DSL
|
28
|
+
|
29
|
+
before do
|
30
|
+
@old_consts ||= {}
|
31
|
+
old_value = klass.const_defined?(const) ?
|
32
|
+
klass.const_get(const) : :__undefined__
|
33
|
+
@old_consts.merge!({ klass => { const => old_value } }) do |k, v1, v2|
|
34
|
+
v1.merge(v2)
|
35
|
+
end
|
36
|
+
klass.send :remove_const, const if klass.const_defined?(const)
|
37
|
+
klass.const_set const, value unless value == :__undefined__
|
38
|
+
end
|
39
|
+
|
40
|
+
after do
|
41
|
+
klass.send :remove_const, const if klass.const_defined?(const)
|
42
|
+
klass.const_set const, @old_consts[klass][const] unless
|
43
|
+
@old_consts[klass][const] == :__undefined__
|
44
|
+
end
|
9
45
|
end
|
46
|
+
|
47
|
+
include mod
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class TestCase < Minitest::Spec
|
52
|
+
extend TestDsl::ClassUtils
|
53
|
+
include TestDsl
|
54
|
+
|
55
|
+
def setup
|
56
|
+
Byebug.interface = TestInterface.new
|
57
|
+
Byebug.handler.display.clear
|
10
58
|
end
|
11
59
|
end
|
12
60
|
|
@@ -136,52 +184,4 @@ module TestDsl
|
|
136
184
|
File.open(file, 'w') { |f| f.write(new_content) }
|
137
185
|
end
|
138
186
|
|
139
|
-
|
140
|
-
module ClassUtils
|
141
|
-
def temporary_change_hash hash, key, value
|
142
|
-
mod = Module.new do
|
143
|
-
extend Minitest::Spec::DSL
|
144
|
-
|
145
|
-
before do
|
146
|
-
@old_hashes ||= {}
|
147
|
-
@old_hashes.merge!({ hash => { key => hash[key] } }) do |k, v1, v2|
|
148
|
-
v1.merge(v2)
|
149
|
-
end
|
150
|
-
hash[key] = value
|
151
|
-
end
|
152
|
-
|
153
|
-
after do
|
154
|
-
hash[key] = @old_hashes[hash][key]
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
include mod
|
159
|
-
end
|
160
|
-
|
161
|
-
def temporary_change_const klass, const, value
|
162
|
-
mod = Module.new do
|
163
|
-
extend Minitest::Spec::DSL
|
164
|
-
|
165
|
-
before do
|
166
|
-
@old_consts ||= {}
|
167
|
-
old_value = klass.const_defined?(const) ?
|
168
|
-
klass.const_get(const) : :__undefined__
|
169
|
-
@old_consts.merge!({ klass => { const => old_value } }) do |k, v1, v2|
|
170
|
-
v1.merge(v2)
|
171
|
-
end
|
172
|
-
klass.send :remove_const, const if klass.const_defined?(const)
|
173
|
-
klass.const_set const, value unless value == :__undefined__
|
174
|
-
end
|
175
|
-
|
176
|
-
after do
|
177
|
-
klass.send :remove_const, const if klass.const_defined?(const)
|
178
|
-
klass.const_set const, @old_consts[klass][const] unless
|
179
|
-
@old_consts[klass][const] == :__undefined__
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
include mod
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
187
|
end
|