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.
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,82 +0,0 @@
1
- module ConditionsTest
2
- class ConditionsTestCase < TestDsl::TestCase
3
- before do
4
- @example = lambda do
5
- byebug
6
- b = 5
7
- c = b + 5
8
- c = Object.new
9
- end
10
- end
11
-
12
- def first
13
- Byebug.breakpoints.first
14
- end
15
-
16
- describe 'setting condition' do
17
- before { enter 'break 7' }
18
-
19
- describe 'successfully' do
20
- before { enter ->{ "cond #{first.id} b == 5" }, 'cont' }
21
-
22
- it 'must assign the expression to breakpoint' do
23
- debug_proc(@example) { first.expr.must_equal 'b == 5' }
24
- end
25
-
26
- it 'must stop at the breakpoint if condition is true' do
27
- debug_proc(@example) { state.line.must_equal 7 }
28
- end
29
-
30
- it 'must work with full command name too' do
31
- debug_proc(@example) { state.line.must_equal 7 }
32
- end
33
- end
34
-
35
- describe 'unsuccessfully' do
36
- before { enter 'break 8' }
37
-
38
- it 'must not stop at the breakpoint if condition is false' do
39
- enter ->{ "cond #{first.id} b == 3" }, 'cont'
40
- debug_proc(@example) { state.line.must_equal 8 }
41
- end
42
-
43
- it 'must assign expression to breakpoint in spite of incorrect syntax' do
44
- enter ->{ "cond #{first.id} b =="}, 'cont'
45
- debug_proc(@example) { first.expr.must_equal 'b ==' }
46
- end
47
-
48
- it 'must ignore the condition if when incorrect syntax' do
49
- enter ->{ "cond #{first.id} b ==" }, 'cont'
50
- debug_proc(@example) { state.line.must_equal 8 }
51
- end
52
- end
53
- end
54
-
55
- describe 'removing conditions' do
56
- before do
57
- enter 'break 7 if b == 3', 'break 8', -> { "cond #{first.id}" }, 'cont'
58
- end
59
-
60
- it 'must remove the condition from the breakpoint' do
61
- debug_proc(@example) { first.expr.must_be_nil }
62
- end
63
-
64
- it 'must unconditionally stop on the breakpoint' do
65
- debug_proc(@example) { state.line.must_equal 7 }
66
- end
67
- end
68
-
69
- describe 'errors' do
70
- it 'must show error if there are no breakpoints' do
71
- enter 'cond 1 true'
72
- debug_proc(@example)
73
- check_output_includes 'No breakpoints have been set.'
74
- end
75
-
76
- it 'must not set breakpoint condition if breakpoint id is incorrect' do
77
- enter 'break 7', 'cond 8 b == 3', 'cont'
78
- debug_proc(@example) { state.line.must_equal 7 }
79
- end
80
- end
81
- end
82
- end
@@ -1,75 +0,0 @@
1
- module ReplTest
2
- class ReplTestCase < TestDsl::TestCase
3
- before do
4
- @example = -> do
5
- byebug
6
- a = 2
7
- a = 3
8
- a = 4
9
- a = 5
10
- a = 6
11
- end
12
- end
13
-
14
- describe 'Irb Command' do
15
- before do
16
- interface.stubs(:kind_of?).with(Byebug::LocalInterface).returns(true)
17
- IRB::Irb.stubs(:new).returns(irb)
18
- end
19
-
20
- let(:irb) { stub(context: ->{}) }
21
-
22
- it 'must support next command' do
23
- irb.stubs(:eval_input).throws(:IRB_EXIT, :next)
24
- enter 'irb'
25
- debug_proc(@example) { state.line.must_equal 7 }
26
- end
27
-
28
- it 'must support step command' do
29
- irb.stubs(:eval_input).throws(:IRB_EXIT, :step)
30
- enter 'irb'
31
- debug_proc(@example) { state.line.must_equal 7 }
32
- end
33
-
34
- it 'must support cont command' do
35
- irb.stubs(:eval_input).throws(:IRB_EXIT, :cont)
36
- enter 'break 8', 'irb'
37
- debug_proc(@example) { state.line.must_equal 8 }
38
- end
39
-
40
- it 'autoirb must call irb automatically after breakpoint' do
41
- irb.expects(:eval_input)
42
- enter 'set autoirb', 'break 8', 'cont', 'set noautoirb'
43
- debug_proc(@example)
44
- end
45
- end
46
-
47
- @has_pry = false
48
- describe 'Pry command' do
49
- before do
50
- interface.stubs(:kind_of?).with(Byebug::LocalInterface).returns(true)
51
- Byebug::PryCommand.any_instance.expects(:pry)
52
- end
53
-
54
- it 'must support step command' do
55
- skip 'TODO'
56
- end
57
-
58
- it 'must support cont command' do
59
- skip 'TODO'
60
- end
61
-
62
- describe 'autopry' do
63
- it 'must call pry automatically after breakpoint' do
64
- skip 'TODO'
65
- end
66
- end
67
-
68
- describe 'post-mortem' do
69
- it 'must work in post-mortem mode' do
70
- skip 'TODO'
71
- end
72
- end
73
- end if @has_pry
74
- end
75
- end