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/eval_test.rb
CHANGED
@@ -1,103 +1,119 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
a
|
4
|
-
|
1
|
+
module EvalTest
|
2
|
+
class Example
|
3
|
+
def sum(a,b)
|
4
|
+
a + b
|
5
|
+
end
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
def inspect
|
8
|
+
raise "Broken"
|
9
|
+
end
|
8
10
|
end
|
9
|
-
end
|
10
11
|
|
11
|
-
class
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
class EvalTestCase < TestDsl::TestCase
|
13
|
+
before do
|
14
|
+
@example = -> do
|
15
|
+
byebug
|
16
|
+
@foo = Example.new
|
17
|
+
@foo.sum(1, 2)
|
18
|
+
end
|
19
|
+
end
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
it 'must evaluate an expression' do
|
22
|
+
enter 'eval 3 + 2'
|
23
|
+
debug_proc(@example)
|
24
|
+
check_output_includes '5'
|
25
|
+
end
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
it 'must evaluate expression that calls Timeout::timeout' do
|
28
|
+
enter 'eval Timeout::timeout(60) { 1 }'
|
29
|
+
debug_proc(@example)
|
30
|
+
check_output_includes '1'
|
31
|
+
end
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
it 'must work with shortcut' do
|
34
|
+
enter 'e 3 + 2'
|
35
|
+
debug_proc(@example)
|
36
|
+
check_output_includes '5'
|
37
|
+
end
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
check_output_includes '18'
|
39
|
+
it 'must work with another syntax' do
|
40
|
+
enter 'p 3 + 2'
|
41
|
+
debug_proc(@example)
|
42
|
+
check_output_includes '5'
|
41
43
|
end
|
42
44
|
|
43
|
-
it '
|
44
|
-
enter '
|
45
|
-
|
46
|
-
|
47
|
-
check_output_doesnt_include '18'
|
48
|
-
check_output_includes '6'
|
45
|
+
it 'must work when inspect raises an exception' do
|
46
|
+
enter 'c 17', 'p @foo'
|
47
|
+
debug_proc(@example) { state.line.must_equal 17 }
|
48
|
+
check_output_includes 'RuntimeError Exception: Broken'
|
49
49
|
end
|
50
|
-
end
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
describe 'autoeval' do
|
52
|
+
it 'must be set by default' do
|
53
|
+
enter '[5, 6 , 7].inject(&:+)'
|
54
|
+
debug_proc(@example)
|
55
|
+
check_output_includes '18'
|
56
|
+
end
|
55
57
|
|
56
|
-
it '
|
57
|
-
enter '
|
58
|
-
|
59
|
-
|
60
|
-
check_output_doesnt_include '
|
58
|
+
it 'can be turned off and back on' do
|
59
|
+
enter 'set noautoeval', '[5, 6, 7].inject(&:+)',
|
60
|
+
'set autoeval', '[1, 2, 3].inject(&:+)'
|
61
|
+
debug_proc(@example)
|
62
|
+
check_output_doesnt_include '18'
|
63
|
+
check_output_includes '6'
|
61
64
|
end
|
62
65
|
end
|
63
66
|
|
64
|
-
describe '
|
65
|
-
|
67
|
+
describe 'stack trace on error' do
|
68
|
+
describe 'when enabled' do
|
69
|
+
temporary_change_hash Byebug::Setting, :stack_on_error, true
|
70
|
+
|
71
|
+
it 'must show a stack trace' do
|
72
|
+
enter 'eval 2 / 0'
|
73
|
+
debug_proc(@example)
|
74
|
+
check_output_includes(/\s*from \S+:in \`eval\'/)
|
75
|
+
check_output_doesnt_include 'ZeroDivisionError Exception: divided by 0'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe 'when disabled' do
|
80
|
+
temporary_change_hash Byebug::Setting, :stack_on_error, false
|
66
81
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
82
|
+
it 'must only show exception' do
|
83
|
+
enter 'eval 2 / 0'
|
84
|
+
debug_proc(@example)
|
85
|
+
check_output_includes 'ZeroDivisionError Exception: divided by 0'
|
86
|
+
check_output_doesnt_include(/\S+:\d+:in `eval':divided by 0/)
|
87
|
+
end
|
72
88
|
end
|
73
89
|
end
|
74
|
-
end
|
75
90
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
91
|
+
describe 'pp' do
|
92
|
+
it 'must pretty print the expression result' do
|
93
|
+
enter 'pp {a: \'3\' * 40, b: \'4\' * 30}'
|
94
|
+
debug_proc(@example)
|
95
|
+
check_output_includes "{:a=>\"#{'3' * 40}\",\n :b=>\"#{'4' * 30}\"}"
|
96
|
+
end
|
81
97
|
end
|
82
|
-
end
|
83
98
|
|
84
|
-
|
85
|
-
|
99
|
+
describe 'putl' do
|
100
|
+
temporary_change_hash Byebug::Setting, :width, 20
|
86
101
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
102
|
+
it 'must print expression and columnize the result' do
|
103
|
+
enter 'putl [1, 2, 3, 4, 5, 9, 8, 7, 6]'
|
104
|
+
debug_proc(@example)
|
105
|
+
check_output_includes "1 3 5 8 6\n2 4 9 7"
|
106
|
+
end
|
91
107
|
end
|
92
|
-
end
|
93
108
|
|
94
|
-
|
95
|
-
|
109
|
+
describe 'ps' do
|
110
|
+
temporary_change_hash Byebug::Setting, :width, 20
|
96
111
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
112
|
+
it 'must print expression and sort and columnize the result' do
|
113
|
+
enter 'ps [1, 2, 3, 4, 5, 9, 8, 7, 6]'
|
114
|
+
debug_proc(@example)
|
115
|
+
check_output_includes "1 3 5 7 9\n2 4 6 8"
|
116
|
+
end
|
101
117
|
end
|
102
118
|
end
|
103
119
|
end
|
data/test/finish_test.rb
CHANGED
@@ -1,53 +1,64 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
c
|
7
|
-
2
|
8
|
-
end
|
9
|
-
def c
|
10
|
-
d
|
11
|
-
3
|
12
|
-
end
|
13
|
-
def d
|
14
|
-
5
|
15
|
-
end
|
16
|
-
end
|
1
|
+
module FinishTest
|
2
|
+
class Example
|
3
|
+
def a
|
4
|
+
b
|
5
|
+
end
|
17
6
|
|
18
|
-
|
19
|
-
|
7
|
+
def b
|
8
|
+
c
|
9
|
+
2
|
10
|
+
end
|
20
11
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
def c
|
13
|
+
d
|
14
|
+
3
|
15
|
+
end
|
25
16
|
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
def d
|
18
|
+
5
|
19
|
+
end
|
29
20
|
end
|
30
21
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
class FinishTestCase < TestDsl::TestCase
|
23
|
+
before do
|
24
|
+
@example = -> do
|
25
|
+
byebug
|
26
|
+
Example.new.a
|
27
|
+
end
|
28
|
+
enter 'break 18', 'cont'
|
29
|
+
end
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
it 'must stop after current frame is finished when without arguments' do
|
32
|
+
enter 'finish'
|
33
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
34
|
+
end
|
40
35
|
|
41
|
-
|
42
|
-
|
36
|
+
it 'must stop before current frame finishes if 0 specified as argument' do
|
37
|
+
enter 'finish 0'
|
38
|
+
debug_proc(@example) { state.line.must_equal 19 }
|
39
|
+
end
|
43
40
|
|
44
|
-
it 'must
|
45
|
-
|
46
|
-
|
41
|
+
it 'must stop after current frame is finished if 1 specified as argument' do
|
42
|
+
enter 'finish 1'
|
43
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
47
44
|
end
|
48
45
|
|
49
|
-
it 'must
|
50
|
-
|
46
|
+
it 'must behave consistenly even if current frame has been changed' do
|
47
|
+
enter 'up', 'finish'
|
48
|
+
debug_proc(@example) { state.line.must_equal 9 }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'not a number is specified for frame' do
|
52
|
+
before { enter 'finish foo' }
|
53
|
+
|
54
|
+
it 'must show an error' do
|
55
|
+
debug_proc(@example)
|
56
|
+
check_output_includes '"finish" argument "foo" needs to be a number'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'must be on the same line' do
|
60
|
+
debug_proc(@example) { state.line.must_equal 18 }
|
61
|
+
end
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
data/test/frame_test.rb
CHANGED
@@ -1,228 +1,241 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
def d(e)
|
21
|
-
5
|
1
|
+
module FrameTest
|
2
|
+
class Example
|
3
|
+
def initialize(f)
|
4
|
+
@f = f
|
5
|
+
end
|
6
|
+
def a
|
7
|
+
b
|
8
|
+
end
|
9
|
+
def b
|
10
|
+
c
|
11
|
+
2
|
12
|
+
end
|
13
|
+
def c
|
14
|
+
d('a')
|
15
|
+
3
|
16
|
+
end
|
17
|
+
def d(e)
|
18
|
+
5
|
19
|
+
end
|
22
20
|
end
|
23
|
-
end
|
24
21
|
|
25
|
-
class
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
22
|
+
class DeepExample
|
23
|
+
def a
|
24
|
+
z = 1
|
25
|
+
z += b
|
26
|
+
end
|
27
|
+
def b
|
28
|
+
z = 2
|
29
|
+
z += c
|
30
|
+
end
|
31
|
+
def c
|
32
|
+
z = 3
|
33
|
+
byebug
|
34
|
+
z += d('a')
|
35
|
+
end
|
36
|
+
def d(e)
|
37
|
+
4
|
38
|
+
end
|
41
39
|
end
|
42
|
-
end
|
43
40
|
|
44
|
-
class
|
45
|
-
describe 'when byebug started at the beginning' do
|
41
|
+
class FrameTestCase < TestDsl::TestCase
|
46
42
|
before do
|
47
|
-
@
|
48
|
-
|
43
|
+
@example = -> do
|
44
|
+
byebug
|
45
|
+
fr_ex = Example.new('f')
|
46
|
+
fr_ex.a()
|
47
|
+
end
|
49
48
|
end
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
describe 'when byebug started at the beginning' do
|
51
|
+
before do
|
52
|
+
enter "break #{__FILE__}:18", 'cont'
|
53
|
+
end
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
it 'must go up' do
|
56
|
+
enter 'up'
|
57
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
58
|
+
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
it 'must go up by specific number of frames' do
|
61
|
+
enter 'up 2'
|
62
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
63
|
+
end
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
it 'must go down' do
|
66
|
+
enter 'up', 'down'
|
67
|
+
debug_proc(@example) { state.line.must_equal 18 }
|
68
|
+
end
|
70
69
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
it 'must go down by specific number of frames' do
|
71
|
+
enter 'up 3', 'down 2'
|
72
|
+
debug_proc(@example) { state.line.must_equal 14 }
|
73
|
+
end
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
75
|
+
it 'must set frame' do
|
76
|
+
enter 'frame 2'
|
77
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
78
|
+
end
|
81
79
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
it 'must print current stack frame when without arguments' do
|
81
|
+
enter 'up', 'frame'
|
82
|
+
debug_proc(@example)
|
83
|
+
check_output_includes(/#1 FrameTest::Example\.c\s+at #{__FILE__}:14/)
|
84
|
+
end
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
it 'must set frame to the first one' do
|
87
|
+
enter 'up', 'frame 0'
|
88
|
+
debug_proc(@example) { state.line.must_equal 18 }
|
89
|
+
end
|
91
90
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
"Can't navigate beyond the newest frame", interface.error_queue
|
97
|
-
end
|
91
|
+
it 'must set frame to the last one' do
|
92
|
+
enter 'frame -1'
|
93
|
+
debug_proc(@example) { File.basename(state.file).must_equal 'test_helper.rb' }
|
94
|
+
end
|
98
95
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
96
|
+
it 'must not set frame if the frame number is too low' do
|
97
|
+
enter 'down'
|
98
|
+
debug_proc(@example) { state.line.must_equal 18 }
|
99
|
+
check_output_includes \
|
100
|
+
"Can't navigate beyond the newest frame", interface.error_queue
|
101
|
+
end
|
105
102
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
enter 'where'
|
112
|
-
debug_file 'frame'
|
113
|
-
check_output_includes(
|
114
|
-
/--> #0 FrameExample\.d\(e#String\)\s+at #{__FILE__}:21/,
|
115
|
-
/#1 FrameExample\.c\s+at #{__FILE__}:16/,
|
116
|
-
/#2 FrameExample\.b\s+at #{__FILE__}:11/)
|
117
|
-
end
|
103
|
+
it 'must not set frame if the frame number is too high' do
|
104
|
+
enter 'up 100'
|
105
|
+
debug_proc(@example) { state.line.must_equal 18 }
|
106
|
+
check_output_includes \
|
107
|
+
"Can't navigate beyond the oldest frame", interface.error_queue
|
118
108
|
end
|
119
109
|
|
120
|
-
describe '
|
121
|
-
|
110
|
+
describe 'fullpath' do
|
111
|
+
describe 'when set' do
|
112
|
+
temporary_change_hash Byebug::Setting, :fullpath, true
|
122
113
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
114
|
+
it 'must display current backtrace with fullpaths' do
|
115
|
+
enter 'where'
|
116
|
+
debug_proc(@example)
|
117
|
+
check_output_includes(
|
118
|
+
/--> #0 FrameTest::Example\.d\(e#String\)\s+at #{__FILE__}:18/,
|
119
|
+
/#1 FrameTest::Example\.c\s+at #{__FILE__}:14/,
|
120
|
+
/#2 FrameTest::Example\.b\s+at #{__FILE__}:10/,
|
121
|
+
/#3 FrameTest::Example\.a\s+at #{__FILE__}:7/)
|
122
|
+
end
|
131
123
|
end
|
132
|
-
end
|
133
|
-
end
|
134
124
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
125
|
+
describe 'when unset' do
|
126
|
+
temporary_change_hash Byebug::Setting, :fullpath, false
|
127
|
+
|
128
|
+
it 'must display current backtrace with shortpaths' do
|
129
|
+
path = shortpath(__FILE__)
|
130
|
+
enter 'where'
|
131
|
+
debug_proc(@example)
|
132
|
+
check_output_includes(
|
133
|
+
/--> #0 FrameTest::Example\.d\(e#String\)\s+at #{path}:18/,
|
134
|
+
/#1 FrameTest::Example\.c\s+at #{path}:14/,
|
135
|
+
/#2 FrameTest::Example\.b\s+at #{path}:10/,
|
136
|
+
/#3 FrameTest::Example\.a\s+at #{path}:7/)
|
137
|
+
end
|
147
138
|
end
|
148
139
|
end
|
149
140
|
|
150
|
-
describe '
|
151
|
-
|
141
|
+
describe 'callstyle' do
|
142
|
+
describe 'long' do
|
143
|
+
temporary_change_hash Byebug::Setting, :callstyle, :long
|
152
144
|
|
153
|
-
|
145
|
+
it 'displays current backtrace with callstyle "long"' do
|
154
146
|
enter 'where'
|
155
|
-
|
156
|
-
check_output_includes(
|
157
|
-
|
158
|
-
|
159
|
-
|
147
|
+
debug_proc(@example)
|
148
|
+
check_output_includes(
|
149
|
+
/--> #0 FrameTest::Example\.d\(e#String\)\s+at #{__FILE__}:18/,
|
150
|
+
/#1 FrameTest::Example\.c\s+at #{__FILE__}:14/,
|
151
|
+
/#2 FrameTest::Example\.b\s+at #{__FILE__}:10/,
|
152
|
+
/#3 FrameTest::Example\.a\s+at #{__FILE__}:7/)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe 'short' do
|
157
|
+
temporary_change_hash Byebug::Setting, :callstyle, :short
|
158
|
+
|
159
|
+
it 'displays current backtrace with callstyle "short"' do
|
160
|
+
enter 'where'
|
161
|
+
debug_proc(@example)
|
162
|
+
check_output_includes(/--> #0 d\(e\)\s+at #{__FILE__}:18/,
|
163
|
+
/#1 c\s+at #{__FILE__}:14/,
|
164
|
+
/#2 b\s+at #{__FILE__}:10/,
|
165
|
+
/#3 a\s+at #{__FILE__}:7/)
|
166
|
+
end
|
160
167
|
end
|
161
168
|
end
|
162
169
|
end
|
163
|
-
end
|
164
170
|
|
165
|
-
|
166
|
-
|
171
|
+
describe 'when byebug is started deep in the callstack' do
|
172
|
+
before do
|
173
|
+
@deep_example = -> do
|
174
|
+
DeepExample.new.a
|
175
|
+
end
|
176
|
+
enter "break #{__FILE__}:37", 'cont'
|
177
|
+
end
|
167
178
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
179
|
+
it 'must print backtrace' do
|
180
|
+
enter 'where'
|
181
|
+
debug_proc(@deep_example)
|
182
|
+
check_output_includes(
|
183
|
+
/--> #0 FrameTest::DeepExample\.d\(e#String\)\s+at #{__FILE__}:37/,
|
184
|
+
/#1 FrameTest::DeepExample\.c\s+at #{__FILE__}:34/,
|
185
|
+
/#2 FrameTest::DeepExample\.b\s+at #{__FILE__}:29/)
|
186
|
+
end
|
176
187
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
188
|
+
it 'must go up' do
|
189
|
+
enter 'up'
|
190
|
+
debug_proc(@deep_example) { state.line.must_equal 34 }
|
191
|
+
end
|
181
192
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
193
|
+
it 'must go down' do
|
194
|
+
enter 'up', 'down'
|
195
|
+
debug_proc(@deep_example) { state.line.must_equal 37 }
|
196
|
+
end
|
186
197
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
198
|
+
it 'must set frame' do
|
199
|
+
enter 'frame 2'
|
200
|
+
debug_proc(@deep_example) { state.line.must_equal 29 }
|
201
|
+
end
|
191
202
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
203
|
+
it 'must eval properly when scaling the stack' do
|
204
|
+
enter 'p z', 'up', 'p z', 'up', 'p z'
|
205
|
+
debug_proc(@deep_example)
|
206
|
+
check_output_includes 'nil', '3', '2'
|
207
|
+
end
|
196
208
|
end
|
197
|
-
end
|
198
209
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
210
|
+
describe 'c-frames' do
|
211
|
+
it 'must mark c-frames when printing the stack' do
|
212
|
+
file = __FILE__
|
213
|
+
enter "break #{__FILE__}:4", 'cont', 'where'
|
214
|
+
enter 'where'
|
215
|
+
debug_proc(@example)
|
216
|
+
check_output_includes(
|
217
|
+
/--> #0 FrameTest::Example.initialize\(f#String\)\s+at #{file}:4/,
|
218
|
+
/ͱ-- #1 Class.new\(\*args\)\s+at #{file}:45/,
|
219
|
+
/#2 block \(2 levels\) in <class:FrameTestCase>\s+at #{file}:45/)
|
220
|
+
end
|
209
221
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
222
|
+
it '"up" skips c-frames' do
|
223
|
+
enter "break #{__FILE__}:7", 'cont', 'up', 'eval fr_ex.class.to_s'
|
224
|
+
debug_proc(@example)
|
225
|
+
check_output_includes '"FrameTest::Example"'
|
226
|
+
end
|
215
227
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
228
|
+
it '"down" skips c-frames' do
|
229
|
+
enter "break #{__FILE__}:7", 'cont', 'up', 'down', 'eval @f'
|
230
|
+
debug_proc(@example)
|
231
|
+
check_output_includes '"f"'
|
232
|
+
end
|
221
233
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
234
|
+
it 'must not jump straigh to c-frames' do
|
235
|
+
enter "break #{__FILE__}:4", 'cont', 'frame 1'
|
236
|
+
debug_proc(@example)
|
237
|
+
check_output_includes "Can't navigate to c-frame", interface.error_queue
|
238
|
+
end
|
226
239
|
end
|
227
240
|
end
|
228
241
|
end
|