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/support/test_dsl.rb
CHANGED
@@ -5,7 +5,6 @@ module TestDsl
|
|
5
5
|
|
6
6
|
def setup
|
7
7
|
Byebug.handler = Byebug::CommandProcessor.new(Byebug::TestInterface.new)
|
8
|
-
Byebug.tracing = false
|
9
8
|
Byebug.breakpoints.clear if Byebug.breakpoints
|
10
9
|
end
|
11
10
|
|
@@ -78,7 +77,7 @@ module TestDsl
|
|
78
77
|
end
|
79
78
|
|
80
79
|
#
|
81
|
-
# Runs
|
80
|
+
# Runs the provided Proc.
|
82
81
|
#
|
83
82
|
# You also can specify a block, which will be executed when Processor extracts
|
84
83
|
# all the commands from the input queue. You can use that for making asserts
|
@@ -86,16 +85,20 @@ module TestDsl
|
|
86
85
|
# the test will fail.
|
87
86
|
#
|
88
87
|
# Usage:
|
89
|
-
#
|
88
|
+
# debug_proc -> { byebug; puts 'Hello' }
|
90
89
|
#
|
91
90
|
# enter 'b 4', 'cont'
|
92
|
-
#
|
91
|
+
# code = -> do
|
92
|
+
# byebug
|
93
|
+
# puts 'hello'
|
94
|
+
# end
|
95
|
+
# debug_proc(code) { state.line.must_equal 4 }
|
93
96
|
#
|
94
|
-
def
|
97
|
+
def debug_proc(program, &block)
|
95
98
|
Byebug.stubs(:run_init_script)
|
96
99
|
interface.test_block = block
|
97
100
|
begin
|
98
|
-
|
101
|
+
program.call
|
99
102
|
ensure
|
100
103
|
interface.test_block.call if interface.test_block
|
101
104
|
end
|
@@ -160,9 +163,4 @@ module TestDsl
|
|
160
163
|
.join("\n") + "\n"
|
161
164
|
File.open(file, 'w') { |f| f.write(new_content) }
|
162
165
|
end
|
163
|
-
|
164
|
-
def must_restart
|
165
|
-
Byebug::RestartCommand.any_instance.unstub(:exec)
|
166
|
-
Byebug::RestartCommand.any_instance.expects(:exec)
|
167
|
-
end
|
168
166
|
end
|
data/test/test_helper.rb
CHANGED
@@ -11,14 +11,9 @@ require 'pathname'
|
|
11
11
|
require 'mocha/mini_test'
|
12
12
|
require 'byebug'
|
13
13
|
|
14
|
-
Dir.glob(File.expand_path(
|
14
|
+
Dir.glob(File.expand_path('../support/*.rb', __FILE__)).each { |f| require f }
|
15
15
|
|
16
|
-
Byebug
|
17
|
-
|
18
|
-
class DummyObject
|
19
|
-
def initialize(*args)
|
20
|
-
end
|
21
|
-
end
|
16
|
+
Byebug::Setting[:testing] = true
|
22
17
|
|
23
18
|
# Init globals to avoid warnings
|
24
19
|
$bla = nil
|
data/test/thread_test.rb
CHANGED
@@ -1,138 +1,152 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
module ThreadTest
|
2
|
+
class Example
|
3
|
+
def initialize
|
4
|
+
Thread.main[:should_break] = false
|
5
|
+
end
|
6
|
+
|
7
|
+
def launch
|
8
|
+
@t1 = Thread.new do
|
9
|
+
while true
|
10
|
+
break if Thread.main[:should_break]
|
11
|
+
sleep 0.02
|
12
|
+
end
|
11
13
|
end
|
12
|
-
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
@t2 = Thread.new do
|
16
|
+
while true
|
17
|
+
sleep 0.02
|
18
|
+
end
|
17
19
|
end
|
20
|
+
|
21
|
+
@t1.join
|
22
|
+
Thread.main[:should_break]
|
18
23
|
end
|
19
24
|
|
20
|
-
|
21
|
-
|
25
|
+
def kill
|
26
|
+
@t2.kill
|
27
|
+
end
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
30
|
+
class ThreadTestCase < TestDsl::TestCase
|
31
|
+
let(:release) { 'eval Thread.main[:should_break] = true' }
|
28
32
|
|
29
|
-
|
30
|
-
|
33
|
+
before do
|
34
|
+
@example = -> do
|
35
|
+
byebug
|
31
36
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
debug_file('thread') { thnum = Byebug.contexts.first.thnum }
|
37
|
-
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:7/)
|
37
|
+
t = Example.new
|
38
|
+
t.launch
|
39
|
+
t.kill
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
|
-
|
41
|
-
thnum
|
42
|
-
enter "break #{__FILE__}:7", 'cont', 'th list', release
|
43
|
-
debug_file('thread') { thnum = Byebug.contexts.first.thnum }
|
44
|
-
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:7/)
|
43
|
+
def first_thnum
|
44
|
+
Byebug.contexts.first.thnum
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
debug_file 'thread'
|
50
|
-
check_output_includes(/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
51
|
-
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
52
|
-
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/)
|
47
|
+
def last_thnum
|
48
|
+
Byebug.contexts.last.thnum
|
53
49
|
end
|
54
|
-
end
|
55
50
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
51
|
+
describe 'list' do
|
52
|
+
it 'must show current thread by "plus" sign' do
|
53
|
+
thnum = nil
|
54
|
+
enter 'break 8', 'cont', 'thread list', release
|
55
|
+
debug_proc(@example) { thnum = first_thnum }
|
56
|
+
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:8/)
|
57
|
+
end
|
64
58
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
59
|
+
it 'must work with shortcut' do
|
60
|
+
thnum = nil
|
61
|
+
enter 'break 8', 'cont', 'th list', release
|
62
|
+
debug_proc(@example) { thnum = first_thnum }
|
63
|
+
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:8/)
|
64
|
+
end
|
72
65
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
66
|
+
it 'must show 3 available threads' do
|
67
|
+
enter 'break 21', 'cont', 'thread list', release
|
68
|
+
debug_proc(@example)
|
69
|
+
check_output_includes(/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
70
|
+
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
71
|
+
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/)
|
72
|
+
end
|
77
73
|
end
|
78
74
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
75
|
+
describe 'stop' do
|
76
|
+
it 'must mark thread as suspended' do
|
77
|
+
thnum = nil
|
78
|
+
enter 'break 21', 'cont', ->{ "thread stop #{last_thnum}" }, release
|
79
|
+
debug_proc(@example) { thnum = last_thnum }
|
80
|
+
check_output_includes(/\$ #{thnum} #<Thread:/)
|
81
|
+
end
|
86
82
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
check_output_includes(/\$ #{thnum} #<Thread:/, /#{thnum} #<Thread:/)
|
95
|
-
end
|
83
|
+
it 'must actually suspend thread execution' do
|
84
|
+
enter 'break 21', 'cont', 'trace on',
|
85
|
+
->{ "thread stop #{last_thnum}" }, release
|
86
|
+
debug_proc(@example)
|
87
|
+
check_output_doesnt_include(/Tracing: #{__FILE__}:16/,
|
88
|
+
/Tracing: #{__FILE__}:17/)
|
89
|
+
end
|
96
90
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
91
|
+
it 'must show error message if thread number is not specified' do
|
92
|
+
enter 'break 8', 'cont', 'thread stop', release
|
93
|
+
debug_proc(@example)
|
94
|
+
check_error_includes '"thread stop" needs a thread number'
|
95
|
+
end
|
102
96
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
97
|
+
it 'must show error message when trying to stop current thread' do
|
98
|
+
enter 'break 8', 'cont', -> { "thread stop #{first_thnum}" }, release
|
99
|
+
debug_proc(@example)
|
100
|
+
check_error_includes "It's the current thread"
|
101
|
+
end
|
108
102
|
end
|
109
103
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
104
|
+
describe 'resume' do
|
105
|
+
it 'must mark remove thread from the suspended state' do
|
106
|
+
thnum = nil
|
107
|
+
enter 'break 21', 'cont',
|
108
|
+
-> { thnum = last_thnum ; "thread stop #{thnum}" },
|
109
|
+
-> { "thread resume #{thnum}" }, release
|
110
|
+
debug_proc(@example) { Byebug.contexts.last.suspended?.must_equal false }
|
111
|
+
check_output_includes(/\$ #{thnum} #<Thread:/, /#{thnum} #<Thread:/)
|
112
|
+
end
|
117
113
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
end
|
114
|
+
it 'must show error message if thread number is not specified' do
|
115
|
+
enter 'break 8', 'cont', 'thread resume', release
|
116
|
+
debug_proc(@example)
|
117
|
+
check_error_includes '"thread resume" needs a thread number'
|
118
|
+
end
|
124
119
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
120
|
+
it 'must show error message when trying to resume current thread' do
|
121
|
+
enter 'break 8', 'cont', ->{ "thread resume #{first_thnum}" }, release
|
122
|
+
debug_proc(@example)
|
123
|
+
check_error_includes "It's the current thread"
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'must show error message if it is not stopped' do
|
127
|
+
enter 'break 21', 'cont', ->{ "thread resume #{last_thnum}" }, release
|
128
|
+
debug_proc(@example)
|
129
|
+
check_error_includes 'Already running'
|
130
|
+
end
|
129
131
|
end
|
130
132
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
133
|
+
describe 'switch' do
|
134
|
+
it 'must switch to another thread' do
|
135
|
+
enter 'break 21', 'cont', ->{ "thread switch #{last_thnum}" }, release
|
136
|
+
debug_proc(@example) { assert_equal state.line, 16 }
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'must show error message if thread number is not specified' do
|
140
|
+
enter 'break 8', 'cont', 'thread switch', release
|
141
|
+
debug_proc(@example)
|
142
|
+
check_error_includes '"thread switch" needs a thread number'
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'must show error message when trying to switch current thread' do
|
146
|
+
enter 'break 8', 'cont', ->{ "thread switch #{first_thnum}" }, release
|
147
|
+
debug_proc(@example)
|
148
|
+
check_error_includes "It's the current thread"
|
149
|
+
end
|
136
150
|
end
|
137
151
|
end
|
138
152
|
end
|
data/test/trace_test.rb
CHANGED
@@ -1,104 +1,107 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module TraceTest
|
2
|
+
class TraceTestCase < TestDsl::TestCase
|
3
|
+
before do
|
4
|
+
@example = -> do
|
5
|
+
$bla = 5
|
6
|
+
byebug
|
7
|
+
$bla = 7
|
8
|
+
$bla = 8
|
9
|
+
$bla = 9
|
10
|
+
$bla = 10
|
11
|
+
$bla = (0 == (10 % $bla))
|
12
|
+
end
|
13
|
+
untrace_var(:$bla) if defined?($bla)
|
14
|
+
end
|
5
15
|
|
6
|
-
|
16
|
+
describe 'line tracing' do
|
17
|
+
describe 'enabling' do
|
18
|
+
it 'must trace execution by setting trace to on' do
|
19
|
+
enter 'set linetrace', 'cont 10', 'set nolinetrace'
|
20
|
+
debug_proc(@example)
|
21
|
+
check_output_includes 'linetrace is on',
|
22
|
+
"Tracing: #{__FILE__}:8 $bla = 8",
|
23
|
+
"Tracing: #{__FILE__}:10 $bla = 10"
|
24
|
+
end
|
7
25
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
26
|
+
it 'must be able to use a shortcut' do
|
27
|
+
enter 'set lin on', 'cont 10', 'set nolin'
|
28
|
+
debug_proc(@example)
|
29
|
+
check_output_includes 'linetrace is on',
|
30
|
+
"Tracing: #{__FILE__}:8 $bla = 8",
|
31
|
+
"Tracing: #{__FILE__}:10 $bla = 10"
|
32
|
+
end
|
16
33
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"Tracing: #{fullpath('trace')}:7 $bla = 7"
|
23
|
-
end
|
34
|
+
it 'must correctly print lines containing % sign' do
|
35
|
+
enter 'cont 10', 'set linetrace', 'next', 'set nolinetrace'
|
36
|
+
debug_proc(@example)
|
37
|
+
check_output_includes "Tracing: #{__FILE__}:11 $bla = (0 == (10 % $bla))"
|
38
|
+
end
|
24
39
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
40
|
+
describe 'when basename set' do
|
41
|
+
temporary_change_hash Byebug::Setting, :basename, true
|
42
|
+
|
43
|
+
it 'must correctly print file lines' do
|
44
|
+
enter 'set linetrace on', 'cont 10', 'set nolinetrace'
|
45
|
+
debug_proc(@example)
|
46
|
+
check_output_includes \
|
47
|
+
"Tracing: #{File.basename(__FILE__)}:10 $bla = 10"
|
48
|
+
end
|
49
|
+
end
|
30
50
|
end
|
31
51
|
|
32
|
-
describe '
|
33
|
-
|
52
|
+
describe 'disabling' do
|
53
|
+
it 'must stop tracing by setting trace to off' do
|
54
|
+
enter 'set linetrace', 'next', 'set nolinetrace'
|
55
|
+
debug_proc(@example)
|
56
|
+
check_output_includes "Tracing: #{__FILE__}:8 $bla = 8"
|
57
|
+
check_output_doesnt_include "Tracing: #{__FILE__}:9 $bla = 9"
|
58
|
+
end
|
34
59
|
|
35
|
-
it 'must
|
36
|
-
enter '
|
37
|
-
|
38
|
-
check_output_includes
|
39
|
-
"Tracing: #{File.basename(fullpath('trace'))}:7 $bla = 7"
|
60
|
+
it 'must show a message when turned off' do
|
61
|
+
enter 'set nolinetrace'
|
62
|
+
debug_proc(@example)
|
63
|
+
check_output_includes 'linetrace is off'
|
40
64
|
end
|
41
65
|
end
|
42
66
|
end
|
43
67
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
describe 'disabling' do
|
52
|
-
it 'must stop tracing by setting trace to off' do
|
53
|
-
enter 'trace on', 'next', 'trace off'
|
54
|
-
debug_file 'trace'
|
55
|
-
check_output_includes "Tracing: #{fullpath('trace')}:4 $bla = 4"
|
56
|
-
check_output_doesnt_include "Tracing: #{fullpath('trace')}:5 $bla = 5"
|
68
|
+
describe 'global variable tracing' do
|
69
|
+
it 'must track global variable' do
|
70
|
+
enter 'tracevar bla'
|
71
|
+
debug_proc(@example)
|
72
|
+
check_output_includes "traced global variable 'bla' has value '7'",
|
73
|
+
"traced global variable 'bla' has value '10'"
|
57
74
|
end
|
58
75
|
|
59
|
-
it 'must
|
60
|
-
enter '
|
61
|
-
|
62
|
-
check_output_includes '
|
76
|
+
it 'must be able to use a shortcut' do
|
77
|
+
enter 'tracevar bla'
|
78
|
+
debug_proc(@example)
|
79
|
+
check_output_includes "traced global variable 'bla' has value '7'"
|
80
|
+
"traced global variable 'bla' has value '10'"
|
63
81
|
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe 'tracing global variables' do
|
68
|
-
it 'must track global variable' do
|
69
|
-
enter 'trace variable bla'
|
70
|
-
debug_file 'trace'
|
71
|
-
check_output_includes "traced global variable 'bla' has value '3'",
|
72
|
-
"traced global variable 'bla' has value '7'"
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'must be able to use a shortcut' do
|
76
|
-
enter 'trace var bla'
|
77
|
-
debug_file 'trace'
|
78
|
-
check_output_includes "traced global variable 'bla' has value '3'"
|
79
|
-
end
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
it 'must track global variable with nostop' do
|
87
|
-
enter 'trace variable bla nostop', 'break 7', 'cont'
|
88
|
-
debug_file('trace') { state.line.must_equal 7 }
|
89
|
-
end
|
83
|
+
it 'must track global variable with stop' do
|
84
|
+
enter 'tracevar bla stop', 'break 10', 'cont'
|
85
|
+
debug_proc(@example) { state.line.must_equal 8 }
|
86
|
+
end
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
debug_file 'trace'
|
95
|
-
check_error_includes "'foo' is not a global variable."
|
88
|
+
it 'must track global variable with nostop' do
|
89
|
+
enter 'tracevar bla nostop', 'break 10', 'cont'
|
90
|
+
debug_proc(@example) { state.line.must_equal 10 }
|
96
91
|
end
|
97
92
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
93
|
+
describe 'errors' do
|
94
|
+
it 'must show an error message if there is no such global variable' do
|
95
|
+
enter 'tracevar foo'
|
96
|
+
debug_proc(@example)
|
97
|
+
check_error_includes "'foo' is not a global variable."
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'must show an error message if subcommand is invalid' do
|
101
|
+
enter 'tracevar bla foo'
|
102
|
+
debug_proc(@example)
|
103
|
+
check_error_includes 'expecting "stop" or "nostop"; got "foo"'
|
104
|
+
end
|
102
105
|
end
|
103
106
|
end
|
104
107
|
end
|