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/post_mortem_test.rb
CHANGED
@@ -4,26 +4,23 @@ describe 'Post Mortem' do
|
|
4
4
|
include TestDsl
|
5
5
|
|
6
6
|
it 'must enter into post mortem mode' do
|
7
|
-
skip('No post morten mode for now')
|
8
7
|
enter 'cont'
|
9
8
|
debug_file('post_mortem') { Byebug.post_mortem?.must_equal true }
|
10
9
|
end
|
11
10
|
|
12
11
|
it 'must stop at the correct line' do
|
13
|
-
skip('No post morten mode for now')
|
14
12
|
enter 'cont'
|
15
13
|
debug_file('post_mortem') { state.line.must_equal 8 }
|
16
14
|
end
|
17
15
|
|
18
16
|
it 'must exit from post mortem mode after stepping command' do
|
19
|
-
skip('No post morten mode for now')
|
20
17
|
enter 'cont', 'break 12', 'cont'
|
21
18
|
debug_file('post_mortem') { Byebug.post_mortem?.must_equal false }
|
22
19
|
end
|
23
20
|
|
24
21
|
it 'must save the raised exception' do
|
25
|
-
skip('No post morten mode for now')
|
26
22
|
enter 'cont'
|
27
|
-
debug_file('post_mortem') {
|
23
|
+
debug_file('post_mortem') {
|
24
|
+
Byebug.last_exception.must_be_kind_of RuntimeError }
|
28
25
|
end
|
29
26
|
end
|
data/test/quit_test.rb
CHANGED
@@ -1,55 +1,54 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Quit Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
it
|
6
|
+
it 'must quit if user confirmed' do
|
7
7
|
Byebug::QuitCommand.any_instance.expects(:exit!)
|
8
8
|
enter 'quit', 'y'
|
9
9
|
debug_file 'quit'
|
10
|
-
check_output_includes
|
10
|
+
check_output_includes 'Really quit? (y/n)', interface.confirm_queue
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it 'must not quit if user didn\'t confirm' do
|
14
14
|
Byebug::QuitCommand.any_instance.expects(:exit!).never
|
15
15
|
enter 'quit', 'n'
|
16
16
|
debug_file 'quit'
|
17
|
-
check_output_includes
|
17
|
+
check_output_includes 'Really quit? (y/n)', interface.confirm_queue
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
20
|
+
it 'must quit immediatly if used with !' do
|
21
21
|
Byebug::QuitCommand.any_instance.expects(:exit!)
|
22
22
|
enter 'quit!'
|
23
23
|
debug_file 'quit'
|
24
|
-
check_output_doesnt_include
|
24
|
+
check_output_doesnt_include 'Really quit? (y/n)', interface.confirm_queue
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
27
|
+
it 'must quit immediatly if used with "unconditionally"' do
|
28
28
|
Byebug::QuitCommand.any_instance.expects(:exit!)
|
29
29
|
enter 'quit unconditionally'
|
30
30
|
debug_file 'quit'
|
31
|
-
check_output_doesnt_include
|
31
|
+
check_output_doesnt_include 'Really quit? (y/n)', interface.confirm_queue
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'must finalize interface before quitting' do
|
35
35
|
Byebug::QuitCommand.any_instance.stubs(:exit!)
|
36
36
|
interface.expects(:finalize)
|
37
37
|
enter 'quit!'
|
38
38
|
debug_file 'quit'
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
41
|
+
it 'must quit if used "exit" alias' do
|
42
42
|
Byebug::QuitCommand.any_instance.expects(:exit!)
|
43
43
|
enter 'exit!'
|
44
44
|
debug_file 'quit'
|
45
45
|
end
|
46
46
|
|
47
|
-
describe
|
48
|
-
it
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
#debug_file 'post_mortem'
|
47
|
+
describe 'Post Mortem' do
|
48
|
+
it 'must work in post-mortem mode' do
|
49
|
+
Byebug::QuitCommand.any_instance.expects(:exit!)
|
50
|
+
enter 'cont', 'exit!'
|
51
|
+
debug_file 'post_mortem'
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
data/test/reload_test.rb
CHANGED
@@ -34,9 +34,9 @@ describe 'Reload Command' do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe 'Post Mortem' do
|
37
|
-
|
37
|
+
after { change_line_in_file(fullpath('post_mortem'), 7, ' z = 4') }
|
38
|
+
|
38
39
|
it 'must work in post-mortem mode' do
|
39
|
-
skip('No post morten mode for now')
|
40
40
|
enter 'cont', -> do
|
41
41
|
change_line_in_file(fullpath('post_mortem'), 7, 'z = 100')
|
42
42
|
'reload'
|
data/test/restart_test.rb
CHANGED
data/test/save_test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Save Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'successful saving' do
|
7
7
|
let(:file_name) { 'save_output.txt' }
|
8
8
|
let(:file_contents) { File.read(file_name) }
|
9
9
|
before do
|
@@ -16,77 +16,76 @@ describe "Save Command" do
|
|
16
16
|
FileUtils.rm(file_name)
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'must save usual breakpoints' do
|
20
20
|
file_contents.must_include "break #{fullpath('save')}:2"
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it 'must save conditinal breakpoints' do
|
24
24
|
file_contents.must_include "break #{fullpath('save')}:3 if true"
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
file_contents.must_include
|
27
|
+
it 'must save catchpoints' do
|
28
|
+
file_contents.must_include 'catch NoMethodError'
|
29
29
|
end
|
30
30
|
|
31
31
|
# Not sure why it is suppressed, but this is like it is now.
|
32
|
-
it
|
33
|
-
file_contents.wont_include
|
32
|
+
it 'must not save displays' do
|
33
|
+
file_contents.wont_include 'display 2 + 3'
|
34
34
|
end
|
35
35
|
|
36
|
-
describe
|
37
|
-
it
|
38
|
-
file_contents.must_include
|
36
|
+
describe 'saving settings' do
|
37
|
+
it 'must save autoeval' do
|
38
|
+
file_contents.must_include 'set autoeval on'
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
42
|
-
file_contents.must_include
|
41
|
+
it 'must save basename' do
|
42
|
+
file_contents.must_include 'set basename off'
|
43
43
|
end
|
44
44
|
|
45
|
-
it
|
46
|
-
file_contents.must_include
|
45
|
+
it 'must save byebugtesting' do
|
46
|
+
file_contents.must_include 'set byebugtesting on'
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
50
|
-
file_contents.must_include
|
49
|
+
it 'must save autolist' do
|
50
|
+
file_contents.must_include 'set autolist on'
|
51
51
|
end
|
52
52
|
|
53
|
-
it
|
54
|
-
file_contents.must_include
|
53
|
+
it 'must save autoirb' do
|
54
|
+
file_contents.must_include 'set autoirb off'
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
it
|
58
|
+
it 'must show a message about successful saving' do
|
59
59
|
check_output_includes "Saved to '#{file_name}'"
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
64
|
+
describe 'without filename' do
|
65
65
|
let(:file_contents) { File.read(interface.restart_file) }
|
66
66
|
after { FileUtils.rm(interface.restart_file) }
|
67
67
|
|
68
|
-
it
|
69
|
-
enter
|
68
|
+
it 'must fabricate a filename if not provided' do
|
69
|
+
enter 'save'
|
70
70
|
debug_file 'save'
|
71
|
-
file_contents.must_include
|
71
|
+
file_contents.must_include 'set autoirb'
|
72
72
|
end
|
73
73
|
|
74
|
-
it
|
75
|
-
enter
|
74
|
+
it 'must show a message where the file is saved' do
|
75
|
+
enter 'save'
|
76
76
|
debug_file 'save'
|
77
77
|
check_output_includes "Saved to '#{interface.restart_file}'"
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
describe
|
81
|
+
describe 'Post Mortem' do
|
82
82
|
let(:file_name) { 'save_output.txt' }
|
83
|
-
|
84
|
-
|
85
|
-
it
|
86
|
-
skip("No post morten mode for now")
|
83
|
+
let(:file_contents) { File.read(file_name) }
|
84
|
+
after { FileUtils.rm(file_name) }
|
85
|
+
it 'must work in post-mortem mode' do
|
87
86
|
enter 'cont', "save #{file_name}"
|
88
87
|
debug_file 'post_mortem'
|
89
|
-
file_contents.must_include
|
88
|
+
file_contents.must_include 'set autoirb off'
|
90
89
|
end
|
91
90
|
end
|
92
91
|
|
data/test/set_test.rb
CHANGED
@@ -1,174 +1,177 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Set Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'setting to on' do
|
7
7
|
Byebug::Command.settings[:autolist] = 0
|
8
8
|
|
9
|
-
it
|
9
|
+
it 'must set a setting to on' do
|
10
10
|
enter 'set autolist on'
|
11
11
|
debug_file 'set'
|
12
12
|
Byebug::Command.settings[:autolist].must_equal 1
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it 'must set a setting to on by 1' do
|
16
16
|
enter 'set autolist 1'
|
17
17
|
debug_file 'set'
|
18
18
|
Byebug::Command.settings[:autolist].must_equal 1
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
21
|
+
it 'must set a setting to on by default' do
|
22
22
|
enter 'set autolist'
|
23
23
|
debug_file 'set'
|
24
24
|
Byebug::Command.settings[:autolist].must_equal 1
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
27
|
+
it 'must set a setting using shortcut' do
|
28
28
|
enter 'set autol'
|
29
29
|
debug_file 'set'
|
30
30
|
Byebug::Command.settings[:autolist].must_equal 1
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe
|
34
|
+
describe 'setting to off' do
|
35
35
|
Byebug::Command.settings[:autolist] = 1
|
36
36
|
|
37
|
-
it
|
37
|
+
it 'must set a setting to off' do
|
38
38
|
enter 'set autolist off'
|
39
39
|
debug_file 'set'
|
40
40
|
Byebug::Command.settings[:autolist].must_equal 0
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it 'must set a setting to off by 0' do
|
44
44
|
enter 'set autolist 0'
|
45
45
|
debug_file 'set'
|
46
46
|
Byebug::Command.settings[:autolist].must_equal 0
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
49
|
+
it 'must set a setting to off by "no" prefix' do
|
50
50
|
enter 'set noautolist'
|
51
51
|
debug_file 'set'
|
52
52
|
Byebug::Command.settings[:autolist].must_equal 0
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
describe
|
56
|
+
describe 'messages' do
|
57
57
|
Byebug::Command.settings[:autolist] = 0
|
58
58
|
|
59
|
-
it
|
59
|
+
it 'must show a message after setting' do
|
60
60
|
enter 'set autolist on'
|
61
61
|
debug_file 'set'
|
62
|
-
check_output_includes
|
62
|
+
check_output_includes 'autolist is on.'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
describe
|
67
|
-
it
|
66
|
+
describe 'byebugtesting' do
|
67
|
+
it 'must set $byebug_state if byebugsetting is on' do
|
68
68
|
enter 'set byebugtesting', 'break 3', 'cont'
|
69
69
|
debug_file('set') {
|
70
70
|
state.must_be_kind_of Byebug::CommandProcessor::State }
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
73
|
+
it 'must set basename on too' do
|
74
74
|
temporary_change_hash_value(Byebug::Command.settings, :basename, false) do
|
75
75
|
enter 'set byebugtesting', 'show basename'
|
76
76
|
debug_file('set')
|
77
|
-
check_output_includes
|
77
|
+
check_output_includes 'basename is on.'
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
it
|
81
|
+
it 'must not set $byebug_state if byebugsetting is off' do
|
82
82
|
enter 'set nobyebugtesting', 'break 3', 'cont'
|
83
83
|
debug_file('set') { $byebug_state.must_be_nil }
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
describe
|
88
|
-
describe
|
89
|
-
it
|
87
|
+
describe 'history' do
|
88
|
+
describe 'save' do
|
89
|
+
it 'must set history save to on' do
|
90
90
|
enter 'set history save on'
|
91
91
|
debug_file 'set'
|
92
92
|
interface.history_save.must_equal true
|
93
93
|
end
|
94
94
|
|
95
|
-
it
|
95
|
+
it 'must show a message' do
|
96
96
|
enter 'set history save on'
|
97
97
|
debug_file 'set'
|
98
|
-
check_output_includes
|
98
|
+
check_output_includes 'Saving of history save is on.'
|
99
99
|
end
|
100
100
|
|
101
|
-
it
|
101
|
+
it 'must set history save to off' do
|
102
102
|
enter 'set history save off'
|
103
103
|
debug_file 'set'
|
104
104
|
interface.history_save.must_equal false
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
describe
|
109
|
-
it
|
108
|
+
describe 'size' do
|
109
|
+
it 'must set history size' do
|
110
110
|
enter 'set history size 250'
|
111
111
|
debug_file 'set'
|
112
112
|
interface.history_length.must_equal 250
|
113
113
|
end
|
114
114
|
|
115
|
-
it
|
115
|
+
it 'must show a message' do
|
116
116
|
enter 'set history size 250'
|
117
117
|
debug_file 'set'
|
118
|
-
check_output_includes
|
118
|
+
check_output_includes 'Byebug history size is 250'
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
describe
|
123
|
-
it
|
122
|
+
describe 'filename' do
|
123
|
+
it 'must set history filename' do
|
124
124
|
enter 'set history filename .byebug-hist'
|
125
125
|
debug_file 'set'
|
126
|
-
interface.histfile.must_equal
|
126
|
+
interface.histfile.must_equal \
|
127
|
+
File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist')
|
127
128
|
end
|
128
129
|
|
129
|
-
it
|
130
|
+
it 'must show a message' do
|
130
131
|
enter 'set history filename .byebug-hist'
|
131
132
|
debug_file 'set'
|
132
|
-
check_output_includes
|
133
|
+
check_output_includes \
|
134
|
+
'The filename in which to record the command history is ' \
|
135
|
+
"\"#{File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist')}\""
|
133
136
|
end
|
134
137
|
end
|
135
138
|
|
136
|
-
it
|
139
|
+
it 'must show an error message if used wrong subcommand' do
|
137
140
|
enter 'set history bla 2'
|
138
141
|
debug_file 'set'
|
139
|
-
check_output_includes
|
142
|
+
check_output_includes \
|
143
|
+
'Invalid history parameter bla. Should be "filename", "save" or "size".'
|
140
144
|
end
|
141
145
|
|
142
|
-
it
|
146
|
+
it 'must show an error message if provided only one argument' do
|
143
147
|
enter 'set history save'
|
144
148
|
debug_file 'set'
|
145
|
-
check_output_includes
|
149
|
+
check_output_includes 'Need two parameters for "set history"; got 1.'
|
146
150
|
end
|
147
151
|
end
|
148
152
|
|
149
|
-
describe
|
153
|
+
describe 'width' do
|
150
154
|
Byebug::Command.settings[:width] = 20
|
151
155
|
|
152
|
-
it
|
153
|
-
old_columns = ENV[
|
156
|
+
it 'must set ENV[\'COLUMNS\'] by the "set width" command' do
|
157
|
+
old_columns = ENV['COLUMNS']
|
154
158
|
begin
|
155
159
|
enter 'set width 10'
|
156
160
|
debug_file 'set'
|
157
|
-
ENV[
|
161
|
+
ENV['COLUMNS'].must_equal '10'
|
158
162
|
ensure
|
159
|
-
ENV[
|
163
|
+
ENV['COLUMNS'] = old_columns
|
160
164
|
end
|
161
165
|
end
|
162
166
|
end
|
163
167
|
|
164
|
-
describe
|
168
|
+
describe 'Post Mortem' do
|
165
169
|
Byebug::Command.settings[:autolist] = 0
|
166
170
|
|
167
|
-
it
|
168
|
-
|
169
|
-
enter 'cont', "set autolist on"
|
171
|
+
it 'must work in post-mortem mode' do
|
172
|
+
enter 'cont', 'set autolist on'
|
170
173
|
debug_file 'post_mortem'
|
171
|
-
check_output_includes
|
174
|
+
check_output_includes 'autolist is on.'
|
172
175
|
end
|
173
176
|
end
|
174
177
|
|