byebug 3.0.0 → 3.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 +15 -0
- data/GUIDE.md +2 -2
- data/LICENSE +3 -3
- data/README.md +5 -4
- data/byebug.gemspec +1 -1
- data/ext/byebug/byebug.c +20 -19
- data/lib/byebug.rb +2 -53
- data/lib/byebug/command.rb +9 -109
- data/lib/byebug/commands/breakpoints.rb +1 -1
- data/lib/byebug/commands/control.rb +20 -21
- data/lib/byebug/commands/display.rb +2 -3
- data/lib/byebug/commands/eval.rb +6 -16
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/frame.rb +9 -9
- data/lib/byebug/commands/help.rb +2 -3
- data/lib/byebug/commands/history.rb +28 -0
- data/lib/byebug/commands/info.rb +3 -3
- data/lib/byebug/commands/list.rb +2 -13
- data/lib/byebug/commands/method.rb +5 -45
- data/lib/byebug/commands/reload.rb +1 -12
- data/lib/byebug/commands/repl.rb +6 -15
- data/lib/byebug/commands/save.rb +2 -7
- data/lib/byebug/commands/set.rb +45 -116
- data/lib/byebug/commands/show.rb +22 -126
- data/lib/byebug/commands/stepping.rb +1 -1
- data/lib/byebug/commands/trace.rb +14 -25
- data/lib/byebug/commands/variables.rb +3 -41
- data/lib/byebug/helper.rb +11 -42
- data/lib/byebug/history.rb +5 -13
- data/lib/byebug/processors/command_processor.rb +6 -6
- data/lib/byebug/setting.rb +82 -0
- data/lib/byebug/settings/autoeval.rb +20 -0
- data/lib/byebug/settings/autoirb.rb +19 -0
- data/lib/byebug/settings/autolist.rb +19 -0
- data/lib/byebug/settings/autoreload.rb +11 -0
- data/lib/byebug/settings/autosave.rb +11 -0
- data/lib/byebug/settings/basename.rb +7 -0
- data/lib/byebug/settings/callstyle.rb +15 -0
- data/lib/byebug/settings/forcestep.rb +11 -0
- data/lib/byebug/settings/fullpath.rb +11 -0
- data/lib/byebug/settings/histfile.rb +16 -0
- data/lib/byebug/settings/histsize.rb +18 -0
- data/lib/byebug/settings/linetrace.rb +15 -0
- data/lib/byebug/settings/listsize.rb +15 -0
- data/lib/byebug/settings/post_mortem.rb +15 -0
- data/lib/byebug/settings/stack_on_error.rb +7 -0
- data/lib/byebug/settings/testing.rb +7 -0
- data/lib/byebug/settings/tracing_plus.rb +7 -0
- data/lib/byebug/settings/verbose.rb +7 -0
- data/lib/byebug/settings/width.rb +29 -0
- data/lib/byebug/version.rb +1 -1
- data/test/breakpoints_test.rb +345 -324
- data/test/conditions_test.rb +61 -48
- data/test/continue_test.rb +38 -27
- data/test/debugger_alias_test.rb +5 -3
- data/test/display_test.rb +103 -92
- data/test/edit_test.rb +42 -34
- data/test/eval_test.rb +91 -75
- data/test/finish_test.rb +51 -40
- data/test/frame_test.rb +197 -184
- data/test/help_test.rb +47 -38
- data/test/history_test.rb +54 -0
- data/test/info_test.rb +306 -293
- data/test/interrupt_test.rb +44 -38
- data/test/kill_test.rb +40 -31
- data/test/list_test.rb +166 -133
- data/test/method_test.rb +67 -60
- data/test/post_mortem_test.rb +56 -48
- data/test/quit_test.rb +44 -35
- data/test/reload_test.rb +36 -24
- data/test/repl_test.rb +57 -47
- data/test/restart_test.rb +56 -69
- data/test/save_test.rb +62 -53
- data/test/set_test.rb +140 -118
- data/test/show_test.rb +68 -201
- data/test/source_test.rb +39 -29
- data/test/stepping_test.rb +163 -136
- data/test/support/test_dsl.rb +9 -11
- data/test/test_helper.rb +2 -7
- data/test/thread_test.rb +121 -107
- data/test/trace_test.rb +86 -83
- data/test/variables_test.rb +104 -98
- metadata +27 -86
- data/test/examples/breakpoint.rb +0 -6
- data/test/examples/breakpoint_deep.rb +0 -4
- data/test/examples/conditions.rb +0 -4
- data/test/examples/continue.rb +0 -5
- data/test/examples/display.rb +0 -5
- data/test/examples/edit.rb +0 -4
- data/test/examples/eval.rb +0 -4
- data/test/examples/finish.rb +0 -3
- data/test/examples/frame.rb +0 -4
- data/test/examples/frame_deep.rb +0 -1
- data/test/examples/gcd.rb +0 -15
- data/test/examples/hanoi.rb +0 -34
- data/test/examples/help.rb +0 -1
- data/test/examples/info.rb +0 -6
- data/test/examples/info2.rb +0 -3
- data/test/examples/interrupt.rb +0 -8
- data/test/examples/kill.rb +0 -2
- data/test/examples/list.rb +0 -23
- data/test/examples/method.rb +0 -4
- data/test/examples/post_mortem.rb +0 -4
- data/test/examples/primes.rb +0 -25
- data/test/examples/quit.rb +0 -2
- data/test/examples/reload.rb +0 -6
- data/test/examples/repl.rb +0 -6
- data/test/examples/restart.rb +0 -6
- data/test/examples/save.rb +0 -3
- data/test/examples/set.rb +0 -3
- data/test/examples/settings.rb +0 -1
- data/test/examples/show.rb +0 -1
- data/test/examples/source.rb +0 -3
- data/test/examples/stepping.rb +0 -8
- data/test/examples/stepping_raise_from_c_method.rb +0 -3
- data/test/examples/stepping_raise_from_ruby_method.rb +0 -3
- data/test/examples/test-triangle.rb +0 -14
- data/test/examples/thread.rb +0 -5
- data/test/examples/tmate.rb +0 -10
- data/test/examples/trace.rb +0 -8
- data/test/examples/tri3.rb +0 -6
- data/test/examples/triangle.rb +0 -13
- data/test/examples/variables.rb +0 -4
- data/test/timeout_test.rb +0 -9
data/test/conditions_test.rb
CHANGED
@@ -1,69 +1,82 @@
|
|
1
|
-
|
1
|
+
module ConditionsTest
|
2
|
+
class ConditionsTestCase < TestDsl::TestCase
|
3
|
+
before do
|
4
|
+
@example = lambda do
|
5
|
+
byebug
|
6
|
+
b = 5
|
7
|
+
c = b + 5
|
8
|
+
c = Object.new
|
9
|
+
end
|
10
|
+
end
|
2
11
|
|
3
|
-
|
4
|
-
|
12
|
+
def first
|
13
|
+
Byebug.breakpoints.first
|
14
|
+
end
|
5
15
|
|
6
|
-
describe '
|
7
|
-
before { enter
|
16
|
+
describe 'setting condition' do
|
17
|
+
before { enter 'break 7' }
|
8
18
|
|
9
|
-
|
10
|
-
|
11
|
-
Byebug.breakpoints.first.expr.must_equal 'b == 5' }
|
12
|
-
end
|
19
|
+
describe 'successfully' do
|
20
|
+
before { enter ->{ "cond #{first.id} b == 5" }, 'cont' }
|
13
21
|
|
14
|
-
|
15
|
-
|
16
|
-
|
22
|
+
it 'must assign the expression to breakpoint' do
|
23
|
+
debug_proc(@example) { first.expr.must_equal 'b == 5' }
|
24
|
+
end
|
17
25
|
|
18
|
-
|
19
|
-
|
26
|
+
it 'must stop at the breakpoint if condition is true' do
|
27
|
+
debug_proc(@example) { state.line.must_equal 7 }
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'must work with full command name too' do
|
31
|
+
debug_proc(@example) { state.line.must_equal 7 }
|
32
|
+
end
|
20
33
|
end
|
21
|
-
end
|
22
34
|
|
23
|
-
|
24
|
-
|
35
|
+
describe 'unsuccessfully' do
|
36
|
+
before { enter 'break 8' }
|
25
37
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
38
|
+
it 'must not stop at the breakpoint if condition is false' do
|
39
|
+
enter ->{ "cond #{first.id} b == 3" }, 'cont'
|
40
|
+
debug_proc(@example) { state.line.must_equal 8 }
|
41
|
+
end
|
30
42
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
43
|
+
it 'must assign expression to breakpoint in spite of incorrect syntax' do
|
44
|
+
enter ->{ "cond #{first.id} b =="}, 'cont'
|
45
|
+
debug_proc(@example) { first.expr.must_equal 'b ==' }
|
46
|
+
end
|
36
47
|
|
37
|
-
|
38
|
-
|
39
|
-
|
48
|
+
it 'must ignore the condition if when incorrect syntax' do
|
49
|
+
enter ->{ "cond #{first.id} b ==" }, 'cont'
|
50
|
+
debug_proc(@example) { state.line.must_equal 8 }
|
51
|
+
end
|
40
52
|
end
|
41
53
|
end
|
42
|
-
end
|
43
54
|
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
describe 'removing conditions' do
|
56
|
+
before do
|
57
|
+
enter 'break 7 if b == 3', 'break 8', -> { "cond #{first.id}" }, 'cont'
|
58
|
+
end
|
47
59
|
|
48
|
-
|
49
|
-
|
50
|
-
|
60
|
+
it 'must remove the condition from the breakpoint' do
|
61
|
+
debug_proc(@example) { first.expr.must_be_nil }
|
62
|
+
end
|
51
63
|
|
52
|
-
|
53
|
-
|
64
|
+
it 'must unconditionally stop on the breakpoint' do
|
65
|
+
debug_proc(@example) { state.line.must_equal 7 }
|
66
|
+
end
|
54
67
|
end
|
55
|
-
end
|
56
68
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
69
|
+
describe 'errors' do
|
70
|
+
it 'must show error if there are no breakpoints' do
|
71
|
+
enter 'cond 1 true'
|
72
|
+
debug_proc(@example)
|
73
|
+
check_output_includes 'No breakpoints have been set.'
|
74
|
+
end
|
63
75
|
|
64
|
-
|
65
|
-
|
66
|
-
|
76
|
+
it 'must not set breakpoint condition if breakpoint id is incorrect' do
|
77
|
+
enter 'break 7', 'cond 8 b == 3', 'cont'
|
78
|
+
debug_proc(@example) { state.line.must_equal 7 }
|
79
|
+
end
|
67
80
|
end
|
68
81
|
end
|
69
82
|
end
|
data/test/continue_test.rb
CHANGED
@@ -1,39 +1,50 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
num
|
1
|
+
module ContinueTest
|
2
|
+
class Example
|
3
|
+
def self.a(num)
|
4
|
+
num + 4
|
5
|
+
end
|
4
6
|
end
|
5
|
-
end
|
6
7
|
|
7
|
-
class
|
8
|
+
class ContinueTestCase < TestDsl::TestCase
|
9
|
+
before do
|
10
|
+
@example = lambda do
|
11
|
+
byebug
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
+
b = 5
|
14
|
+
c = b + 5
|
15
|
+
Example.a(c)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
describe 'successful' do
|
20
|
+
it 'must continue up to breakpoint if no line specified' do
|
21
|
+
enter 'break 14', 'continue'
|
22
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
23
|
+
end
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
+
it 'must work in abbreviated mode too' do
|
26
|
+
enter 'break 14', 'cont'
|
27
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
28
|
+
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
it 'must continue up to specified line' do
|
31
|
+
enter 'cont 14'
|
32
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
|
-
|
33
|
-
enter 'cont
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
describe 'unsuccessful' do
|
37
|
+
before { enter 'cont 100' }
|
38
|
+
|
39
|
+
it 'must ignore the command if specified line is not valid' do
|
40
|
+
debug_proc(@example) { state.line.must_equal 13 }
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'must show error if specified line is not valid' do
|
44
|
+
debug_proc(@example)
|
45
|
+
check_error_includes \
|
46
|
+
"Line 100 is not a stopping point in file \"#{__FILE__}\""
|
47
|
+
end
|
37
48
|
end
|
38
49
|
end
|
39
50
|
end
|
data/test/debugger_alias_test.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module DebuggerAliasTest
|
2
|
+
class DebuggerAliasSpec < MiniTest::Spec
|
3
|
+
it 'aliases "debugger" to "byebug"' do
|
4
|
+
Kernel.method(:debugger).must_equal(Kernel.method(:byebug))
|
5
|
+
end
|
4
6
|
end
|
5
7
|
end
|
data/test/display_test.rb
CHANGED
@@ -1,124 +1,135 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module DisplayTest
|
2
|
+
class DisplayTestCase < TestDsl::TestCase
|
3
|
+
before do
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
6
|
+
d = 4
|
7
|
+
d = d + 2
|
8
|
+
d = d + 3
|
9
|
+
d = d + 6
|
10
|
+
end
|
11
|
+
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
it 'must show expressions' do
|
14
|
+
enter 'break 7', 'cont', 'display d + 1'
|
15
|
+
debug_proc(@example)
|
16
|
+
check_output_includes '1: ', 'd + 1 = 5'
|
17
|
+
end
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
it 'must work with shortcut' do
|
20
|
+
enter 'break 7', 'cont', 'disp d + 1'
|
21
|
+
debug_proc(@example)
|
22
|
+
check_output_includes '1: ', 'd + 1 = 5'
|
23
|
+
end
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
it 'must save displayed expressions' do
|
26
|
+
enter 'display d + 1'
|
27
|
+
debug_proc(@example) { state.display.must_equal [[true, 'd + 1']] }
|
23
28
|
end
|
24
|
-
debug_file 'display'
|
25
|
-
check_output_includes '1: ', 'abc = nil', '2: ', 'd = 4'
|
26
|
-
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
enter 'break 3', 'cont', -> do
|
32
|
-
Byebug.handler.display.concat([[true, 'abc'], [true, 'd']])
|
33
|
-
'undisplay'
|
34
|
-
end, confirm_response, 'display'
|
30
|
+
it 'displays all expressions available' do
|
31
|
+
enter 'break 7', 'cont', -> do
|
32
|
+
Byebug.handler.display.concat([[true, 'abc'], [true, 'd']]); 'display'
|
35
33
|
end
|
34
|
+
debug_proc(@example)
|
35
|
+
check_output_includes '1: ', 'abc = nil', '2: ', 'd = 4'
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
describe 'undisplay' do
|
39
|
+
describe 'undisplay all' do
|
40
|
+
before do
|
41
|
+
enter 'break 7', 'cont', -> do
|
42
|
+
Byebug.handler.display.concat([[true, 'abc'], [true, 'd']])
|
43
|
+
'undisplay'
|
44
|
+
end, confirm_response, 'display'
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
describe 'confirmation is successful' do
|
48
|
+
let(:confirm_response) { 'y' }
|
49
|
+
|
50
|
+
it 'must ask about confirmation' do
|
51
|
+
debug_proc(@example)
|
52
|
+
check_output_includes \
|
53
|
+
'Clear all expressions? (y/n)', interface.confirm_queue
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'must set all expressions saved to "false"' do
|
57
|
+
debug_proc(@example) { state.display.must_equal [[false, 'abc'],
|
58
|
+
[false, 'd']] }
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'must not show any output' do
|
62
|
+
debug_proc(@example)
|
63
|
+
check_output_doesnt_include '1: ', 'abc = nil', '2: ', 'd = 4'
|
64
|
+
end
|
49
65
|
end
|
50
66
|
|
51
|
-
|
52
|
-
|
53
|
-
|
67
|
+
describe 'confirmation is unsuccessful' do
|
68
|
+
let(:confirm_response) { 'n' }
|
69
|
+
|
70
|
+
it 'must set all expressions saved to "false"' do
|
71
|
+
debug_proc(@example) { state.display.must_equal [[true, 'abc'],
|
72
|
+
[true, 'd']] }
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'must not show any output' do
|
76
|
+
debug_proc(@example)
|
77
|
+
check_output_includes '1: ', 'abc = nil', '2: ', 'd = 4'
|
78
|
+
end
|
54
79
|
end
|
55
80
|
end
|
56
81
|
|
57
|
-
describe '
|
58
|
-
|
82
|
+
describe 'undisplay specific position' do
|
83
|
+
before do
|
84
|
+
enter 'break 7', 'cont', -> do
|
85
|
+
Byebug.handler.display.concat([[true, 'abc'], [true, 'd']])
|
86
|
+
'undisplay 1'
|
87
|
+
end, 'display'
|
88
|
+
end
|
59
89
|
|
60
|
-
it 'must set
|
61
|
-
|
90
|
+
it 'must set inactive positions' do
|
91
|
+
debug_proc(@example) { state.display.must_equal [[nil, 'abc'],
|
62
92
|
[true, 'd']] }
|
63
93
|
end
|
64
94
|
|
65
|
-
it 'must
|
66
|
-
|
67
|
-
check_output_includes '
|
95
|
+
it 'must display only the active position' do
|
96
|
+
debug_proc(@example)
|
97
|
+
check_output_includes '2: ', 'd = 4'
|
68
98
|
end
|
69
|
-
end
|
70
|
-
end
|
71
99
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
'undisplay 1'
|
77
|
-
end, 'display'
|
100
|
+
it 'must not display the disabled position' do
|
101
|
+
debug_proc(@example)
|
102
|
+
check_output_doesnt_include '1: ', 'abc'
|
103
|
+
end
|
78
104
|
end
|
105
|
+
end
|
79
106
|
|
80
|
-
|
81
|
-
|
82
|
-
|
107
|
+
describe 'disable' do
|
108
|
+
it 'must disable a position' do
|
109
|
+
enter 'display d', 'disable display 1'
|
110
|
+
debug_proc(@example) { state.display.must_equal [[false, 'd']] }
|
83
111
|
end
|
84
112
|
|
85
|
-
it 'must
|
86
|
-
|
87
|
-
|
113
|
+
it 'must show an error if no displays are set' do
|
114
|
+
enter 'disable display 1'
|
115
|
+
debug_proc(@example)
|
116
|
+
check_output_includes \
|
117
|
+
'No display expressions have been set.', interface.error_queue
|
88
118
|
end
|
89
119
|
|
90
|
-
it 'must
|
91
|
-
|
92
|
-
|
120
|
+
it 'must show an error if there is no such display position' do
|
121
|
+
enter 'display d', 'disable display 4'
|
122
|
+
debug_proc(@example)
|
123
|
+
check_output_includes \
|
124
|
+
'"disable display" argument "4" needs to be at most 1'
|
93
125
|
end
|
94
126
|
end
|
95
|
-
end
|
96
127
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
it 'must show an error if no displays are set' do
|
104
|
-
enter 'disable display 1'
|
105
|
-
debug_file 'display'
|
106
|
-
check_output_includes \
|
107
|
-
'No display expressions have been set.', interface.error_queue
|
108
|
-
end
|
109
|
-
|
110
|
-
it 'must show an error if there is no such display position' do
|
111
|
-
enter 'display d', 'disable display 4'
|
112
|
-
debug_file 'display'
|
113
|
-
check_output_includes \
|
114
|
-
'"disable display" argument "4" needs to be at most 1.'
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe 'enable' do
|
119
|
-
it 'must enable a position' do
|
120
|
-
enter 'display d', 'disable display 1', 'enable display 1'
|
121
|
-
debug_file('display') { state.display.must_equal [[true, 'd']] }
|
128
|
+
describe 'enable' do
|
129
|
+
it 'must enable a position' do
|
130
|
+
enter 'display d', 'disable display 1', 'enable display 1'
|
131
|
+
debug_proc(@example) { state.display.must_equal [[true, 'd']] }
|
132
|
+
end
|
122
133
|
end
|
123
134
|
end
|
124
135
|
end
|
data/test/edit_test.rb
CHANGED
@@ -1,47 +1,55 @@
|
|
1
|
-
|
1
|
+
module EditTest
|
2
|
+
class EditTestCase < TestDsl::TestCase
|
3
|
+
before do
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
6
|
+
Object.new
|
7
|
+
end
|
8
|
+
end
|
2
9
|
|
3
|
-
|
4
|
-
|
10
|
+
describe 'open configured editor' do
|
11
|
+
temporary_change_hash ENV, 'EDITOR', 'editr'
|
5
12
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
it 'must open current file in current line in configured editor' do
|
14
|
+
file = __FILE__
|
15
|
+
Byebug::EditCommand.any_instance.expects(:system).with("editr +6 #{file}")
|
16
|
+
enter 'edit'
|
17
|
+
debug_proc(@example)
|
18
|
+
end
|
11
19
|
end
|
12
|
-
end
|
13
20
|
|
14
|
-
|
15
|
-
|
21
|
+
describe 'open default editor' do
|
22
|
+
temporary_change_hash ENV, 'EDITOR', nil
|
16
23
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
it 'must call "vim" with current line and file if EDITOR env not set' do
|
25
|
+
file = __FILE__
|
26
|
+
Byebug::EditCommand.any_instance.expects(:system).with("vim +6 #{file}")
|
27
|
+
enter 'edit'
|
28
|
+
debug_proc(@example)
|
29
|
+
end
|
22
30
|
end
|
23
|
-
end
|
24
31
|
|
25
|
-
|
26
|
-
|
32
|
+
describe 'open configured editor specifying line and file' do
|
33
|
+
temporary_change_hash ENV, 'EDITOR', 'editr'
|
27
34
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
it 'must open specified line in specified file with configured editor' do
|
36
|
+
file = File.expand_path('test/test_helper.rb')
|
37
|
+
Byebug::EditCommand.any_instance.expects(:system).with("editr +3 #{file}")
|
38
|
+
enter "edit #{file}:3"
|
39
|
+
debug_proc(@example)
|
40
|
+
end
|
33
41
|
end
|
34
|
-
end
|
35
42
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
it 'must show an error if there is no such file' do
|
44
|
+
enter "edit no_such_file:6"
|
45
|
+
debug_proc(@example)
|
46
|
+
check_error_includes 'File "no_such_file" is not readable.'
|
47
|
+
end
|
41
48
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
it 'must show an error if there is incorrect syntax' do
|
50
|
+
enter 'edit blabla'
|
51
|
+
debug_proc(@example)
|
52
|
+
check_error_includes 'Invalid file[:line] number specification: blabla'
|
53
|
+
end
|
46
54
|
end
|
47
55
|
end
|