byebug 3.5.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.rubocop.yml +18 -1
- data/.travis.yml +21 -1
- data/CHANGELOG.md +356 -308
- data/CONTRIBUTING.md +31 -15
- data/GUIDE.md +859 -475
- data/Gemfile +8 -10
- data/LICENSE +1 -1
- data/README.md +41 -45
- data/Rakefile +30 -28
- data/byebug.gemspec +18 -18
- data/ext/byebug/breakpoint.c +88 -75
- data/ext/byebug/byebug.c +253 -252
- data/ext/byebug/byebug.h +53 -53
- data/ext/byebug/context.c +188 -159
- data/ext/byebug/extconf.rb +9 -6
- data/ext/byebug/locker.c +53 -11
- data/ext/byebug/threads.c +137 -39
- data/lib/byebug/attacher.rb +7 -2
- data/lib/byebug/breakpoint.rb +30 -0
- data/lib/byebug/command.rb +36 -32
- data/lib/byebug/commands/break.rb +49 -48
- data/lib/byebug/commands/catch.rb +64 -0
- data/lib/byebug/commands/condition.rb +13 -9
- data/lib/byebug/commands/continue.rb +8 -4
- data/lib/byebug/commands/delete.rb +10 -4
- data/lib/byebug/commands/display.rb +33 -25
- data/lib/byebug/commands/edit.rb +18 -13
- data/lib/byebug/commands/enable_disable.rb +26 -24
- data/lib/byebug/commands/eval.rb +77 -35
- data/lib/byebug/commands/finish.rb +9 -5
- data/lib/byebug/commands/frame.rb +66 -125
- data/lib/byebug/commands/help.rb +14 -21
- data/lib/byebug/commands/history.rb +5 -1
- data/lib/byebug/commands/info.rb +41 -106
- data/lib/byebug/commands/interrupt.rb +6 -2
- data/lib/byebug/commands/irb.rb +5 -2
- data/lib/byebug/commands/kill.rb +6 -2
- data/lib/byebug/commands/list.rb +21 -14
- data/lib/byebug/commands/method.rb +17 -9
- data/lib/byebug/commands/pry.rb +13 -3
- data/lib/byebug/commands/quit.rb +10 -5
- data/lib/byebug/commands/restart.rb +12 -19
- data/lib/byebug/commands/save.rb +10 -6
- data/lib/byebug/commands/set.rb +15 -14
- data/lib/byebug/commands/show.rb +8 -8
- data/lib/byebug/commands/source.rb +14 -8
- data/lib/byebug/commands/stepping.rb +15 -29
- data/lib/byebug/commands/threads.rb +73 -49
- data/lib/byebug/commands/tracevar.rb +56 -0
- data/lib/byebug/commands/undisplay.rb +8 -4
- data/lib/byebug/commands/untracevar.rb +38 -0
- data/lib/byebug/commands/var.rb +107 -0
- data/lib/byebug/context.rb +78 -42
- data/lib/byebug/core.rb +78 -40
- data/lib/byebug/helper.rb +58 -42
- data/lib/byebug/history.rb +12 -1
- data/lib/byebug/interface.rb +91 -11
- data/lib/byebug/interfaces/local_interface.rb +12 -19
- data/lib/byebug/interfaces/remote_interface.rb +12 -15
- data/lib/byebug/interfaces/script_interface.rb +14 -18
- data/lib/byebug/interfaces/test_interface.rb +54 -0
- data/lib/byebug/printers/base.rb +64 -0
- data/lib/byebug/printers/plain.rb +53 -0
- data/lib/byebug/processor.rb +20 -1
- data/lib/byebug/processors/command_processor.rb +57 -172
- data/lib/byebug/processors/control_command_processor.rb +16 -43
- data/lib/byebug/remote.rb +13 -7
- data/lib/byebug/runner.rb +102 -54
- data/lib/byebug/setting.rb +45 -68
- data/lib/byebug/settings/autoeval.rb +2 -0
- data/lib/byebug/settings/autoirb.rb +3 -0
- data/lib/byebug/settings/autolist.rb +3 -0
- data/lib/byebug/settings/autosave.rb +2 -0
- data/lib/byebug/settings/basename.rb +2 -0
- data/lib/byebug/settings/callstyle.rb +2 -0
- data/lib/byebug/settings/fullpath.rb +2 -0
- data/lib/byebug/settings/histfile.rb +2 -0
- data/lib/byebug/settings/histsize.rb +2 -0
- data/lib/byebug/settings/linetrace.rb +2 -0
- data/lib/byebug/settings/listsize.rb +2 -0
- data/lib/byebug/settings/post_mortem.rb +7 -2
- data/lib/byebug/settings/stack_on_error.rb +2 -0
- data/lib/byebug/settings/verbose.rb +2 -0
- data/lib/byebug/settings/width.rb +2 -0
- data/lib/byebug/state.rb +12 -0
- data/lib/byebug/states/control_state.rb +26 -0
- data/lib/byebug/states/regular_state.rb +178 -0
- data/lib/byebug/version.rb +1 -1
- metadata +24 -109
- data/lib/byebug/commands/catchpoint.rb +0 -53
- data/lib/byebug/commands/reload.rb +0 -29
- data/lib/byebug/commands/trace.rb +0 -50
- data/lib/byebug/commands/variables.rb +0 -206
- data/lib/byebug/options.rb +0 -46
- data/lib/byebug/settings/autoreload.rb +0 -12
- data/lib/byebug/settings/forcestep.rb +0 -14
- data/lib/byebug/settings/testing.rb +0 -12
- data/lib/byebug/settings/tracing_plus.rb +0 -11
- data/test/commands/break_test.rb +0 -364
- data/test/commands/condition_test.rb +0 -85
- data/test/commands/continue_test.rb +0 -47
- data/test/commands/delete_test.rb +0 -26
- data/test/commands/display_test.rb +0 -37
- data/test/commands/edit_test.rb +0 -52
- data/test/commands/eval_test.rb +0 -89
- data/test/commands/finish_test.rb +0 -74
- data/test/commands/frame_test.rb +0 -223
- data/test/commands/help_test.rb +0 -66
- data/test/commands/history_test.rb +0 -61
- data/test/commands/info_test.rb +0 -238
- data/test/commands/interrupt_test.rb +0 -45
- data/test/commands/irb_test.rb +0 -28
- data/test/commands/kill_test.rb +0 -50
- data/test/commands/list_test.rb +0 -174
- data/test/commands/method_test.rb +0 -52
- data/test/commands/post_mortem_test.rb +0 -71
- data/test/commands/pry_test.rb +0 -26
- data/test/commands/quit_test.rb +0 -53
- data/test/commands/reload_test.rb +0 -39
- data/test/commands/restart_test.rb +0 -46
- data/test/commands/save_test.rb +0 -67
- data/test/commands/set_test.rb +0 -140
- data/test/commands/show_test.rb +0 -76
- data/test/commands/source_test.rb +0 -46
- data/test/commands/stepping_test.rb +0 -192
- data/test/commands/thread_test.rb +0 -164
- data/test/commands/trace_test.rb +0 -71
- data/test/commands/undisplay_test.rb +0 -75
- data/test/commands/variables_test.rb +0 -105
- data/test/debugger_alias_test.rb +0 -7
- data/test/runner_test.rb +0 -150
- data/test/support/matchers.rb +0 -65
- data/test/support/test_interface.rb +0 -59
- data/test/support/utils.rb +0 -122
- data/test/test_helper.rb +0 -58
data/test/commands/list_test.rb
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class ListTestCase < TestCase
|
3
|
-
def setup
|
4
|
-
@example = -> do
|
5
|
-
byebug
|
6
|
-
a = 6
|
7
|
-
a = 7
|
8
|
-
a = 8
|
9
|
-
a = 9
|
10
|
-
a = 10
|
11
|
-
a = 11
|
12
|
-
a = 12
|
13
|
-
a = 13
|
14
|
-
a = 14
|
15
|
-
a = 15
|
16
|
-
a = 16
|
17
|
-
a = 17
|
18
|
-
a = 18
|
19
|
-
a = 19
|
20
|
-
a = 20
|
21
|
-
a = 21
|
22
|
-
a = 22
|
23
|
-
a = 23
|
24
|
-
a = 24
|
25
|
-
a = 25
|
26
|
-
a = '%26'
|
27
|
-
end
|
28
|
-
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_lists_source_code_lines
|
33
|
-
Setting[:listsize] = 10
|
34
|
-
enter 'list'
|
35
|
-
debug_proc(@example)
|
36
|
-
check_output_includes "[1, 10] in #{__FILE__}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_listsize_is_not_set_if_parameter_is_not_an_integer
|
40
|
-
enter 'set listsize 15.0', 'list'
|
41
|
-
debug_proc(@example)
|
42
|
-
check_output_doesnt_include "[1, 15] in #{__FILE__}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_moves_range_up_when_it_goes_before_beginning_of_file
|
46
|
-
Setting[:listsize] = 12
|
47
|
-
enter 'list'
|
48
|
-
debug_proc(@example)
|
49
|
-
check_output_includes "[1, 12] in #{__FILE__}"
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_does_not_list_after_the_end_of_file
|
53
|
-
n_lines = %x{wc -l #{__FILE__}}.split.first.to_i
|
54
|
-
enter 'break 18', 'cont', "list #{n_lines-3}-#{n_lines+6}"
|
55
|
-
debug_proc(@example)
|
56
|
-
check_output_includes "[#{n_lines-3}, #{n_lines}] in #{__FILE__}"
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_lists_the_whole_file_if_number_of_lines_is_smaller_than_listsize
|
60
|
-
Setting[:listsize] = 1000
|
61
|
-
n_lines = %x{wc -l #{__FILE__}}.split.first.to_i
|
62
|
-
enter 'list'
|
63
|
-
debug_proc(@example)
|
64
|
-
check_output_includes "[1, #{n_lines}] in #{__FILE__}"
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_lists_surrounding_lines_after_the_first_call_to_list
|
68
|
-
enter 'break 8', 'cont', 'list'
|
69
|
-
debug_proc(@example)
|
70
|
-
check_output_includes "[3, 12] in #{__FILE__}"
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_lists_forwards_after_the_second_call_to_list
|
74
|
-
enter 'break 8', 'cont', 'list', 'list'
|
75
|
-
debug_proc(@example)
|
76
|
-
check_output_includes "[13, 22] in #{__FILE__}"
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_lists_surrounding_lines_after_the_first_call_to_list_minus
|
80
|
-
enter 'break 18', 'cont', 'list -'
|
81
|
-
debug_proc(@example)
|
82
|
-
check_output_includes "[13, 22] in #{__FILE__}"
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_lists_backwards_after_the_second_call_to_list_minus
|
86
|
-
enter 'break 18', 'cont', 'list -', 'list -'
|
87
|
-
debug_proc(@example)
|
88
|
-
check_output_includes "[3, 12] in #{__FILE__}"
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_lists_backwards_from_end_of_file
|
92
|
-
n_lines = %x{wc -l #{__FILE__}}.split.first.to_i
|
93
|
-
enter 'break 18', 'cont', "list #{n_lines-9}-#{n_lines}", 'list -'
|
94
|
-
debug_proc(@example)
|
95
|
-
check_output_includes "[#{n_lines-19}, #{n_lines-10}] in #{__FILE__}"
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_lists_surrounding_lines_when_list_equals_is_called
|
99
|
-
enter 'break 8', 'cont', 'list ='
|
100
|
-
debug_proc(@example)
|
101
|
-
check_output_includes "[3, 12] in #{__FILE__}"
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_lists_specific_range_when_requested_in_hyphen_format
|
105
|
-
enter 'list 7-9'
|
106
|
-
debug_proc(@example)
|
107
|
-
check_output_includes "[7, 9] in #{__FILE__}"
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_lists_specific_range_when_requested_in_comma_format
|
111
|
-
enter 'list 7,9'
|
112
|
-
debug_proc(@example)
|
113
|
-
check_output_includes "[7, 9] in #{__FILE__}"
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_lists_nothing_if_unexistent_range_is_specified
|
117
|
-
enter 'list 500,505'
|
118
|
-
debug_proc(@example)
|
119
|
-
check_error_includes 'Invalid line range'
|
120
|
-
check_output_doesnt_include "[500, 505] in #{__FILE__}"
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_lists_nothing_if_invalid_range_is_specified
|
124
|
-
enter 'list 5,4'
|
125
|
-
debug_proc(@example)
|
126
|
-
check_error_includes 'Invalid line range'
|
127
|
-
check_output_doesnt_include "[5, 4] in #{__FILE__}"
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_list_proper_lines_when_range_around_specific_line_with_hyphen
|
131
|
-
enter 'list 17-'
|
132
|
-
debug_proc(@example)
|
133
|
-
check_output_includes "[12, 21] in #{__FILE__}"
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_list_proper_lines_when_range_around_specific_line_with_comma
|
137
|
-
enter 'list 17,'
|
138
|
-
debug_proc(@example)
|
139
|
-
check_output_includes "[12, 21] in #{__FILE__}"
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_shows_an_error_when_the_file_to_list_does_not_exist
|
143
|
-
enter -> { state.file = 'blabla'; 'list 7-7' }
|
144
|
-
debug_proc(@example)
|
145
|
-
check_error_includes 'No sourcefile available for blabla'
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_correctly_print_lines_containing_the_percentage_symbol
|
149
|
-
enter 'list 26'
|
150
|
-
debug_proc(@example)
|
151
|
-
check_output_includes "26: a = '%26'"
|
152
|
-
end
|
153
|
-
|
154
|
-
def test_lists_file_changes_by_default
|
155
|
-
enter 'list', -> do
|
156
|
-
change_line_in_file(__FILE__, 7, ' a = 100')
|
157
|
-
'list 7-7'
|
158
|
-
end
|
159
|
-
debug_proc(@example)
|
160
|
-
check_output_includes(/7:\s+a = 100/)
|
161
|
-
change_line_in_file(__FILE__, 7, ' a = 7')
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_does_not_list_file_changes_with_autoreload_disabled
|
165
|
-
enter 'set noautoreload', 'list', -> do
|
166
|
-
change_line_in_file(__FILE__, 7, ' a = 100')
|
167
|
-
'list 7-7'
|
168
|
-
end, 'set autoreload'
|
169
|
-
debug_proc(@example)
|
170
|
-
check_output_doesnt_include(/7:\s+a = 100/)
|
171
|
-
change_line_in_file(__FILE__, 7, ' a = 7')
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class MethodExample
|
3
|
-
def initialize
|
4
|
-
@a = 'b'
|
5
|
-
@c = 'd'
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.foo
|
9
|
-
'asdf'
|
10
|
-
end
|
11
|
-
|
12
|
-
def bla
|
13
|
-
'asdf'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class MethodTestCase < TestCase
|
18
|
-
def setup
|
19
|
-
@example = -> do
|
20
|
-
byebug
|
21
|
-
a = MethodExample.new
|
22
|
-
a.bla
|
23
|
-
end
|
24
|
-
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
%w(method m).each do |cmd_alias|
|
29
|
-
define_method(:"test_#{cmd_alias}_shows_instance_methods_of_a_class") do
|
30
|
-
enter 'break 4', 'cont', "#{cmd_alias} MethodExample"
|
31
|
-
debug_proc(@example)
|
32
|
-
check_output_includes(/bla/)
|
33
|
-
check_output_doesnt_include(/foo/)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_m_shows_an_error_if_specified_object_is_not_a_class_or_module
|
38
|
-
enter 'm a'
|
39
|
-
debug_proc(@example)
|
40
|
-
check_output_includes 'Should be Class/Module: a'
|
41
|
-
end
|
42
|
-
|
43
|
-
['method instance', 'm i'].each do |cmd_alias|
|
44
|
-
define_method(:"test_#{cmd_alias}_shows_methods_of_object") do
|
45
|
-
enter 'break 22', 'cont', "#{cmd_alias} a"
|
46
|
-
debug_proc(@example)
|
47
|
-
check_output_includes(/bla/)
|
48
|
-
check_output_doesnt_include(/foo/)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class PostMortemExample
|
3
|
-
def a
|
4
|
-
z = 4
|
5
|
-
raise 'blabla'
|
6
|
-
x = 6
|
7
|
-
x + z
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class PostMortemTestCase < TestCase
|
12
|
-
def setup
|
13
|
-
@example = -> do
|
14
|
-
byebug
|
15
|
-
c = PostMortemExample.new
|
16
|
-
c.a
|
17
|
-
end
|
18
|
-
|
19
|
-
super
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_rises_before_exit_in_post_mortem_mode
|
23
|
-
enter 'set post_mortem', 'cont', 'set nopost_mortem'
|
24
|
-
assert_raises(RuntimeError) do
|
25
|
-
debug_proc(@example)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_post_mortem_mode_sets_post_mortem_flag_to_true
|
30
|
-
enter 'set post_mortem', 'cont', 'set nopost_mortem'
|
31
|
-
begin
|
32
|
-
debug_proc(@example)
|
33
|
-
rescue
|
34
|
-
assert_equal true, Byebug.post_mortem?
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_execution_is_stop_at_the_correct_line_after_exception
|
39
|
-
enter 'set post_mortem', 'cont', 'set nopost_mortem'
|
40
|
-
begin
|
41
|
-
debug_proc(@example)
|
42
|
-
rescue
|
43
|
-
assert_equal 5, Byebug.raised_exception.__bb_line
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
%w(step next finish break condition display reload).each do |cmd|
|
48
|
-
define_method "test_#{cmd}_is_forbidden_in_post_mortem_mode" do
|
49
|
-
enter 'set noautoeval', 'set post_mortem', "#{cmd}", 'set no_postmortem'
|
50
|
-
Context.any_instance.stubs(:dead?).returns(:true)
|
51
|
-
begin
|
52
|
-
debug_proc(@example)
|
53
|
-
rescue RuntimeError
|
54
|
-
check_error_includes 'Command unavailable in post mortem mode.'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
['restart', 'frame', 'quit', 'edit', 'info', 'irb', 'source', 'help',
|
60
|
-
'var class', 'list', 'method', 'kill', 'eval', 'set', 'save', 'show',
|
61
|
-
'trace', 'thread list'].each do |cmd|
|
62
|
-
define_method "test_#{cmd}_is_permitted_in_post_mortem_mode" do
|
63
|
-
enter 'set post_mortem', "#{cmd}", 'set no_postmortem'
|
64
|
-
class_name = cmd.gsub(/(^| )\w/) { |b| b[-1,1].upcase } + 'Command'
|
65
|
-
|
66
|
-
Byebug.const_get(class_name).any_instance.stubs(:execute)
|
67
|
-
assert_raises(RuntimeError) { debug_proc(@example) }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/test/commands/pry_test.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class PryTestCase < TestCase
|
3
|
-
def setup
|
4
|
-
@example = -> do
|
5
|
-
byebug
|
6
|
-
a = 2
|
7
|
-
a = 3
|
8
|
-
a = 4
|
9
|
-
end
|
10
|
-
|
11
|
-
super
|
12
|
-
|
13
|
-
interface.stubs(:kind_of?).with(LocalInterface).returns(true)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_pry_command_starts_a_pry_session
|
17
|
-
PryCommand.any_instance.expects(:execute)
|
18
|
-
enter 'pry'
|
19
|
-
debug_proc(@example)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_autopry_calls_pry_automatically_after_every_stop
|
23
|
-
skip 'TODO'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end if defined?(Pry)
|
data/test/commands/quit_test.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class QuitTestCase < TestCase
|
3
|
-
def setup
|
4
|
-
@example = -> do
|
5
|
-
byebug
|
6
|
-
Object.new
|
7
|
-
end
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_finishes_byebug_if_user_confirms
|
13
|
-
QuitCommand.any_instance.expects(:exit!)
|
14
|
-
enter 'quit', 'y'
|
15
|
-
debug_proc(@example)
|
16
|
-
check_confirm_includes 'Really quit? (y/n)'
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_does_not_quit_if_user_did_not_confirm
|
20
|
-
QuitCommand.any_instance.expects(:exit!).never
|
21
|
-
enter 'quit', 'n'
|
22
|
-
debug_proc(@example)
|
23
|
-
check_confirm_includes 'Really quit? (y/n)'
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_quits_inmediately_if_used_with_bang
|
27
|
-
QuitCommand.any_instance.expects(:exit!)
|
28
|
-
enter 'quit!'
|
29
|
-
debug_proc(@example)
|
30
|
-
check_confirm_doesnt_include 'Really quit? (y/n)'
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_quits_inmediately_if_used_with_unconditionally
|
34
|
-
QuitCommand.any_instance.expects(:exit!)
|
35
|
-
enter 'quit unconditionally'
|
36
|
-
debug_proc(@example)
|
37
|
-
check_confirm_doesnt_include 'Really quit? (y/n)'
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_closes_interface_before_quitting
|
41
|
-
QuitCommand.any_instance.stubs(:exit!)
|
42
|
-
interface.expects(:close)
|
43
|
-
enter 'quit!'
|
44
|
-
debug_proc(@example)
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_quits_if_used_with_exit_alias
|
48
|
-
QuitCommand.any_instance.expects(:exit!)
|
49
|
-
enter 'exit!'
|
50
|
-
debug_proc(@example)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class ReloadTestCase < TestCase
|
3
|
-
def setup
|
4
|
-
@example = -> do
|
5
|
-
byebug
|
6
|
-
a = 6
|
7
|
-
a = 7
|
8
|
-
a = 8
|
9
|
-
a = 9
|
10
|
-
a = 10
|
11
|
-
end
|
12
|
-
|
13
|
-
super
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_reload_notifies_about_default_setting
|
17
|
-
enter 'reload'
|
18
|
-
debug_proc(@example)
|
19
|
-
check_output_includes \
|
20
|
-
'Source code was reloaded. Automatic reloading is on'
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_reload_notifies_that_automatic_reloading_is_off_is_setting_changed
|
24
|
-
enter 'set noautoreload', 'reload'
|
25
|
-
debug_proc(@example)
|
26
|
-
check_output_includes \
|
27
|
-
'Source code was reloaded. Automatic reloading is off'
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_reload_properly_reloads_source_code
|
31
|
-
enter 'break 7', 'cont', 'l 8-8',
|
32
|
-
-> { change_line_in_file(__FILE__, 8, ' a = 100'); 'reload' },
|
33
|
-
'l 8-8'
|
34
|
-
debug_proc(@example)
|
35
|
-
check_output_includes '8: a = 100'
|
36
|
-
change_line_in_file(__FILE__, 8, ' a = 8')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Byebug
|
2
|
-
class RestartExample
|
3
|
-
def concat_args(a, b, c)
|
4
|
-
a.to_s + b.to_s + c.to_s
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
class RestartTestCase < TestCase
|
9
|
-
def setup
|
10
|
-
@example = -> do
|
11
|
-
byebug
|
12
|
-
a = ARGV[0]
|
13
|
-
b = ARGV[1]
|
14
|
-
c = ARGV[2]
|
15
|
-
RestartExample.new.concat_args(a, b, c)
|
16
|
-
end
|
17
|
-
|
18
|
-
super
|
19
|
-
end
|
20
|
-
|
21
|
-
def must_restart(cmd = nil)
|
22
|
-
expectation = RestartCommand.any_instance.expects(:exec)
|
23
|
-
expectation = expectation.with(cmd) if cmd
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_restarts_with_manual_arguments
|
27
|
-
cmd = "ruby -rbyebug -I#{$LOAD_PATH.join(' -I')} test/test_helper.rb 1 2"
|
28
|
-
must_restart(cmd)
|
29
|
-
|
30
|
-
enter 'restart 1 2'
|
31
|
-
debug_proc(@example)
|
32
|
-
check_output_includes "Re exec'ing:\n\t#{cmd}"
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_still_restarts_shows_messages_when_attached_to_running_program
|
36
|
-
must_restart
|
37
|
-
enter 'restart'
|
38
|
-
|
39
|
-
debug_proc(@example)
|
40
|
-
check_output_includes 'Byebug was not called from the outset...'
|
41
|
-
check_output_includes \
|
42
|
-
"Program #{Byebug.debugged_program} not executable... " \
|
43
|
-
"Wrapping it in a ruby call"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|