byebug 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -2
  3. data/CHANGELOG.md +15 -0
  4. data/GUIDE.md +17 -35
  5. data/Gemfile +8 -5
  6. data/LICENSE +1 -1
  7. data/README.md +10 -22
  8. data/Rakefile +1 -1
  9. data/ext/byebug/byebug.c +3 -2
  10. data/lib/byebug.rb +3 -38
  11. data/lib/byebug/commands/break.rb +83 -0
  12. data/lib/byebug/commands/catchpoint.rb +0 -1
  13. data/lib/byebug/commands/condition.rb +10 -6
  14. data/lib/byebug/commands/continue.rb +3 -6
  15. data/lib/byebug/commands/delete.rb +38 -0
  16. data/lib/byebug/commands/edit.rb +0 -2
  17. data/lib/byebug/commands/enable.rb +7 -8
  18. data/lib/byebug/commands/finish.rb +0 -2
  19. data/lib/byebug/commands/frame.rb +13 -15
  20. data/lib/byebug/commands/help.rb +1 -3
  21. data/lib/byebug/commands/history.rb +3 -3
  22. data/lib/byebug/commands/info.rb +4 -13
  23. data/lib/byebug/commands/interrupt.rb +25 -0
  24. data/lib/byebug/commands/kill.rb +0 -2
  25. data/lib/byebug/commands/list.rb +2 -4
  26. data/lib/byebug/commands/method.rb +2 -8
  27. data/lib/byebug/commands/quit.rb +0 -2
  28. data/lib/byebug/commands/reload.rb +2 -15
  29. data/lib/byebug/commands/repl.rb +0 -3
  30. data/lib/byebug/commands/{control.rb → restart.rb} +2 -26
  31. data/lib/byebug/commands/save.rb +0 -1
  32. data/lib/byebug/commands/set.rb +4 -7
  33. data/lib/byebug/commands/show.rb +0 -3
  34. data/lib/byebug/commands/source.rb +0 -3
  35. data/lib/byebug/commands/stepping.rb +3 -4
  36. data/lib/byebug/commands/trace.rb +0 -1
  37. data/lib/byebug/commands/variables.rb +3 -4
  38. data/lib/byebug/context.rb +0 -1
  39. data/lib/byebug/helper.rb +23 -0
  40. data/lib/byebug/interfaces/script_interface.rb +1 -1
  41. data/lib/byebug/processors/command_processor.rb +9 -9
  42. data/lib/byebug/remote.rb +2 -2
  43. data/lib/byebug/setting.rb +3 -1
  44. data/lib/byebug/settings/autoeval.rb +3 -1
  45. data/lib/byebug/settings/autoirb.rb +3 -1
  46. data/lib/byebug/settings/autolist.rb +3 -1
  47. data/lib/byebug/settings/autoreload.rb +1 -3
  48. data/lib/byebug/settings/autosave.rb +1 -3
  49. data/lib/byebug/settings/callstyle.rb +2 -4
  50. data/lib/byebug/settings/fullpath.rb +1 -3
  51. data/lib/byebug/settings/histfile.rb +1 -3
  52. data/lib/byebug/settings/histsize.rb +0 -4
  53. data/lib/byebug/settings/listsize.rb +1 -3
  54. data/lib/byebug/settings/post_mortem.rb +14 -1
  55. data/lib/byebug/settings/width.rb +1 -17
  56. data/lib/byebug/version.rb +1 -1
  57. data/test/break_test.rb +376 -0
  58. data/test/condition_test.rb +82 -0
  59. data/test/continue_test.rb +27 -30
  60. data/test/debugger_alias_test.rb +4 -4
  61. data/test/delete_test.rb +26 -0
  62. data/test/display_test.rb +80 -102
  63. data/test/edit_test.rb +28 -31
  64. data/test/eval_test.rb +50 -80
  65. data/test/finish_test.rb +23 -23
  66. data/test/frame_test.rb +172 -186
  67. data/test/help_test.rb +27 -37
  68. data/test/history_test.rb +32 -41
  69. data/test/info_test.rb +198 -230
  70. data/test/interrupt_test.rb +17 -36
  71. data/test/irb_test.rb +47 -0
  72. data/test/kill_test.rb +19 -19
  73. data/test/list_test.rb +126 -133
  74. data/test/method_test.rb +21 -54
  75. data/test/post_mortem_test.rb +44 -46
  76. data/test/pry_test.rb +42 -0
  77. data/test/quit_test.rb +17 -15
  78. data/test/reload_test.rb +23 -28
  79. data/test/restart_test.rb +35 -63
  80. data/test/save_test.rb +46 -62
  81. data/test/set_test.rb +93 -144
  82. data/test/show_test.rb +50 -71
  83. data/test/source_test.rb +23 -26
  84. data/test/stepping_test.rb +125 -153
  85. data/test/support/matchers.rb +1 -6
  86. data/test/support/test_interface.rb +1 -1
  87. data/test/support/{test_dsl.rb → utils.rb} +17 -64
  88. data/test/test_helper.rb +25 -7
  89. data/test/thread_test.rb +101 -89
  90. data/test/trace_test.rb +48 -85
  91. data/test/variables_test.rb +43 -80
  92. metadata +18 -13
  93. data/lib/byebug/commands/breakpoints.rb +0 -137
  94. data/lib/byebug/commands/skip.rb +0 -30
  95. data/test/breakpoints_test.rb +0 -474
  96. data/test/conditions_test.rb +0 -82
  97. data/test/repl_test.rb +0 -75
@@ -1,50 +1,47 @@
1
- module ContinueTest
2
- class Example
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 < TestDsl::TestCase
9
- before do
10
- @example = lambda do
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
- Example.a(c)
15
+ ContinueExample.a(c)
16
16
  end
17
- end
18
17
 
19
- describe 'successful' do
20
- it 'must continue up to breakpoint if no line specified' do
21
- enter 'break 14', 'continue'
22
- debug_proc(@example) { state.line.must_equal 14 }
23
- end
18
+ super
19
+ end
24
20
 
25
- it 'must work in abbreviated mode too' do
26
- enter 'break 14', 'cont'
27
- debug_proc(@example) { state.line.must_equal 14 }
28
- end
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
- it 'must continue up to specified line' do
31
- enter 'cont 14'
32
- debug_proc(@example) { state.line.must_equal 14 }
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
- describe 'unsuccessful' do
37
- before { enter 'cont 100' }
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
- it 'must ignore the command if specified line is not valid' do
40
- debug_proc(@example) { state.line.must_equal 13 }
41
- end
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
- it 'must show error if specified line is not valid' do
44
- debug_proc(@example)
45
- check_error_includes \
46
- "Line 100 is not a stopping point in file \"#{__FILE__}\""
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
@@ -1,7 +1,7 @@
1
- module DebuggerAliasTest
2
- class DebuggerAliasSpec < MiniTest::Spec
3
- it 'aliases "debugger" to "byebug"' do
4
- Kernel.method(:debugger).must_equal(Kernel.method(:byebug))
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
@@ -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
@@ -1,135 +1,113 @@
1
- module DisplayTest
2
- class DisplayTestCase < TestDsl::TestCase
3
- before do
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
- it 'must show expressions' do
14
- enter 'break 7', 'cont', 'display d + 1'
14
+ def test_shows_expressions
15
+ enter 'display d + 1'
15
16
  debug_proc(@example)
16
- check_output_includes '1: ', 'd + 1 = 5'
17
+ check_output_includes '1: ', 'd + 1 = 1'
17
18
  end
18
19
 
19
- it 'must work with shortcut' do
20
- enter 'break 7', 'cont', 'disp d + 1'
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 = 5'
23
+ check_output_includes '1: ', 'd + 1 = 1'
23
24
  end
24
25
 
25
- it 'must save displayed expressions' do
26
+ def test_saves_displayed_expressions
26
27
  enter 'display d + 1'
27
- debug_proc(@example) { state.display.must_equal [[true, 'd + 1']] }
28
+ debug_proc(@example) { assert_equal [[true, 'd + 1']], state.display }
28
29
  end
29
30
 
30
- it 'displays all expressions available' do
31
- enter 'break 7', 'cont', -> do
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: ', 'abc = nil', '2: ', 'd = 4'
34
+ check_output_includes '1: ', 'd = 0', '2: ', 'd + 1 = 1'
36
35
  end
36
+ end
37
37
 
38
- describe 'undisplay' do
39
- describe 'undisplay all' do
40
- before do
41
- enter 'break 7', 'cont', -> do
42
- Byebug.handler.display.concat([[true, 'abc'], [true, 'd']])
43
- 'undisplay'
44
- end, confirm_response, 'display'
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
- describe 'undisplay specific position' do
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
- describe 'disable' do
108
- it 'must disable a position' do
109
- enter 'display d', 'disable display 1'
110
- debug_proc(@example) { state.display.must_equal [[false, 'd']] }
111
- end
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
- it 'must show an error if no displays are set' do
114
- enter 'disable display 1'
115
- debug_proc(@example)
116
- check_output_includes \
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
- it 'must show an error if there is no such display position' do
121
- enter 'display d', 'disable display 4'
122
- debug_proc(@example)
123
- check_output_includes \
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
- describe 'enable' do
129
- it 'must enable a position' do
130
- enter 'display d', 'disable display 1', 'enable display 1'
131
- debug_proc(@example) { state.display.must_equal [[true, 'd']] }
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
@@ -1,52 +1,49 @@
1
- module EditTest
2
- class EditTestCase < TestDsl::TestCase
3
- before do
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
- it 'must open current file in current line in configured editor' do
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
- describe 'open default editor' do
22
- temporary_change_hash ENV, 'EDITOR', nil
12
+ def after
13
+ ENV['EDITOR'] = @previous_editor
14
+ end
23
15
 
24
- it 'must call "vim" with current line and file if EDITOR env not set' do
25
- file = __FILE__
26
- Byebug::EditCommand.any_instance.expects(:system).with("vim +6 #{file}")
27
- enter 'edit'
28
- debug_proc(@example)
29
- end
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
- describe 'open configured editor specifying line and file' do
33
- temporary_change_hash ENV, 'EDITOR', 'editr'
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
- it 'must open specified line in specified file with configured editor' do
36
- file = File.expand_path('test/test_helper.rb')
37
- Byebug::EditCommand.any_instance.expects(:system).with("editr +3 #{file}")
38
- enter "edit #{file}:3"
39
- debug_proc(@example)
40
- end
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
- it 'must show an error if there is no such file' do
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
- it 'must show an error if there is incorrect syntax' do
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'
@@ -1,119 +1,89 @@
1
- module EvalTest
2
- class Example
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 "Broken"
8
+ raise 'Broken'
9
9
  end
10
10
  end
11
11
 
12
- class EvalTestCase < TestDsl::TestCase
13
- before do
12
+ class EvalTestCase < TestCase
13
+ def setup
14
14
  @example = -> do
15
15
  byebug
16
- @foo = Example.new
16
+ @foo = EvalExample.new
17
17
  @foo.sum(1, 2)
18
18
  end
19
+
20
+ super
19
21
  end
20
22
 
21
- it 'must evaluate an expression' do
22
- enter 'eval 3 + 2'
23
- debug_proc(@example)
24
- check_output_includes '5'
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
- it 'must evaluate expression that calls Timeout::timeout' do
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
- it 'must work with shortcut' do
34
- enter 'e 3 + 2'
35
- debug_proc(@example)
36
- check_output_includes '5'
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
- it 'must work with another syntax' do
40
- enter 'p 3 + 2'
43
+ def test_autoeval_works_by_default
44
+ enter '[5, 6 , 7].inject(&:+)'
41
45
  debug_proc(@example)
42
- check_output_includes '5'
46
+ check_output_includes '18'
43
47
  end
44
48
 
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
+ 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
- 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
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
- 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
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
- 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
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
- describe 'putl' do
100
- temporary_change_hash Byebug::Setting, :width, 20
101
-
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
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
- describe 'ps' do
110
- temporary_change_hash Byebug::Setting, :width, 20
111
-
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
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