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/continue_test.rb
CHANGED
@@ -1,50 +1,47 @@
|
|
1
|
-
module
|
2
|
-
class
|
1
|
+
module Byebug
|
2
|
+
class ContinueExample
|
3
3
|
def self.a(num)
|
4
4
|
num + 4
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
-
class ContinueTestCase <
|
9
|
-
|
10
|
-
@example =
|
8
|
+
class ContinueTestCase < TestCase
|
9
|
+
def setup
|
10
|
+
@example = -> do
|
11
11
|
byebug
|
12
12
|
|
13
13
|
b = 5
|
14
14
|
c = b + 5
|
15
|
-
|
15
|
+
ContinueExample.a(c)
|
16
16
|
end
|
17
|
-
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
enter 'break 14', 'continue'
|
22
|
-
debug_proc(@example) { state.line.must_equal 14 }
|
23
|
-
end
|
18
|
+
super
|
19
|
+
end
|
24
20
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
def test_continues_up_to_breakpoint_if_no_line_specified
|
22
|
+
enter 'break 14', 'continue'
|
23
|
+
debug_proc(@example) { assert_equal 14, state.line }
|
24
|
+
end
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
26
|
+
def test_works_in_abbreviated_mode_too
|
27
|
+
enter 'break 14', 'cont'
|
28
|
+
debug_proc(@example) { assert_equal 14, state.line }
|
34
29
|
end
|
35
30
|
|
36
|
-
|
37
|
-
|
31
|
+
def test_continues_up_to_the_specified_line
|
32
|
+
enter 'cont 14'
|
33
|
+
debug_proc(@example) { assert_equal 14, state.line }
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
def test_ignores_the_command_if_specified_line_is_not_valid
|
37
|
+
enter 'cont 100'
|
38
|
+
debug_proc(@example) { assert_equal 13, state.line }
|
39
|
+
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
41
|
+
def test_shows_error_if_specified_line_is_not_valid
|
42
|
+
enter 'cont 100'
|
43
|
+
debug_proc(@example)
|
44
|
+
check_error_includes 'Line 100 is not a valid stopping point in file'
|
48
45
|
end
|
49
46
|
end
|
50
47
|
end
|
data/test/debugger_alias_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
module
|
2
|
-
class
|
3
|
-
|
4
|
-
Kernel.method(:
|
1
|
+
module DebuggerAlias
|
2
|
+
class DebuggerAliasTest < Minitest::Test
|
3
|
+
def test_aliases_debugger_to_byebug
|
4
|
+
assert_equal Kernel.method(:byebug), Kernel.method(:debugger)
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
data/test/delete_test.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Byebug
|
2
|
+
class DeleteTestCase < TestCase
|
3
|
+
def setup
|
4
|
+
@example = -> do
|
5
|
+
byebug
|
6
|
+
x = 1
|
7
|
+
x += 1
|
8
|
+
return x
|
9
|
+
end
|
10
|
+
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_deleting_a_breakpoint_removes_it_from_breakpoints_list
|
15
|
+
enter 'break 7', -> { "delete #{first_brkpt.id}" }
|
16
|
+
|
17
|
+
debug_proc(@example) { assert_empty Byebug.breakpoints }
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_does_not_stop_at_the_deleted_breakpoint
|
21
|
+
enter 'break 7', 'break 8', -> { "delete #{first_brkpt.id}" }, 'cont'
|
22
|
+
|
23
|
+
debug_proc(@example) { assert_equal 8, state.line }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/test/display_test.rb
CHANGED
@@ -1,135 +1,113 @@
|
|
1
|
-
module
|
2
|
-
class DisplayTestCase <
|
3
|
-
|
1
|
+
module Byebug
|
2
|
+
class DisplayTestCase < TestCase
|
3
|
+
def setup
|
4
4
|
@example = -> do
|
5
|
+
d = 0
|
5
6
|
byebug
|
6
|
-
d = 4
|
7
|
-
d = d + 2
|
8
7
|
d = d + 3
|
9
8
|
d = d + 6
|
10
9
|
end
|
10
|
+
|
11
|
+
super
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
-
enter '
|
14
|
+
def test_shows_expressions
|
15
|
+
enter 'display d + 1'
|
15
16
|
debug_proc(@example)
|
16
|
-
check_output_includes '1: ', 'd + 1 =
|
17
|
+
check_output_includes '1: ', 'd + 1 = 1'
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
-
enter '
|
20
|
+
def test_works_when_using_a_shortcut
|
21
|
+
enter 'disp d + 1'
|
21
22
|
debug_proc(@example)
|
22
|
-
check_output_includes '1: ', 'd + 1 =
|
23
|
+
check_output_includes '1: ', 'd + 1 = 1'
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
+
def test_saves_displayed_expressions
|
26
27
|
enter 'display d + 1'
|
27
|
-
debug_proc(@example) {
|
28
|
+
debug_proc(@example) { assert_equal [[true, 'd + 1']], state.display }
|
28
29
|
end
|
29
30
|
|
30
|
-
|
31
|
-
enter '
|
32
|
-
Byebug.handler.display.concat([[true, 'abc'], [true, 'd']]); 'display'
|
33
|
-
end
|
31
|
+
def test_displays_all_expressions_available
|
32
|
+
enter 'display d', 'display d + 1', 'display'
|
34
33
|
debug_proc(@example)
|
35
|
-
check_output_includes '1: ', '
|
34
|
+
check_output_includes '1: ', 'd = 0', '2: ', 'd + 1 = 1'
|
36
35
|
end
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
|
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
|
65
|
-
end
|
66
|
-
|
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
|
79
|
-
end
|
38
|
+
class UndisplayTestCase < TestCase
|
39
|
+
def setup
|
40
|
+
@example = -> do
|
41
|
+
d = 0
|
42
|
+
byebug
|
43
|
+
d = d + 3
|
44
|
+
d = d + 6
|
80
45
|
end
|
81
46
|
|
82
|
-
|
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
|
89
|
-
|
90
|
-
it 'must set inactive positions' do
|
91
|
-
debug_proc(@example) { state.display.must_equal [[nil, 'abc'],
|
92
|
-
[true, 'd']] }
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'must display only the active position' do
|
96
|
-
debug_proc(@example)
|
97
|
-
check_output_includes '2: ', 'd = 4'
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'must not display the disabled position' do
|
101
|
-
debug_proc(@example)
|
102
|
-
check_output_doesnt_include '1: ', 'abc'
|
103
|
-
end
|
104
|
-
end
|
47
|
+
super
|
105
48
|
end
|
106
49
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
50
|
+
def test_asks_for_confirmation
|
51
|
+
enter 'display d', 'display d + 1', 'undisplay'
|
52
|
+
debug_proc(@example)
|
53
|
+
check_output_includes \
|
54
|
+
'Clear all expressions? (y/n)', interface.confirm_queue
|
55
|
+
end
|
112
56
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
'No display expressions have been set.', interface.error_queue
|
57
|
+
def test_removes_all_expressions_from_list_if_confirmed
|
58
|
+
enter 'display d', 'display d + 1', 'undisplay', 'y', 'next'
|
59
|
+
debug_proc(@example) do
|
60
|
+
assert_equal [[false, 'd'], [false, 'd + 1']], state.display
|
118
61
|
end
|
62
|
+
check_output_doesnt_include '1: ', 'd = 3', '2: ', 'd + 1 = 4'
|
63
|
+
end
|
119
64
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
'"disable display" argument "4" needs to be at most 1'
|
65
|
+
def test_does_not_remove_all_expressions_from_list_unless_confirmed
|
66
|
+
enter 'display d', 'display d + 1', 'undisplay', 'n', 'display'
|
67
|
+
debug_proc(@example) do
|
68
|
+
assert_equal [[true, 'd'], [true, 'd + 1']], state.display
|
125
69
|
end
|
70
|
+
|
71
|
+
check_output_includes '1: ', 'd = 0', '2: ', 'd + 1 = 1'
|
126
72
|
end
|
127
73
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
74
|
+
def test_marks_specific_expression_from_list_as_inactive
|
75
|
+
enter 'display d', 'display d + 1', 'undisplay 1'
|
76
|
+
|
77
|
+
debug_proc(@example) do
|
78
|
+
assert_equal [[nil, 'd'], [true, 'd + 1']], state.display
|
132
79
|
end
|
133
80
|
end
|
81
|
+
|
82
|
+
def test_displays_only_the_active_position
|
83
|
+
enter 'display d', 'display d + 1', 'undisplay 1', 'next'
|
84
|
+
debug_proc(@example)
|
85
|
+
check_output_includes '2: ', 'd + 1 = 4'
|
86
|
+
check_output_doesnt_include '1: ', 'd = 3'
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_disable_display_removes_the_expression_from_display_list
|
90
|
+
enter 'display d', 'disable display 1'
|
91
|
+
debug_proc(@example) { assert_equal [[false, 'd']], state.display }
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_disable_display_shows_an_error_if_no_displays_are_set
|
95
|
+
enter 'disable display 1'
|
96
|
+
debug_proc(@example)
|
97
|
+
check_output_includes \
|
98
|
+
'No display expressions have been set', interface.error_queue
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_disable_display_shows_an_error_if_theres_no_such_display_position
|
102
|
+
enter 'display d', 'disable display 4'
|
103
|
+
debug_proc(@example)
|
104
|
+
check_output_includes \
|
105
|
+
'"disable display" argument "4" needs to be at most 1'
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_enable_display_set_display_flag_to_true_in_display_list
|
109
|
+
enter 'display d', 'disable display 1', 'enable display 1'
|
110
|
+
debug_proc(@example) { assert_equal [[true, 'd']], state.display }
|
111
|
+
end
|
134
112
|
end
|
135
113
|
end
|
data/test/edit_test.rb
CHANGED
@@ -1,52 +1,49 @@
|
|
1
|
-
module
|
2
|
-
class EditTestCase <
|
3
|
-
|
1
|
+
module Byebug
|
2
|
+
class EditTestCase < TestCase
|
3
|
+
def setup
|
4
4
|
@example = -> do
|
5
5
|
byebug
|
6
6
|
Object.new
|
7
7
|
end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'open configured editor' do
|
11
|
-
temporary_change_hash ENV, 'EDITOR', 'editr'
|
12
8
|
|
13
|
-
|
14
|
-
file = __FILE__
|
15
|
-
Byebug::EditCommand.any_instance.expects(:system).with("editr +6 #{file}")
|
16
|
-
enter 'edit'
|
17
|
-
debug_proc(@example)
|
18
|
-
end
|
9
|
+
super
|
19
10
|
end
|
20
11
|
|
21
|
-
|
22
|
-
|
12
|
+
def after
|
13
|
+
ENV['EDITOR'] = @previous_editor
|
14
|
+
end
|
23
15
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
16
|
+
def test_edit_opens_current_file_in_current_line_in_configured_editor
|
17
|
+
ENV['EDITOR'] = 'edi'
|
18
|
+
file = __FILE__
|
19
|
+
EditCommand.any_instance.expects(:system).with("edi +6 #{file}")
|
20
|
+
enter 'edit'
|
21
|
+
debug_proc(@example)
|
30
22
|
end
|
31
23
|
|
32
|
-
|
33
|
-
|
24
|
+
def test_edit_calls_vim_if_no_EDITOR_environment_variable_is_set
|
25
|
+
ENV['EDITOR'] = nil
|
26
|
+
file = __FILE__
|
27
|
+
EditCommand.any_instance.expects(:system).with("vim +6 #{file}")
|
28
|
+
enter 'edit'
|
29
|
+
debug_proc(@example)
|
30
|
+
end
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
def test_edit_opens_configured_editor_at_specific_line_and_file
|
33
|
+
ENV['EDITOR'] = 'edi'
|
34
|
+
file = File.expand_path('test/test_helper.rb')
|
35
|
+
EditCommand.any_instance.expects(:system).with("edi +3 #{file}")
|
36
|
+
enter "edit #{file}:3"
|
37
|
+
debug_proc(@example)
|
41
38
|
end
|
42
39
|
|
43
|
-
|
40
|
+
def test_edit_shows_an_error_if_file_specified_does_not_exists
|
44
41
|
enter "edit no_such_file:6"
|
45
42
|
debug_proc(@example)
|
46
43
|
check_error_includes 'File "no_such_file" is not readable.'
|
47
44
|
end
|
48
45
|
|
49
|
-
|
46
|
+
def test_edit_shows_an_error_if_incorrect_syntax_is_used
|
50
47
|
enter 'edit blabla'
|
51
48
|
debug_proc(@example)
|
52
49
|
check_error_includes 'Invalid file[:line] number specification: blabla'
|
data/test/eval_test.rb
CHANGED
@@ -1,119 +1,89 @@
|
|
1
|
-
module
|
2
|
-
class
|
1
|
+
module Byebug
|
2
|
+
class EvalExample
|
3
3
|
def sum(a,b)
|
4
4
|
a + b
|
5
5
|
end
|
6
6
|
|
7
7
|
def inspect
|
8
|
-
raise
|
8
|
+
raise 'Broken'
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
class EvalTestCase <
|
13
|
-
|
12
|
+
class EvalTestCase < TestCase
|
13
|
+
def setup
|
14
14
|
@example = -> do
|
15
15
|
byebug
|
16
|
-
@foo =
|
16
|
+
@foo = EvalExample.new
|
17
17
|
@foo.sum(1, 2)
|
18
18
|
end
|
19
|
+
|
20
|
+
super
|
19
21
|
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
%w(eval e p).each do |cmd_alias|
|
24
|
+
define_method(:"test_#{cmd_alias}_properly_evaluates_expressions") do
|
25
|
+
enter 'eval 3 + 2'
|
26
|
+
debug_proc(@example)
|
27
|
+
check_output_includes '5'
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
|
-
|
31
|
+
def test_eval_properly_evaluates_an_expression_using_timeout
|
28
32
|
enter 'eval Timeout::timeout(60) { 1 }'
|
29
33
|
debug_proc(@example)
|
30
34
|
check_output_includes '1'
|
31
35
|
end
|
32
36
|
|
33
|
-
|
34
|
-
enter '
|
35
|
-
debug_proc(@example)
|
36
|
-
check_output_includes '
|
37
|
+
def test_eval_works_when_inspect_raises_an_exception
|
38
|
+
enter 'c 17', 'p @foo'
|
39
|
+
debug_proc(@example) { assert_equal 17, state.line }
|
40
|
+
check_output_includes 'RuntimeError Exception: Broken'
|
37
41
|
end
|
38
42
|
|
39
|
-
|
40
|
-
enter '
|
43
|
+
def test_autoeval_works_by_default
|
44
|
+
enter '[5, 6 , 7].inject(&:+)'
|
41
45
|
debug_proc(@example)
|
42
|
-
check_output_includes '
|
46
|
+
check_output_includes '18'
|
43
47
|
end
|
44
48
|
|
45
|
-
|
46
|
-
enter '
|
47
|
-
|
48
|
-
|
49
|
+
def test_auto_eval_can_be_turned_off_and_back_on
|
50
|
+
enter 'set noautoeval', '[5, 6, 7].inject(&:+)',
|
51
|
+
'set autoeval', '[1, 2, 3].inject(&:+)'
|
52
|
+
debug_proc(@example)
|
53
|
+
check_output_doesnt_include '18'
|
54
|
+
check_output_includes '6'
|
49
55
|
end
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
|
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'
|
64
|
-
end
|
57
|
+
def test_eval_shows_backtrace_on_error_if_stack_on_error_enabled
|
58
|
+
enter 'set stack_on_error', 'eval 2 / 0'
|
59
|
+
debug_proc(@example)
|
60
|
+
check_output_includes(/\s*from \S+:in \`eval\'/)
|
61
|
+
check_output_doesnt_include 'ZeroDivisionError Exception: divided by 0'
|
65
62
|
end
|
66
63
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
81
|
-
|
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
|
88
|
-
end
|
64
|
+
def test_eval_shows_only_exception_if_stack_on_error_disabled
|
65
|
+
enter 'set stack_on_error off', 'eval 2 / 0'
|
66
|
+
debug_proc(@example)
|
67
|
+
check_output_includes 'ZeroDivisionError Exception: divided by 0'
|
68
|
+
check_output_doesnt_include(/\S+:\d+:in `eval':divided by 0/)
|
89
69
|
end
|
90
70
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
check_output_includes "{:a=>\"#{'3' * 40}\",\n :b=>\"#{'4' * 30}\"}"
|
96
|
-
end
|
71
|
+
def test_pp_pretty_print_the_expressions_result
|
72
|
+
enter "pp { a: '3' * 40, b: '4' * 30 }"
|
73
|
+
debug_proc(@example)
|
74
|
+
check_output_includes "{:a=>\"#{'3' * 40}\",\n :b=>\"#{'4' * 30}\"}"
|
97
75
|
end
|
98
76
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
77
|
+
def test_putl_prints_expression_and_columnize_the_result
|
78
|
+
enter 'set width 20', 'putl [1, 2, 3, 4, 5, 9, 8, 7, 6]'
|
79
|
+
debug_proc(@example)
|
80
|
+
check_output_includes "1 3 5 8 6\n2 4 9 7"
|
107
81
|
end
|
108
82
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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
|
83
|
+
def test_putl_prints_expression_and_sorts_and_columnize_the_result
|
84
|
+
enter 'set width 20', 'ps [1, 2, 3, 4, 5, 9, 8, 7, 6]'
|
85
|
+
debug_proc(@example)
|
86
|
+
check_output_includes "1 3 5 7 9\n2 4 6 8"
|
117
87
|
end
|
118
88
|
end
|
119
89
|
end
|