byebug 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/GUIDE.md +2 -2
  4. data/LICENSE +3 -3
  5. data/README.md +5 -4
  6. data/byebug.gemspec +1 -1
  7. data/ext/byebug/byebug.c +20 -19
  8. data/lib/byebug.rb +2 -53
  9. data/lib/byebug/command.rb +9 -109
  10. data/lib/byebug/commands/breakpoints.rb +1 -1
  11. data/lib/byebug/commands/control.rb +20 -21
  12. data/lib/byebug/commands/display.rb +2 -3
  13. data/lib/byebug/commands/eval.rb +6 -16
  14. data/lib/byebug/commands/finish.rb +1 -1
  15. data/lib/byebug/commands/frame.rb +9 -9
  16. data/lib/byebug/commands/help.rb +2 -3
  17. data/lib/byebug/commands/history.rb +28 -0
  18. data/lib/byebug/commands/info.rb +3 -3
  19. data/lib/byebug/commands/list.rb +2 -13
  20. data/lib/byebug/commands/method.rb +5 -45
  21. data/lib/byebug/commands/reload.rb +1 -12
  22. data/lib/byebug/commands/repl.rb +6 -15
  23. data/lib/byebug/commands/save.rb +2 -7
  24. data/lib/byebug/commands/set.rb +45 -116
  25. data/lib/byebug/commands/show.rb +22 -126
  26. data/lib/byebug/commands/stepping.rb +1 -1
  27. data/lib/byebug/commands/trace.rb +14 -25
  28. data/lib/byebug/commands/variables.rb +3 -41
  29. data/lib/byebug/helper.rb +11 -42
  30. data/lib/byebug/history.rb +5 -13
  31. data/lib/byebug/processors/command_processor.rb +6 -6
  32. data/lib/byebug/setting.rb +82 -0
  33. data/lib/byebug/settings/autoeval.rb +20 -0
  34. data/lib/byebug/settings/autoirb.rb +19 -0
  35. data/lib/byebug/settings/autolist.rb +19 -0
  36. data/lib/byebug/settings/autoreload.rb +11 -0
  37. data/lib/byebug/settings/autosave.rb +11 -0
  38. data/lib/byebug/settings/basename.rb +7 -0
  39. data/lib/byebug/settings/callstyle.rb +15 -0
  40. data/lib/byebug/settings/forcestep.rb +11 -0
  41. data/lib/byebug/settings/fullpath.rb +11 -0
  42. data/lib/byebug/settings/histfile.rb +16 -0
  43. data/lib/byebug/settings/histsize.rb +18 -0
  44. data/lib/byebug/settings/linetrace.rb +15 -0
  45. data/lib/byebug/settings/listsize.rb +15 -0
  46. data/lib/byebug/settings/post_mortem.rb +15 -0
  47. data/lib/byebug/settings/stack_on_error.rb +7 -0
  48. data/lib/byebug/settings/testing.rb +7 -0
  49. data/lib/byebug/settings/tracing_plus.rb +7 -0
  50. data/lib/byebug/settings/verbose.rb +7 -0
  51. data/lib/byebug/settings/width.rb +29 -0
  52. data/lib/byebug/version.rb +1 -1
  53. data/test/breakpoints_test.rb +345 -324
  54. data/test/conditions_test.rb +61 -48
  55. data/test/continue_test.rb +38 -27
  56. data/test/debugger_alias_test.rb +5 -3
  57. data/test/display_test.rb +103 -92
  58. data/test/edit_test.rb +42 -34
  59. data/test/eval_test.rb +91 -75
  60. data/test/finish_test.rb +51 -40
  61. data/test/frame_test.rb +197 -184
  62. data/test/help_test.rb +47 -38
  63. data/test/history_test.rb +54 -0
  64. data/test/info_test.rb +306 -293
  65. data/test/interrupt_test.rb +44 -38
  66. data/test/kill_test.rb +40 -31
  67. data/test/list_test.rb +166 -133
  68. data/test/method_test.rb +67 -60
  69. data/test/post_mortem_test.rb +56 -48
  70. data/test/quit_test.rb +44 -35
  71. data/test/reload_test.rb +36 -24
  72. data/test/repl_test.rb +57 -47
  73. data/test/restart_test.rb +56 -69
  74. data/test/save_test.rb +62 -53
  75. data/test/set_test.rb +140 -118
  76. data/test/show_test.rb +68 -201
  77. data/test/source_test.rb +39 -29
  78. data/test/stepping_test.rb +163 -136
  79. data/test/support/test_dsl.rb +9 -11
  80. data/test/test_helper.rb +2 -7
  81. data/test/thread_test.rb +121 -107
  82. data/test/trace_test.rb +86 -83
  83. data/test/variables_test.rb +104 -98
  84. metadata +27 -86
  85. data/test/examples/breakpoint.rb +0 -6
  86. data/test/examples/breakpoint_deep.rb +0 -4
  87. data/test/examples/conditions.rb +0 -4
  88. data/test/examples/continue.rb +0 -5
  89. data/test/examples/display.rb +0 -5
  90. data/test/examples/edit.rb +0 -4
  91. data/test/examples/eval.rb +0 -4
  92. data/test/examples/finish.rb +0 -3
  93. data/test/examples/frame.rb +0 -4
  94. data/test/examples/frame_deep.rb +0 -1
  95. data/test/examples/gcd.rb +0 -15
  96. data/test/examples/hanoi.rb +0 -34
  97. data/test/examples/help.rb +0 -1
  98. data/test/examples/info.rb +0 -6
  99. data/test/examples/info2.rb +0 -3
  100. data/test/examples/interrupt.rb +0 -8
  101. data/test/examples/kill.rb +0 -2
  102. data/test/examples/list.rb +0 -23
  103. data/test/examples/method.rb +0 -4
  104. data/test/examples/post_mortem.rb +0 -4
  105. data/test/examples/primes.rb +0 -25
  106. data/test/examples/quit.rb +0 -2
  107. data/test/examples/reload.rb +0 -6
  108. data/test/examples/repl.rb +0 -6
  109. data/test/examples/restart.rb +0 -6
  110. data/test/examples/save.rb +0 -3
  111. data/test/examples/set.rb +0 -3
  112. data/test/examples/settings.rb +0 -1
  113. data/test/examples/show.rb +0 -1
  114. data/test/examples/source.rb +0 -3
  115. data/test/examples/stepping.rb +0 -8
  116. data/test/examples/stepping_raise_from_c_method.rb +0 -3
  117. data/test/examples/stepping_raise_from_ruby_method.rb +0 -3
  118. data/test/examples/test-triangle.rb +0 -14
  119. data/test/examples/thread.rb +0 -5
  120. data/test/examples/tmate.rb +0 -10
  121. data/test/examples/trace.rb +0 -8
  122. data/test/examples/tri3.rb +0 -6
  123. data/test/examples/triangle.rb +0 -13
  124. data/test/examples/variables.rb +0 -4
  125. data/test/timeout_test.rb +0 -9
@@ -1,69 +1,82 @@
1
- class TestConditions < TestDsl::TestCase
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
2
11
 
3
- describe 'setting condition' do
4
- before { enter 'break 3' }
12
+ def first
13
+ Byebug.breakpoints.first
14
+ end
5
15
 
6
- describe 'successfully' do
7
- before { enter ->{ "cond #{Byebug.breakpoints.first.id} b == 5" }, 'cont'}
16
+ describe 'setting condition' do
17
+ before { enter 'break 7' }
8
18
 
9
- it 'must assign the expression to breakpoint' do
10
- debug_file('conditions') {
11
- Byebug.breakpoints.first.expr.must_equal 'b == 5' }
12
- end
19
+ describe 'successfully' do
20
+ before { enter ->{ "cond #{first.id} b == 5" }, 'cont' }
13
21
 
14
- it 'must stop at the breakpoint if condition is true' do
15
- debug_file('conditions') { state.line.must_equal 3 }
16
- end
22
+ it 'must assign the expression to breakpoint' do
23
+ debug_proc(@example) { first.expr.must_equal 'b == 5' }
24
+ end
17
25
 
18
- it 'must work with full command name too' do
19
- debug_file('conditions') { state.line.must_equal 3 }
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
20
33
  end
21
- end
22
34
 
23
- describe 'unsuccessfully' do
24
- before { enter 'break 4' }
35
+ describe 'unsuccessfully' do
36
+ before { enter 'break 8' }
25
37
 
26
- it 'must not stop at the breakpoint if condition is false' do
27
- enter ->{ "cond #{Byebug.breakpoints.first.id} b == 3" }, 'cont'
28
- debug_file('conditions') { state.line.must_equal 4 }
29
- end
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
30
42
 
31
- it 'must assign expression to breakpoint in spite of incorrect syntax' do
32
- enter ->{ "cond #{Byebug.breakpoints.first.id} b =="}, 'cont'
33
- debug_file('conditions') {
34
- Byebug.breakpoints.first.expr.must_equal 'b ==' }
35
- end
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
36
47
 
37
- it 'must ignore the condition if when incorrect syntax' do
38
- enter ->{ "cond #{Byebug.breakpoints.first.id} b ==" }, 'cont'
39
- debug_file('conditions') { state.line.must_equal 4 }
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
40
52
  end
41
53
  end
42
- end
43
54
 
44
- describe 'removing conditions' do
45
- before { enter 'break 3 if b == 3', 'break 4',
46
- ->{"cond #{Byebug.breakpoints.first.id}"}, 'cont' }
55
+ describe 'removing conditions' do
56
+ before do
57
+ enter 'break 7 if b == 3', 'break 8', -> { "cond #{first.id}" }, 'cont'
58
+ end
47
59
 
48
- it 'must remove the condition from the breakpoint' do
49
- debug_file('conditions') { Byebug.breakpoints.first.expr.must_be_nil }
50
- end
60
+ it 'must remove the condition from the breakpoint' do
61
+ debug_proc(@example) { first.expr.must_be_nil }
62
+ end
51
63
 
52
- it 'must unconditionally stop on the breakpoint' do
53
- debug_file('conditions') { state.line.must_equal 3 }
64
+ it 'must unconditionally stop on the breakpoint' do
65
+ debug_proc(@example) { state.line.must_equal 7 }
66
+ end
54
67
  end
55
- end
56
68
 
57
- describe 'errors' do
58
- it 'must show error if there are no breakpoints' do
59
- enter 'cond 1 true'
60
- debug_file('conditions')
61
- check_output_includes 'No breakpoints have been set.'
62
- end
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
63
75
 
64
- it 'must not set breakpoint condition if breakpoint id is incorrect' do
65
- enter 'break 3', 'cond 8 b == 3', 'cont'
66
- debug_file('conditions') { state.line.must_equal 3 }
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
67
80
  end
68
81
  end
69
82
  end
@@ -1,39 +1,50 @@
1
- class ContinueExample
2
- def self.a(num)
3
- num + 4
1
+ module ContinueTest
2
+ class Example
3
+ def self.a(num)
4
+ num + 4
5
+ end
4
6
  end
5
- end
6
7
 
7
- class TestContinue < TestDsl::TestCase
8
+ class ContinueTestCase < TestDsl::TestCase
9
+ before do
10
+ @example = lambda do
11
+ byebug
8
12
 
9
- describe "successful" do
10
- it "must continue up to breakpoint if no line specified" do
11
- enter 'break 4', 'continue'
12
- debug_file('continue') { state.line.must_equal 4 }
13
+ b = 5
14
+ c = b + 5
15
+ Example.a(c)
16
+ end
13
17
  end
14
18
 
15
- it "must work in abbreviated mode too" do
16
- enter 'break 4', 'cont'
17
- debug_file('continue') { state.line.must_equal 4 }
18
- end
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
19
24
 
20
- it "must continue up to specified line" do
21
- enter 'cont 4'
22
- debug_file('continue') { state.line.must_equal 4 }
23
- end
24
- end
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
25
29
 
26
- describe "unsuccessful" do
27
- it "must ignore the command if specified line is not valid" do
28
- enter 'cont 123'
29
- debug_file('continue') { state.line.must_equal 3 }
30
+ it 'must continue up to specified line' do
31
+ enter 'cont 14'
32
+ debug_proc(@example) { state.line.must_equal 14 }
33
+ end
30
34
  end
31
35
 
32
- it "must show error if specified line is not valid" do
33
- enter 'cont 123'
34
- debug_file 'continue'
35
- check_error_includes \
36
- "Line 123 is not a stopping point in file \"#{fullpath('continue')}\""
36
+ describe 'unsuccessful' do
37
+ before { enter 'cont 100' }
38
+
39
+ it 'must ignore the command if specified line is not valid' do
40
+ debug_proc(@example) { state.line.must_equal 13 }
41
+ end
42
+
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
37
48
  end
38
49
  end
39
50
  end
@@ -1,5 +1,7 @@
1
- class TestDebuggerAlias < MiniTest::Spec
2
- it 'aliases "debugger" to "byebug"' do
3
- Kernel.method(:debugger).must_equal(Kernel.method(:byebug))
1
+ module DebuggerAliasTest
2
+ class DebuggerAliasSpec < MiniTest::Spec
3
+ it 'aliases "debugger" to "byebug"' do
4
+ Kernel.method(:debugger).must_equal(Kernel.method(:byebug))
5
+ end
4
6
  end
5
7
  end
@@ -1,124 +1,135 @@
1
- class TestDisplay < TestDsl::TestCase
2
-
3
- it 'must show expressions' do
4
- enter 'break 3', 'cont', 'display d + 1'
5
- debug_file 'display'
6
- check_output_includes '1: ', 'd + 1 = 5'
7
- end
1
+ module DisplayTest
2
+ class DisplayTestCase < TestDsl::TestCase
3
+ before do
4
+ @example = -> do
5
+ byebug
6
+ d = 4
7
+ d = d + 2
8
+ d = d + 3
9
+ d = d + 6
10
+ end
11
+ end
8
12
 
9
- it 'must work with shortcut' do
10
- enter 'break 3', 'cont', 'disp d + 1'
11
- debug_file 'display'
12
- check_output_includes '1: ', 'd + 1 = 5'
13
- end
13
+ it 'must show expressions' do
14
+ enter 'break 7', 'cont', 'display d + 1'
15
+ debug_proc(@example)
16
+ check_output_includes '1: ', 'd + 1 = 5'
17
+ end
14
18
 
15
- it 'must save displayed expressions' do
16
- enter 'display d + 1'
17
- debug_file('display') { state.display.must_equal [[true, 'd + 1']] }
18
- end
19
+ it 'must work with shortcut' do
20
+ enter 'break 7', 'cont', 'disp d + 1'
21
+ debug_proc(@example)
22
+ check_output_includes '1: ', 'd + 1 = 5'
23
+ end
19
24
 
20
- it 'displays all expressions available' do
21
- enter 'break 3', 'cont', -> do
22
- Byebug.handler.display.concat([[true, 'abc'], [true, 'd']]); 'display'
25
+ it 'must save displayed expressions' do
26
+ enter 'display d + 1'
27
+ debug_proc(@example) { state.display.must_equal [[true, 'd + 1']] }
23
28
  end
24
- debug_file 'display'
25
- check_output_includes '1: ', 'abc = nil', '2: ', 'd = 4'
26
- end
27
29
 
28
- describe 'undisplay' do
29
- describe 'undisplay all' do
30
- before do
31
- enter 'break 3', 'cont', -> do
32
- Byebug.handler.display.concat([[true, 'abc'], [true, 'd']])
33
- 'undisplay'
34
- end, confirm_response, 'display'
30
+ it 'displays all expressions available' do
31
+ enter 'break 7', 'cont', -> do
32
+ Byebug.handler.display.concat([[true, 'abc'], [true, 'd']]); 'display'
35
33
  end
34
+ debug_proc(@example)
35
+ check_output_includes '1: ', 'abc = nil', '2: ', 'd = 4'
36
+ end
36
37
 
37
- describe 'confirmation is successful' do
38
- let(:confirm_response) { 'y' }
39
-
40
- it 'must ask about confirmation' do
41
- debug_file 'display'
42
- check_output_includes \
43
- 'Clear all expressions? (y/n)', interface.confirm_queue
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'
44
45
  end
45
46
 
46
- it 'must set all expressions saved to "false"' do
47
- debug_file('display') { state.display.must_equal [[false, 'abc'],
48
- [false, 'd']] }
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
49
65
  end
50
66
 
51
- it 'must not show any output' do
52
- debug_file 'display'
53
- check_output_doesnt_include '1: ', 'abc = nil', '2: ', 'd = 4'
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
54
79
  end
55
80
  end
56
81
 
57
- describe 'confirmation is unsuccessful' do
58
- let(:confirm_response) { 'n' }
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
59
89
 
60
- it 'must set all expressions saved to "false"' do
61
- debug_file('display') { state.display.must_equal [[true, 'abc'],
90
+ it 'must set inactive positions' do
91
+ debug_proc(@example) { state.display.must_equal [[nil, 'abc'],
62
92
  [true, 'd']] }
63
93
  end
64
94
 
65
- it 'must not show any output' do
66
- debug_file 'display'
67
- check_output_includes '1: ', 'abc = nil', '2: ', 'd = 4'
95
+ it 'must display only the active position' do
96
+ debug_proc(@example)
97
+ check_output_includes '2: ', 'd = 4'
68
98
  end
69
- end
70
- end
71
99
 
72
- describe 'undisplay specific position' do
73
- before do
74
- enter 'break 3', 'cont', -> do
75
- Byebug.handler.display.concat([[true, 'abc'], [true, 'd']])
76
- 'undisplay 1'
77
- end, 'display'
100
+ it 'must not display the disabled position' do
101
+ debug_proc(@example)
102
+ check_output_doesnt_include '1: ', 'abc'
103
+ end
78
104
  end
105
+ end
79
106
 
80
- it 'must set inactive positions' do
81
- debug_file('display') { state.display.must_equal [[nil, 'abc'],
82
- [true, 'd']] }
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']] }
83
111
  end
84
112
 
85
- it 'must display only the active position' do
86
- debug_file 'display'
87
- check_output_includes '2: ', 'd = 4'
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
88
118
  end
89
119
 
90
- it 'must not display the disabled position' do
91
- debug_file 'display'
92
- check_output_doesnt_include '1: ', 'abc'
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'
93
125
  end
94
126
  end
95
- end
96
127
 
97
- describe 'disable' do
98
- it 'must disable a position' do
99
- enter 'display d', 'disable display 1'
100
- debug_file('display') { state.display.must_equal [[false, 'd']] }
101
- end
102
-
103
- it 'must show an error if no displays are set' do
104
- enter 'disable display 1'
105
- debug_file 'display'
106
- check_output_includes \
107
- 'No display expressions have been set.', interface.error_queue
108
- end
109
-
110
- it 'must show an error if there is no such display position' do
111
- enter 'display d', 'disable display 4'
112
- debug_file 'display'
113
- check_output_includes \
114
- '"disable display" argument "4" needs to be at most 1.'
115
- end
116
- end
117
-
118
- describe 'enable' do
119
- it 'must enable a position' do
120
- enter 'display d', 'disable display 1', 'enable display 1'
121
- debug_file('display') { state.display.must_equal [[true, 'd']] }
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']] }
132
+ end
122
133
  end
123
134
  end
124
135
  end
@@ -1,47 +1,55 @@
1
- class TestEdit < TestDsl::TestCase
1
+ module EditTest
2
+ class EditTestCase < TestDsl::TestCase
3
+ before do
4
+ @example = -> do
5
+ byebug
6
+ Object.new
7
+ end
8
+ end
2
9
 
3
- describe 'open configured editor' do
4
- temporary_change_hash ENV, 'EDITOR', 'editr'
10
+ describe 'open configured editor' do
11
+ temporary_change_hash ENV, 'EDITOR', 'editr'
5
12
 
6
- it 'must open current file in current line in configured editor' do
7
- Byebug::EditCommand.any_instance.expects(:system)
8
- .with("editr +2 #{fullpath('edit')}")
9
- enter 'edit'
10
- debug_file 'edit'
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
11
19
  end
12
- end
13
20
 
14
- describe 'open default editor' do
15
- temporary_change_hash ENV, 'EDITOR', nil
21
+ describe 'open default editor' do
22
+ temporary_change_hash ENV, 'EDITOR', nil
16
23
 
17
- it 'must call "vim" with current line and file if EDITOR env not set' do
18
- Byebug::EditCommand.any_instance.expects(:system)
19
- .with("vim +2 #{fullpath('edit')}")
20
- enter 'edit'
21
- debug_file 'edit'
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
22
30
  end
23
- end
24
31
 
25
- describe 'open configured editor specifying line and file' do
26
- temporary_change_hash ENV, 'EDITOR', 'editr'
32
+ describe 'open configured editor specifying line and file' do
33
+ temporary_change_hash ENV, 'EDITOR', 'editr'
27
34
 
28
- it 'must open specified line in specified file with configured editor' do
29
- Byebug::EditCommand.any_instance.expects(:system)
30
- .with("editr +3 #{fullpath('breakpoint')}")
31
- enter "edit #{fullpath('breakpoint')}:3"
32
- debug_file 'edit'
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
33
41
  end
34
- end
35
42
 
36
- it 'must show an error if there is no such line' do
37
- enter "edit #{fullpath('edit3')}:6"
38
- debug_file 'edit'
39
- check_error_includes "File \"#{fullpath('edit3')}\" is not readable."
40
- end
43
+ it 'must show an error if there is no such file' do
44
+ enter "edit no_such_file:6"
45
+ debug_proc(@example)
46
+ check_error_includes 'File "no_such_file" is not readable.'
47
+ end
41
48
 
42
- it 'must show an error if there is incorrect syntax' do
43
- enter 'edit blabla'
44
- debug_file 'edit'
45
- check_error_includes 'Invalid file[:line] number specification: blabla'
49
+ it 'must show an error if there is incorrect syntax' do
50
+ enter 'edit blabla'
51
+ debug_proc(@example)
52
+ check_error_includes 'Invalid file[:line] number specification: blabla'
53
+ end
46
54
  end
47
55
  end