byebug 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/bin/byebug +1 -2
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +50 -35
- data/ext/byebug/context.c +99 -45
- data/lib/byebug.rb +5 -10
- data/lib/byebug/command.rb +20 -12
- data/lib/byebug/commands/breakpoints.rb +1 -1
- data/lib/byebug/commands/control.rb +14 -21
- data/lib/byebug/commands/display.rb +4 -4
- data/lib/byebug/commands/enable.rb +20 -19
- data/lib/byebug/commands/eval.rb +1 -1
- data/lib/byebug/commands/finish.rb +4 -5
- data/lib/byebug/commands/info.rb +118 -116
- data/lib/byebug/commands/list.rb +72 -48
- data/lib/byebug/commands/reload.rb +4 -3
- data/lib/byebug/commands/set.rb +7 -16
- data/lib/byebug/commands/show.rb +2 -2
- data/lib/byebug/commands/threads.rb +7 -6
- data/lib/byebug/context.rb +10 -2
- data/lib/byebug/helper.rb +3 -3
- data/lib/byebug/processor.rb +1 -1
- data/lib/byebug/version.rb +1 -1
- data/old_doc/byebug.texi +45 -51
- data/test/breakpoints_test.rb +180 -195
- data/test/display_test.rb +59 -53
- data/test/eval_test.rb +0 -2
- data/test/examples/info.rb +5 -5
- data/test/examples/info_threads.rb +1 -1
- data/test/finish_test.rb +16 -15
- data/test/info_test.rb +9 -10
- data/test/irb_test.rb +64 -65
- data/test/list_test.rb +76 -50
- data/test/method_test.rb +10 -5
- data/test/post_mortem_test.rb +27 -25
- data/test/reload_test.rb +31 -31
- data/test/restart_test.rb +106 -110
- data/test/show_test.rb +8 -16
- data/test/stepping_test.rb +4 -2
- data/test/support/test_dsl.rb +37 -76
- data/test/test_helper.rb +0 -1
- data/test/variables_test.rb +9 -12
- metadata +4 -4
data/test/list_test.rb
CHANGED
@@ -1,167 +1,192 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'List Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'List Command (Setup)' do
|
7
|
+
|
7
8
|
before { LineCache.clear_file_cache }
|
8
|
-
after { LineCache.clear_file_cache }
|
9
9
|
|
10
|
-
describe
|
11
|
-
before
|
10
|
+
describe 'listsize' do
|
11
|
+
before do
|
12
|
+
Byebug::Command.settings[:listsize] = 3
|
13
|
+
Byebug::Command.settings[:autolist] = 0
|
14
|
+
end
|
12
15
|
|
13
|
-
it
|
16
|
+
it 'must show lines according to :listsize setting' do
|
14
17
|
enter 'set listsize 4', 'break 5', 'cont', 'list'
|
15
18
|
debug_file 'list'
|
16
19
|
check_output_includes "[3, 6] in #{fullpath('list')}"
|
17
20
|
end
|
18
21
|
|
19
|
-
it
|
22
|
+
it 'must not set it if the param is not an integer' do
|
20
23
|
enter 'set listsize 4.0', 'break 5', 'cont', 'list'
|
21
24
|
debug_file 'list'
|
22
25
|
check_output_includes "[4, 6] in #{fullpath('list')}"
|
23
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
|
45
|
+
|
24
46
|
end
|
25
47
|
|
26
|
-
describe
|
48
|
+
describe 'without arguments' do
|
27
49
|
before { Byebug::Command.settings[:listsize] = 3 }
|
28
50
|
|
29
|
-
it
|
51
|
+
it 'must show surrounding lines with the first call' do
|
30
52
|
enter 'break 5', 'cont', 'list'
|
31
53
|
debug_file 'list'
|
32
54
|
check_output_includes \
|
33
|
-
"[4, 6] in #{fullpath('list')}",
|
55
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
34
56
|
end
|
35
57
|
|
36
|
-
it
|
58
|
+
it 'must list forward after second call' do
|
37
59
|
enter 'break 5', 'cont', 'list', 'list'
|
38
60
|
debug_file 'list'
|
39
61
|
check_output_includes \
|
40
|
-
"[7, 9] in #{fullpath('list')}",
|
62
|
+
"[7, 9] in #{fullpath('list')}", '7 7', '8 8', '9 9'
|
41
63
|
end
|
42
64
|
end
|
43
65
|
|
44
|
-
describe
|
66
|
+
describe 'list backward' do
|
45
67
|
before { Byebug::Command.settings[:listsize] = 3 }
|
46
68
|
|
47
|
-
it
|
69
|
+
it 'must show surrounding lines with the first call' do
|
48
70
|
enter 'break 5', 'cont', 'list -'
|
49
71
|
debug_file 'list'
|
50
72
|
check_output_includes \
|
51
|
-
"[4, 6] in #{fullpath('list')}",
|
73
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
52
74
|
end
|
53
75
|
|
54
|
-
it
|
76
|
+
it 'must list backward after second call' do
|
55
77
|
enter 'break 5', 'cont', 'list -', 'list -'
|
56
78
|
debug_file 'list'
|
57
79
|
check_output_includes \
|
58
|
-
"[1, 3] in #{fullpath('list')}",
|
80
|
+
"[1, 3] in #{fullpath('list')}", '1 byebug', '2 2', '3 3'
|
59
81
|
end
|
60
82
|
end
|
61
83
|
|
62
84
|
|
63
|
-
describe
|
85
|
+
describe 'list surrounding' do
|
64
86
|
before { Byebug::Command.settings[:listsize] = 3 }
|
65
87
|
|
66
|
-
it
|
88
|
+
it 'must show the surrounding lines with =' do
|
67
89
|
enter 'break 5', 'cont', 'list ='
|
68
90
|
debug_file 'list'
|
69
91
|
check_output_includes \
|
70
|
-
"[4, 6] in #{fullpath('list')}",
|
92
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
71
93
|
end
|
72
94
|
end
|
73
95
|
|
74
|
-
describe
|
96
|
+
describe 'autolist' do
|
75
97
|
before { Byebug::Command.settings[:listsize] = 3 }
|
76
98
|
|
77
|
-
it
|
99
|
+
it 'must show the surronding lines after stop if autolist is enabled' do
|
78
100
|
enter 'set autolist', 'break 5', 'cont'
|
79
101
|
debug_file 'list'
|
80
102
|
check_output_includes \
|
81
|
-
"[4, 6] in #{fullpath('list')}",
|
103
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '=> 5 5', '6 6'
|
82
104
|
end
|
83
105
|
end
|
84
106
|
|
85
|
-
describe
|
107
|
+
describe 'specified lines' do
|
86
108
|
before { Byebug::Command.settings[:listsize] = 3 }
|
87
109
|
|
88
|
-
it
|
110
|
+
it 'must show with mm-nn' do
|
89
111
|
enter 'list 4-6'
|
90
112
|
debug_file 'list'
|
91
113
|
check_output_includes \
|
92
|
-
"[4, 6] in #{fullpath('list')}",
|
114
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '5 5', '6 6'
|
93
115
|
end
|
94
116
|
|
95
|
-
it
|
117
|
+
it 'must show with mm,nn' do
|
96
118
|
enter 'list 4,6'
|
97
119
|
debug_file 'list'
|
98
120
|
check_output_includes \
|
99
|
-
"[4, 6] in #{fullpath('list')}",
|
121
|
+
"[4, 6] in #{fullpath('list')}", '4 4', '5 5', '6 6'
|
100
122
|
end
|
101
123
|
|
102
|
-
it
|
124
|
+
it 'must show surroundings with mm-' do
|
103
125
|
enter 'list 4-'
|
104
126
|
debug_file 'list'
|
105
127
|
check_output_includes \
|
106
|
-
"[3, 5] in #{fullpath('list')}",
|
128
|
+
"[3, 5] in #{fullpath('list')}", '3 3', '4 4', '5 5'
|
107
129
|
end
|
108
130
|
|
109
|
-
it
|
131
|
+
it 'must show surroundings with mm,' do
|
110
132
|
enter 'list 4,'
|
111
133
|
debug_file 'list'
|
112
134
|
check_output_includes \
|
113
|
-
"[3, 5] in #{fullpath('list')}",
|
135
|
+
"[3, 5] in #{fullpath('list')}", '3 3', '4 4', '5 5'
|
114
136
|
end
|
115
137
|
|
116
|
-
it
|
138
|
+
it 'must show nothing if there is no such lines' do
|
117
139
|
enter 'list 44,44'
|
118
140
|
debug_file 'list'
|
119
|
-
|
141
|
+
check_error_includes 'Invalid line range'
|
142
|
+
check_output_doesnt_include "[44, 44] in #{fullpath('list')}"
|
120
143
|
check_output_doesnt_include /^44 \S/
|
121
144
|
end
|
122
145
|
|
123
|
-
it
|
146
|
+
it 'must show nothing if range is incorrect' do
|
124
147
|
enter 'list 5,4'
|
125
148
|
debug_file 'list'
|
126
149
|
check_output_includes "[5, 4] in #{fullpath('list')}"
|
127
|
-
check_output_doesnt_include
|
128
|
-
check_output_doesnt_include
|
150
|
+
check_output_doesnt_include '5 5'
|
151
|
+
check_output_doesnt_include '4 4'
|
129
152
|
end
|
130
153
|
end
|
131
154
|
|
132
|
-
describe
|
133
|
-
|
134
|
-
|
155
|
+
describe 'reload source' do
|
156
|
+
after do
|
157
|
+
change_line_in_file(fullpath('list'), 4, '4')
|
158
|
+
Byebug::Command.settings[:reload_source_on_change] = true
|
159
|
+
end
|
135
160
|
|
136
|
-
it
|
161
|
+
it 'must not reload if setting is false' do
|
137
162
|
enter 'set noautoreload', -> do
|
138
163
|
change_line_in_file(fullpath('list'), 4, '100')
|
139
164
|
'list 4-4'
|
140
165
|
end
|
141
166
|
debug_file 'list'
|
142
|
-
check_output_includes
|
167
|
+
check_output_includes '4 4'
|
143
168
|
end
|
144
169
|
|
145
|
-
it
|
170
|
+
it 'must reload if setting is true' do
|
146
171
|
enter 'set autoreload', -> do
|
147
172
|
change_line_in_file(fullpath('list'), 4, '100')
|
148
173
|
'list 4-4'
|
149
174
|
end
|
150
175
|
debug_file 'list'
|
151
|
-
check_output_includes
|
176
|
+
check_output_includes '4 100'
|
152
177
|
end
|
153
178
|
end
|
154
179
|
|
155
|
-
it
|
156
|
-
enter ->{state.file =
|
180
|
+
it 'must show an error when there is no such file' do
|
181
|
+
enter ->{state.file = 'blabla'; 'list 4-4'}
|
157
182
|
debug_file 'list'
|
158
|
-
check_output_includes
|
183
|
+
check_output_includes 'No sourcefile available for blabla',
|
159
184
|
interface.error_queue
|
160
185
|
end
|
161
186
|
|
162
|
-
describe
|
163
|
-
it
|
164
|
-
skip(
|
187
|
+
describe 'Post Mortem' do
|
188
|
+
it 'must work in post-mortem mode' do
|
189
|
+
skip('No post morten mode for now')
|
165
190
|
enter 'cont', 'list'
|
166
191
|
debug_file 'post_mortem'
|
167
192
|
check_output_includes "[7, 9] in #{fullpath('post_mortem')}"
|
@@ -169,4 +194,5 @@ describe "List Command" do
|
|
169
194
|
end
|
170
195
|
|
171
196
|
end
|
197
|
+
|
172
198
|
end
|
data/test/method_test.rb
CHANGED
@@ -3,8 +3,13 @@ require_relative 'test_helper'
|
|
3
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
|
-
# on my machine, it fails to build gem native
|
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
|
+
def after_setup
|
11
|
+
Byebug::Command.settings[:autolist] = 0
|
12
|
+
end
|
8
13
|
|
9
14
|
describe "show instance method of a class" do
|
10
15
|
it "must show using full command name" do
|
@@ -61,9 +66,9 @@ describe "Method Command" do
|
|
61
66
|
describe "Post Mortem" do
|
62
67
|
it "must work in post-mortem mode" do
|
63
68
|
skip("No post morten mode for now")
|
64
|
-
|
65
|
-
|
66
|
-
|
69
|
+
enter 'cont', 'm i self'
|
70
|
+
debug_file 'post_mortem'
|
71
|
+
check_output_includes /to_s/
|
67
72
|
end
|
68
73
|
end
|
69
74
|
|
data/test/post_mortem_test.rb
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
3
|
+
describe 'Post Mortem' do
|
4
|
+
include TestDsl
|
5
|
+
|
6
|
+
it 'must enter into post mortem mode' do
|
7
|
+
skip('No post morten mode for now')
|
8
|
+
enter 'cont'
|
9
|
+
debug_file('post_mortem') { Byebug.post_mortem?.must_equal true }
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'must stop at the correct line' do
|
13
|
+
skip('No post morten mode for now')
|
14
|
+
enter 'cont'
|
15
|
+
debug_file('post_mortem') { state.line.must_equal 8 }
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'must exit from post mortem mode after stepping command' do
|
19
|
+
skip('No post morten mode for now')
|
20
|
+
enter 'cont', 'break 12', 'cont'
|
21
|
+
debug_file('post_mortem') { Byebug.post_mortem?.must_equal false }
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'must save the raised exception' do
|
25
|
+
skip('No post morten mode for now')
|
26
|
+
enter 'cont'
|
27
|
+
debug_file('post_mortem') { Byebug.last_exception.must_be_kind_of RuntimeError }
|
28
|
+
end
|
29
|
+
end
|
data/test/reload_test.rb
CHANGED
@@ -1,49 +1,49 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Reload Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'autoreloading' do
|
7
|
+
after { Byebug::Command.settings[:reload_source_on_change] = true }
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
it "must notify that automatic reloading is off" do
|
9
|
+
it 'must notify that automatic reloading is on by default' do
|
11
10
|
enter 'reload'
|
12
11
|
debug_file 'reload'
|
13
|
-
check_output_includes
|
12
|
+
check_output_includes \
|
13
|
+
'Source code is reloaded. Automatic reloading is on.'
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
enter 'set
|
16
|
+
it 'must notify that automatic reloading is off if setting changed' do
|
17
|
+
enter 'set noautoreload', 'reload'
|
18
18
|
debug_file 'reload'
|
19
|
-
check_output_includes
|
19
|
+
check_output_includes \
|
20
|
+
'Source code is reloaded. Automatic reloading is off.'
|
20
21
|
end
|
22
|
+
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
24
|
+
describe 'reloading' do
|
25
|
+
after { change_line_in_file(fullpath('reload'), 4, '4') }
|
26
|
+
it 'must reload the code' do
|
27
|
+
enter 'break 3', 'cont', 'l 4-4', -> do
|
28
|
+
change_line_in_file(fullpath('reload'), 4, '100')
|
29
|
+
'reload'
|
30
|
+
end, 'l 4-4'
|
31
|
+
debug_file 'reload'
|
32
|
+
check_output_includes '4 100'
|
32
33
|
end
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
36
|
+
describe 'Post Mortem' do
|
37
|
+
after { change_line_in_file(fullpath('post_mortem'), 7, ' z = 4') }
|
38
|
+
it 'must work in post-mortem mode' do
|
39
|
+
skip('No post morten mode for now')
|
40
|
+
enter 'cont', -> do
|
41
|
+
change_line_in_file(fullpath('post_mortem'), 7, 'z = 100')
|
42
|
+
'reload'
|
43
|
+
end, 'l 7-7'
|
44
|
+
debug_file 'post_mortem'
|
45
|
+
check_output_includes '7 z = 100'
|
45
46
|
end
|
46
|
-
|
47
47
|
end
|
48
48
|
|
49
49
|
end
|
data/test/restart_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative 'test_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Restart Command' do
|
4
4
|
include TestDsl
|
5
5
|
|
6
6
|
def must_restart
|
@@ -8,150 +8,146 @@ describe "Restart Command (test setup)" do
|
|
8
8
|
Byebug::RestartCommand.any_instance.expects(:exec)
|
9
9
|
end
|
10
10
|
|
11
|
-
describe
|
12
|
-
|
11
|
+
describe 'usual restarting' do
|
13
12
|
before do
|
14
|
-
|
15
|
-
@old_hashes = {}
|
16
|
-
set_tmp_const(Byebug,
|
17
|
-
"INITIAL_DIR", Pathname.new(__FILE__ + "/../..").realpath.to_s)
|
18
|
-
set_tmp_const(Byebug,
|
19
|
-
"PROG_SCRIPT", Pathname.new(fullpath('restart')).
|
20
|
-
relative_path_from(Pathname.new(Byebug::INITIAL_DIR)).
|
21
|
-
cleanpath.to_s)
|
22
|
-
set_tmp_const(Byebug, "RDEBUG_SCRIPT", 'byebug_script')
|
23
|
-
set_tmp_hash(Byebug::Command.settings, :argv, ['argv'])
|
24
|
-
Byebug::RestartCommand.any_instance.stubs(:exec).
|
25
|
-
with("#{Byebug::RDEBUG_SCRIPT} argv")
|
26
|
-
end
|
27
|
-
|
28
|
-
after do
|
29
|
-
restore_tmp_const(Byebug, "INITIAL_DIR")
|
30
|
-
restore_tmp_const(Byebug, "PROG_SCRIPT")
|
31
|
-
restore_tmp_const(Byebug, "RDEBUG_SCRIPT")
|
32
|
-
restore_tmp_hash(Byebug::Command.settings, :argv)
|
13
|
+
force_set_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
33
14
|
end
|
34
15
|
|
35
|
-
it
|
16
|
+
it 'must be restarted with arguments' do
|
36
17
|
Byebug::RestartCommand.any_instance.expects(:exec).
|
37
|
-
|
18
|
+
with("#{Byebug::BYEBUG_SCRIPT} 1 2 3")
|
38
19
|
enter 'restart 1 2 3'
|
39
|
-
debug_file
|
20
|
+
debug_file 'restart'
|
40
21
|
end
|
41
22
|
|
42
|
-
it
|
43
|
-
Byebug::
|
44
|
-
|
23
|
+
it 'arguments must be correctly escaped' do
|
24
|
+
Byebug::Command.settings[:argv] = ['argv1', 'argv 2']
|
25
|
+
Byebug::RestartCommand.any_instance.expects(:exec).with \
|
26
|
+
"#{Byebug::BYEBUG_SCRIPT} argv1 argv\\ 2"
|
45
27
|
enter 'restart'
|
46
|
-
debug_file
|
28
|
+
debug_file 'restart'
|
47
29
|
end
|
48
30
|
|
49
|
-
it
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
31
|
+
it 'must specify arguments by "set" command' do
|
32
|
+
Byebug::Command.settings[:argv] = []
|
33
|
+
Byebug::RestartCommand.any_instance.expects(:exec).
|
34
|
+
with("#{Byebug::BYEBUG_SCRIPT} 1 2 3")
|
35
|
+
enter 'set args 1 2 3', 'restart'
|
36
|
+
debug_file 'restart'
|
56
37
|
end
|
38
|
+
end
|
57
39
|
|
58
|
-
|
59
|
-
|
40
|
+
describe 'messaging' do
|
41
|
+
before { enter 'restart' }
|
60
42
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
43
|
+
describe 'reexecing' do
|
44
|
+
it 'must restart and show a message about reexecing' do
|
45
|
+
force_set_const Byebug, 'BYEBUG_SCRIPT', 'byebug_script'
|
46
|
+
Byebug::Command.settings[:argv] = ['argv']
|
47
|
+
must_restart
|
48
|
+
debug_file 'restart'
|
49
|
+
check_output_includes \
|
50
|
+
"Re exec'ing:\n\t#{Byebug::BYEBUG_SCRIPT} argv"
|
68
51
|
end
|
52
|
+
end
|
69
53
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
after do
|
77
|
-
restore_tmp_const(Byebug, "PROG_SCRIPT")
|
78
|
-
restore_tmp_const(Byebug, "DEFAULT_START_SETTINGS")
|
79
|
-
end
|
80
|
-
|
81
|
-
it "must not restart and show error messages instead" do
|
82
|
-
must_restart.never
|
83
|
-
debug_file('restart')
|
84
|
-
check_output_includes "Don't know name of debugged program", interface.error_queue
|
85
|
-
end
|
54
|
+
describe 'no script specified and no $0 used instead' do
|
55
|
+
before do
|
56
|
+
force_unset_const Byebug, 'PROG_SCRIPT'
|
57
|
+
force_set_const Byebug,
|
58
|
+
'DEFAULT_START_SETTINGS',
|
59
|
+
init: false, post_mortem: false, tracing: nil
|
86
60
|
end
|
87
61
|
|
88
|
-
it
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
check_output_includes "Ruby program prog-0 doesn't exist", interface.error_queue
|
62
|
+
it 'must not restart and show error messages instead' do
|
63
|
+
must_restart.never
|
64
|
+
debug_file 'restart'
|
65
|
+
check_output_includes 'Don\'t know name of debugged program',
|
66
|
+
interface.error_queue
|
94
67
|
end
|
68
|
+
end
|
95
69
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
debug_file('restart')
|
102
|
-
end
|
103
|
-
|
104
|
-
it "must show an error message" do
|
105
|
-
debug_file('restart')
|
106
|
-
check_output_includes "Ruby program blabla doesn't exist", interface.error_queue
|
107
|
-
end
|
70
|
+
describe 'no script specified, $0 used instead' do
|
71
|
+
before do
|
72
|
+
@old_prog_name = $0
|
73
|
+
$0 = 'prog-0'
|
74
|
+
force_unset_const Byebug, 'PROG_SCRIPT'
|
108
75
|
end
|
76
|
+
after { $0 = @old_prog_name }
|
109
77
|
|
110
|
-
|
78
|
+
it 'must use prog_script from $0 if PROG_SCRIPT is undefined' do
|
79
|
+
debug_file 'restart'
|
80
|
+
check_output_includes 'Ruby program prog-0 doesn\'t exist',
|
81
|
+
interface.error_queue
|
82
|
+
end
|
83
|
+
end
|
111
84
|
|
112
|
-
|
113
|
-
|
85
|
+
describe 'no script at the specified path' do
|
86
|
+
before do
|
87
|
+
force_set_const Byebug, 'PROG_SCRIPT', 'blabla'
|
88
|
+
force_set_const Byebug,
|
89
|
+
'DEFAULT_START_SETTINGS',
|
90
|
+
init: false, post_mortem: false, tracing: nil
|
91
|
+
end
|
114
92
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
93
|
+
it 'must not restart' do
|
94
|
+
must_restart.never
|
95
|
+
debug_file 'restart'
|
96
|
+
end
|
119
97
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
98
|
+
it 'must show an error message' do
|
99
|
+
debug_file 'restart'
|
100
|
+
check_output_includes 'Ruby program blabla doesn\'t exist',
|
101
|
+
interface.error_queue
|
102
|
+
end
|
103
|
+
end
|
124
104
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
"executable... We'll add a call to Ruby."
|
129
|
-
end
|
105
|
+
describe 'byebug runner script is not specified' do
|
106
|
+
before do
|
107
|
+
must_restart
|
130
108
|
end
|
131
109
|
|
132
|
-
|
133
|
-
|
110
|
+
it 'must restart anyway' do
|
111
|
+
debug_file 'restart'
|
112
|
+
end
|
134
113
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
114
|
+
it 'must show a warning message' do
|
115
|
+
debug_file 'restart'
|
116
|
+
check_output_includes 'Byebug was not called from the outset...'
|
117
|
+
end
|
139
118
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
119
|
+
it 'must show a warning message when prog script is not executable' do
|
120
|
+
debug_file 'restart'
|
121
|
+
check_output_includes "Ruby program #{Byebug::PROG_SCRIPT} not " \
|
122
|
+
"executable... We'll add a call to Ruby."
|
144
123
|
end
|
145
124
|
end
|
146
125
|
|
147
|
-
describe
|
148
|
-
|
149
|
-
|
126
|
+
describe 'when can\'t change the dir to INITIAL_DIR' do
|
127
|
+
before do
|
128
|
+
force_set_const(Byebug, 'INITIAL_DIR', '/unexistent/path')
|
150
129
|
must_restart
|
151
|
-
|
152
|
-
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'must restart anyway' do
|
133
|
+
debug_file 'restart'
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'must show an error message ' do
|
137
|
+
debug_file 'restart'
|
138
|
+
check_output_includes \
|
139
|
+
'Failed to change initial directory /unexistent/path'
|
153
140
|
end
|
154
141
|
end
|
142
|
+
end
|
155
143
|
|
144
|
+
describe 'Post Mortem' do
|
145
|
+
it 'must work in post-mortem mode' do
|
146
|
+
skip('No post morten mode for now')
|
147
|
+
must_restart
|
148
|
+
enter 'cont', 'restart'
|
149
|
+
debug_file 'post_mortem'
|
150
|
+
end
|
156
151
|
end
|
152
|
+
|
157
153
|
end
|