byebug 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/CHANGELOG.md +15 -0
- data/GUIDE.md +17 -35
- data/Gemfile +8 -5
- data/LICENSE +1 -1
- data/README.md +10 -22
- data/Rakefile +1 -1
- data/ext/byebug/byebug.c +3 -2
- data/lib/byebug.rb +3 -38
- data/lib/byebug/commands/break.rb +83 -0
- data/lib/byebug/commands/catchpoint.rb +0 -1
- data/lib/byebug/commands/condition.rb +10 -6
- data/lib/byebug/commands/continue.rb +3 -6
- data/lib/byebug/commands/delete.rb +38 -0
- data/lib/byebug/commands/edit.rb +0 -2
- data/lib/byebug/commands/enable.rb +7 -8
- data/lib/byebug/commands/finish.rb +0 -2
- data/lib/byebug/commands/frame.rb +13 -15
- data/lib/byebug/commands/help.rb +1 -3
- data/lib/byebug/commands/history.rb +3 -3
- data/lib/byebug/commands/info.rb +4 -13
- data/lib/byebug/commands/interrupt.rb +25 -0
- data/lib/byebug/commands/kill.rb +0 -2
- data/lib/byebug/commands/list.rb +2 -4
- data/lib/byebug/commands/method.rb +2 -8
- data/lib/byebug/commands/quit.rb +0 -2
- data/lib/byebug/commands/reload.rb +2 -15
- data/lib/byebug/commands/repl.rb +0 -3
- data/lib/byebug/commands/{control.rb → restart.rb} +2 -26
- data/lib/byebug/commands/save.rb +0 -1
- data/lib/byebug/commands/set.rb +4 -7
- data/lib/byebug/commands/show.rb +0 -3
- data/lib/byebug/commands/source.rb +0 -3
- data/lib/byebug/commands/stepping.rb +3 -4
- data/lib/byebug/commands/trace.rb +0 -1
- data/lib/byebug/commands/variables.rb +3 -4
- data/lib/byebug/context.rb +0 -1
- data/lib/byebug/helper.rb +23 -0
- data/lib/byebug/interfaces/script_interface.rb +1 -1
- data/lib/byebug/processors/command_processor.rb +9 -9
- data/lib/byebug/remote.rb +2 -2
- data/lib/byebug/setting.rb +3 -1
- data/lib/byebug/settings/autoeval.rb +3 -1
- data/lib/byebug/settings/autoirb.rb +3 -1
- data/lib/byebug/settings/autolist.rb +3 -1
- data/lib/byebug/settings/autoreload.rb +1 -3
- data/lib/byebug/settings/autosave.rb +1 -3
- data/lib/byebug/settings/callstyle.rb +2 -4
- data/lib/byebug/settings/fullpath.rb +1 -3
- data/lib/byebug/settings/histfile.rb +1 -3
- data/lib/byebug/settings/histsize.rb +0 -4
- data/lib/byebug/settings/listsize.rb +1 -3
- data/lib/byebug/settings/post_mortem.rb +14 -1
- data/lib/byebug/settings/width.rb +1 -17
- data/lib/byebug/version.rb +1 -1
- data/test/break_test.rb +376 -0
- data/test/condition_test.rb +82 -0
- data/test/continue_test.rb +27 -30
- data/test/debugger_alias_test.rb +4 -4
- data/test/delete_test.rb +26 -0
- data/test/display_test.rb +80 -102
- data/test/edit_test.rb +28 -31
- data/test/eval_test.rb +50 -80
- data/test/finish_test.rb +23 -23
- data/test/frame_test.rb +172 -186
- data/test/help_test.rb +27 -37
- data/test/history_test.rb +32 -41
- data/test/info_test.rb +198 -230
- data/test/interrupt_test.rb +17 -36
- data/test/irb_test.rb +47 -0
- data/test/kill_test.rb +19 -19
- data/test/list_test.rb +126 -133
- data/test/method_test.rb +21 -54
- data/test/post_mortem_test.rb +44 -46
- data/test/pry_test.rb +42 -0
- data/test/quit_test.rb +17 -15
- data/test/reload_test.rb +23 -28
- data/test/restart_test.rb +35 -63
- data/test/save_test.rb +46 -62
- data/test/set_test.rb +93 -144
- data/test/show_test.rb +50 -71
- data/test/source_test.rb +23 -26
- data/test/stepping_test.rb +125 -153
- data/test/support/matchers.rb +1 -6
- data/test/support/test_interface.rb +1 -1
- data/test/support/{test_dsl.rb → utils.rb} +17 -64
- data/test/test_helper.rb +25 -7
- data/test/thread_test.rb +101 -89
- data/test/trace_test.rb +48 -85
- data/test/variables_test.rb +43 -80
- metadata +18 -13
- data/lib/byebug/commands/breakpoints.rb +0 -137
- data/lib/byebug/commands/skip.rb +0 -30
- data/test/breakpoints_test.rb +0 -474
- data/test/conditions_test.rb +0 -82
- data/test/repl_test.rb +0 -75
data/test/test_helper.rb
CHANGED
@@ -1,19 +1,37 @@
|
|
1
1
|
if ENV['CI']
|
2
|
-
require '
|
3
|
-
|
4
|
-
add_filter 'test'
|
5
|
-
end
|
2
|
+
require 'codeclimate-test-reporter'
|
3
|
+
CodeClimate::TestReporter.start
|
6
4
|
end
|
7
5
|
|
8
6
|
require 'minitest'
|
9
|
-
require 'minitest/spec'
|
10
7
|
require 'pathname'
|
11
8
|
require 'mocha/mini_test'
|
12
9
|
require 'byebug'
|
13
10
|
|
14
|
-
|
11
|
+
require_relative 'support/utils'
|
12
|
+
|
13
|
+
class Byebug::TestCase < Minitest::Test
|
14
|
+
#
|
15
|
+
# Reset to default state before each test
|
16
|
+
#
|
17
|
+
def setup
|
18
|
+
Byebug.handler = Byebug::CommandProcessor.new(Byebug::TestInterface.new)
|
19
|
+
Byebug.breakpoints.clear if Byebug.breakpoints
|
20
|
+
Byebug.catchpoints.clear if Byebug.catchpoints
|
21
|
+
|
22
|
+
Byebug::Setting.load
|
23
|
+
Byebug::Setting[:autolist] = false
|
24
|
+
Byebug::Setting[:testing] = true
|
25
|
+
Byebug::Setting[:verbose] = true
|
26
|
+
Byebug::Setting[:width] = 80
|
15
27
|
|
16
|
-
|
28
|
+
byebug_bin = File.expand_path('../../../bin/byebug', __FILE__)
|
29
|
+
force_set_const(Byebug, 'BYEBUG_SCRIPT', byebug_bin)
|
30
|
+
force_set_const(Byebug, 'PROG_SCRIPT', $0)
|
31
|
+
end
|
32
|
+
|
33
|
+
include Byebug::TestUtils
|
34
|
+
end
|
17
35
|
|
18
36
|
# Init globals to avoid warnings
|
19
37
|
$bla = nil
|
data/test/thread_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module
|
2
|
-
class
|
1
|
+
module Byebug
|
2
|
+
class ThreadExample
|
3
3
|
def initialize
|
4
4
|
Thread.main[:should_break] = false
|
5
5
|
end
|
@@ -27,17 +27,21 @@ module ThreadTest
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
class ThreadTestCase <
|
31
|
-
|
32
|
-
|
33
|
-
before do
|
30
|
+
class ThreadTestCase < TestCase
|
31
|
+
def setup
|
34
32
|
@example = -> do
|
35
33
|
byebug
|
36
34
|
|
37
|
-
t =
|
35
|
+
t = ThreadExample.new
|
38
36
|
t.launch
|
39
37
|
t.kill
|
40
38
|
end
|
39
|
+
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
def release
|
44
|
+
@release ||= 'eval Thread.main[:should_break] = true'
|
41
45
|
end
|
42
46
|
|
43
47
|
def first_thnum
|
@@ -48,105 +52,113 @@ module ThreadTest
|
|
48
52
|
Byebug.contexts.last.thnum
|
49
53
|
end
|
50
54
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
def test_thread_list_marks_current_thread_with_a_plus_sign
|
56
|
+
skip 'for now'
|
57
|
+
thnum = nil
|
58
|
+
enter 'break 8', 'cont', 'thread list', release
|
59
|
+
debug_proc(@example) { thnum = first_thnum }
|
60
|
+
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:8/)
|
61
|
+
end
|
58
62
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
def test_thread_list_works_with_shortcut
|
64
|
+
skip 'for now'
|
65
|
+
thnum = nil
|
66
|
+
enter 'break 8', 'cont', 'th list', release
|
67
|
+
debug_proc(@example) { thnum = first_thnum }
|
68
|
+
check_output_includes(/\+ #{thnum} #<Thread:\S+ run>\t#{__FILE__}:8/)
|
69
|
+
end
|
65
70
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
def test_thread_list_show_all_available_threads
|
72
|
+
skip 'for now'
|
73
|
+
enter 'break 21', 'cont', 'thread list', release
|
74
|
+
debug_proc(@example)
|
75
|
+
check_output_includes(/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
76
|
+
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/,
|
77
|
+
/(\+)?\d+ #<Thread:\S+ (sleep|run)>/)
|
73
78
|
end
|
74
79
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
80
|
+
def test_thread_stop_marks_thread_as_suspended
|
81
|
+
skip 'for now'
|
82
|
+
thnum = nil
|
83
|
+
enter 'break 21', 'cont', -> { "thread stop #{last_thnum}" }, release
|
84
|
+
debug_proc(@example) { thnum = last_thnum }
|
85
|
+
check_output_includes(/\$ #{thnum} #<Thread:/)
|
86
|
+
end
|
82
87
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
def test_thread_stop_actually_suspends_thread_execution
|
89
|
+
skip 'for now'
|
90
|
+
enter 'break 21', 'cont', 'trace on',
|
91
|
+
-> { "thread stop #{last_thnum}" }, release
|
92
|
+
debug_proc(@example)
|
93
|
+
check_output_doesnt_include(/Tracing: #{__FILE__}:16/,
|
94
|
+
/Tracing: #{__FILE__}:17/)
|
95
|
+
end
|
90
96
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
97
|
+
def test_thread_stop_shows_error_when_thread_number_not_specified
|
98
|
+
skip 'for now'
|
99
|
+
enter 'break 8', 'cont', 'thread stop', release
|
100
|
+
debug_proc(@example)
|
101
|
+
check_error_includes '"thread stop" needs a thread number'
|
102
|
+
end
|
96
103
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
104
|
+
def test_thread_stop_shows_error_when_trying_to_stop_current_thread
|
105
|
+
skip 'for now'
|
106
|
+
enter 'break 8', 'cont', -> { "thread stop #{first_thnum}" }, release
|
107
|
+
debug_proc(@example)
|
108
|
+
check_error_includes "It's the current thread"
|
102
109
|
end
|
103
110
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
111
|
+
def test_thread_resume_removes_threads_from_the_suspended_state
|
112
|
+
skip 'for now'
|
113
|
+
thnum = nil
|
114
|
+
enter 'break 21', 'cont',
|
115
|
+
-> { thnum = last_thnum ; "thread stop #{thnum}" },
|
116
|
+
-> { "thread resume #{thnum}" }, release
|
117
|
+
debug_proc(@example) do
|
118
|
+
assert_equal false, Byebug.contexts.last.suspended?
|
112
119
|
end
|
120
|
+
check_output_includes(/\$ #{thnum} #<Thread:/, /#{thnum} #<Thread:/)
|
121
|
+
end
|
113
122
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
123
|
+
def test_thread_resume_shows_error_if_thread_number_not_specified
|
124
|
+
skip 'for now'
|
125
|
+
enter 'break 8', 'cont', 'thread resume', release
|
126
|
+
debug_proc(@example)
|
127
|
+
check_error_includes '"thread resume" needs a thread number'
|
128
|
+
end
|
119
129
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
130
|
+
def test_thread_resume_shows_error_when_trying_to_resume_current_thread
|
131
|
+
skip 'for now'
|
132
|
+
enter 'break 8', 'cont', -> { "thread resume #{first_thnum}" }, release
|
133
|
+
debug_proc(@example)
|
134
|
+
check_error_includes "It's the current thread"
|
135
|
+
end
|
125
136
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
137
|
+
def test_thread_resume_shows_error_if_thread_is_already_running
|
138
|
+
skip 'for now'
|
139
|
+
enter 'break 21', 'cont', -> { "thread resume #{last_thnum}" }, release
|
140
|
+
debug_proc(@example)
|
141
|
+
check_error_includes 'Already running'
|
131
142
|
end
|
132
143
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
144
|
+
def test_thread_switch_changes_execution_to_another_thread
|
145
|
+
skip 'for now'
|
146
|
+
enter 'break 21', 'cont', -> { "thread switch #{last_thnum}" }, release
|
147
|
+
debug_proc(@example) { assert_equal state.line, 16 }
|
148
|
+
end
|
138
149
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
150
|
+
def test_thread_switch_shows_error_if_thread_number_not_specified
|
151
|
+
skip 'for now'
|
152
|
+
enter 'break 8', 'cont', 'thread switch', release
|
153
|
+
debug_proc(@example)
|
154
|
+
check_error_includes '"thread switch" needs a thread number'
|
155
|
+
end
|
144
156
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
157
|
+
def test_thread_switch_shows_error_when_trying_to_switch_current_thread
|
158
|
+
skip 'for now'
|
159
|
+
enter 'break 8', 'cont', -> { "thread switch #{first_thnum}" }, release
|
160
|
+
debug_proc(@example)
|
161
|
+
check_error_includes "It's the current thread"
|
150
162
|
end
|
151
163
|
end
|
152
164
|
end
|
data/test/trace_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
2
|
-
class TraceTestCase <
|
3
|
-
|
1
|
+
module Byebug
|
2
|
+
class TraceTestCase < TestCase
|
3
|
+
def setup
|
4
4
|
@example = -> do
|
5
5
|
$bla = 5
|
6
6
|
byebug
|
@@ -11,98 +11,61 @@ module TraceTest
|
|
11
11
|
$bla = (0 == (10 % $bla))
|
12
12
|
end
|
13
13
|
untrace_var(:$bla) if defined?($bla)
|
14
|
-
end
|
15
|
-
|
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
|
25
|
-
|
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
|
33
|
-
|
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
|
39
|
-
|
40
|
-
describe 'when basename set' do
|
41
|
-
temporary_change_hash Byebug::Setting, :basename, true
|
42
14
|
|
43
|
-
|
44
|
-
|
45
|
-
debug_proc(@example)
|
46
|
-
check_output_includes \
|
47
|
-
"Tracing: #{File.basename(__FILE__)}:10 $bla = 10"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
15
|
+
super
|
16
|
+
end
|
51
17
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
18
|
+
def test_linetrace_setting_enables_tracing_program_execution
|
19
|
+
enter 'set linetrace', 'cont 11', 'set nolinetrace'
|
20
|
+
debug_proc(@example)
|
21
|
+
check_output_includes 'linetrace is on',
|
22
|
+
"Tracing: #{__FILE__}:8 $bla = 8",
|
23
|
+
"Tracing: #{__FILE__}:9 $bla = 9",
|
24
|
+
"Tracing: #{__FILE__}:10 $bla = 10",
|
25
|
+
"Tracing: #{__FILE__}:11 $bla = (0 == (10 % $bla))"
|
26
|
+
end
|
59
27
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
28
|
+
def test_basename_setting_affects_tracing_output
|
29
|
+
enter 'set basename', 'set linetrace on', 'cont 10', 'set nolinetrace'
|
30
|
+
debug_proc(@example)
|
31
|
+
check_output_includes \
|
32
|
+
"Tracing: #{File.basename(__FILE__)}:10 $bla = 10"
|
66
33
|
end
|
67
34
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
35
|
+
def test_disabling_linetrace_setting_stops_tracing
|
36
|
+
enter 'set linetrace', 'next', 'set nolinetrace'
|
37
|
+
debug_proc(@example)
|
38
|
+
check_output_includes "Tracing: #{__FILE__}:8 $bla = 8"
|
39
|
+
check_output_doesnt_include "Tracing: #{__FILE__}:9 $bla = 9"
|
40
|
+
end
|
75
41
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
42
|
+
def test_tracevar_tracks_global_variables
|
43
|
+
enter 'tracevar bla'
|
44
|
+
debug_proc(@example)
|
45
|
+
check_output_includes "traced global variable 'bla' has value '7'",
|
46
|
+
"traced global variable 'bla' has value '10'"
|
47
|
+
end
|
82
48
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
49
|
+
def test_tracevar_stop_makes_program_stop_when_global_var_changes
|
50
|
+
enter 'tracevar bla stop', 'break 10', 'cont'
|
51
|
+
debug_proc(@example) { assert_equal 8, state.line }
|
52
|
+
end
|
87
53
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
54
|
+
def test_tracevar_nostop_does_not_stop_when_global_var_changes
|
55
|
+
enter 'tracevar bla nostop', 'break 10', 'cont'
|
56
|
+
debug_proc(@example) { assert_equal 10, state.line }
|
57
|
+
end
|
92
58
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
59
|
+
def test_tracevar_shows_an_error_message_if_there_is_no_such_global_var
|
60
|
+
enter 'tracevar foo'
|
61
|
+
debug_proc(@example)
|
62
|
+
check_error_includes "'foo' is not a global variable."
|
63
|
+
end
|
99
64
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
65
|
+
def test_tracevar_shows_an_error_message_if_subcommand_is_invalid
|
66
|
+
enter 'tracevar bla foo'
|
67
|
+
debug_proc(@example)
|
68
|
+
check_error_includes 'expecting "stop" or "nostop"; got "foo"'
|
106
69
|
end
|
107
70
|
end
|
108
71
|
end
|
data/test/variables_test.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
module
|
2
|
-
class
|
1
|
+
module Byebug
|
2
|
+
class VariablesExample
|
3
3
|
SOMECONST = 'foo' unless defined?(SOMECONST)
|
4
4
|
|
5
5
|
def initialize
|
@@ -18,116 +18,79 @@ module VariablesTest
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
before do
|
21
|
+
class VariablesTestCase < TestCase
|
22
|
+
def setup
|
24
23
|
@example = -> do
|
25
24
|
byebug
|
26
25
|
|
27
|
-
v =
|
26
|
+
v = VariablesExample.new
|
28
27
|
v.run
|
29
28
|
end
|
29
|
+
|
30
|
+
super
|
30
31
|
end
|
31
32
|
|
32
33
|
# we check a class minitest variable... brittle but ok for now
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
it 'must show variables' do
|
37
|
-
enter 'var class'
|
38
|
-
debug_proc(@example)
|
39
|
-
check_output_includes(/@@runnables/)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'must be able to use shortcut' do
|
43
|
-
enter 'v cl'
|
34
|
+
['var class', 'v cl'].each do |cmd_alias|
|
35
|
+
define_method(:"test_#{cmd_alias}_shows_class_variables") do
|
36
|
+
enter cmd_alias
|
44
37
|
debug_proc(@example)
|
45
38
|
check_output_includes(/@@runnables/)
|
46
39
|
end
|
47
40
|
end
|
48
41
|
|
49
|
-
|
50
|
-
|
51
|
-
enter
|
42
|
+
['var const', 'v co'].each do |cmd_alias|
|
43
|
+
define_method(:"test_#{cmd_alias}_shows_constants_in_class_or_module") do
|
44
|
+
enter "#{cmd_alias} VariablesExample"
|
52
45
|
debug_proc(@example)
|
53
46
|
check_output_includes 'SOMECONST => "foo"'
|
54
47
|
end
|
55
|
-
|
56
|
-
it 'must be able to use shortcut' do
|
57
|
-
enter 'break 28', 'cont', 'v co Example'
|
58
|
-
debug_proc(@example)
|
59
|
-
check_output_includes 'SOMECONST => "foo"'
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'must show error message if given object is not a class or a module' do
|
63
|
-
enter 'break 28', 'cont', 'var const v'
|
64
|
-
debug_proc(@example)
|
65
|
-
check_output_includes 'Should be Class/Module: v'
|
66
|
-
end
|
67
48
|
end
|
68
49
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
50
|
+
def test_var_const_shows_error_if_given_object_is_not_a_class_or_module
|
51
|
+
enter 'var const v'
|
52
|
+
debug_proc(@example)
|
53
|
+
check_output_includes 'Should be Class/Module: v'
|
54
|
+
end
|
75
55
|
|
76
|
-
|
77
|
-
|
56
|
+
['var global', 'v g'].each do |cmd_alias|
|
57
|
+
define_method(:"test_#{cmd_alias}_shows_global_variables") do
|
58
|
+
enter cmd_alias
|
78
59
|
debug_proc(@example)
|
79
60
|
check_output_includes '$VERBOSE = true'
|
80
61
|
end
|
81
62
|
end
|
82
63
|
|
83
|
-
|
84
|
-
|
85
|
-
enter 'break
|
86
|
-
debug_proc(@example)
|
87
|
-
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'must show instance variables of self' do
|
91
|
-
enter 'break 9', 'cont', 'var instance'
|
92
|
-
debug_proc(@example)
|
93
|
-
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'must show instance variables' do
|
97
|
-
enter 'break 28', 'cont', 'var instance v'
|
98
|
-
debug_proc(@example)
|
99
|
-
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'must be able to use shortcut' do
|
103
|
-
enter 'break 28', 'cont', 'v ins v'
|
64
|
+
['var instance', 'v ins'].each do |cmd_alias|
|
65
|
+
define_method(:"test_#{cmd_alias}_shows_instance_vars_of_an_object") do
|
66
|
+
enter 'break 27', 'cont', "#{cmd_alias} v"
|
104
67
|
debug_proc(@example)
|
105
68
|
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
106
69
|
end
|
70
|
+
end
|
107
71
|
|
108
|
-
|
109
|
-
|
72
|
+
def test_var_instance_shows_instance_variables_of_self_if_no_object_given
|
73
|
+
enter 'break 9', 'cont', 'var instance'
|
74
|
+
debug_proc(@example)
|
75
|
+
check_output_includes '@inst_a = 1', '@inst_b = 2'
|
76
|
+
end
|
110
77
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
78
|
+
def test_var_instance_cuts_long_variable_values_according_to_width_setting
|
79
|
+
enter 'break 27', 'cont', 'set width 45', 'var instance v'
|
80
|
+
debug_proc(@example)
|
81
|
+
check_output_includes '@inst_c = "1111111111111111111111111111111...'
|
82
|
+
end
|
117
83
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
84
|
+
def test_v_ins_shows_error_if_value_does_not_have_to_s_or_inspect_methods
|
85
|
+
enter 'break 27', 'cont', 'v ins v'
|
86
|
+
debug_proc(@example)
|
87
|
+
check_output_includes '@inst_d = *Error in evaluation*'
|
123
88
|
end
|
124
89
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
check_output_includes 'a => 4', 'b => nil', 'i => 1'
|
130
|
-
end
|
90
|
+
def test_var_local_shows_local_variables
|
91
|
+
enter 'break 15', 'cont', 'var local'
|
92
|
+
debug_proc(@example)
|
93
|
+
check_output_includes 'a => 4', 'b => nil', 'i => 1'
|
131
94
|
end
|
132
95
|
end
|
133
96
|
end
|