byebug 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +13 -11
  4. data/Rakefile +0 -6
  5. data/bin/byebug +83 -136
  6. data/ext/byebug/byebug.c +182 -96
  7. data/ext/byebug/byebug.h +5 -7
  8. data/ext/byebug/context.c +52 -40
  9. data/lib/byebug.rb +81 -81
  10. data/lib/byebug/command.rb +18 -35
  11. data/lib/byebug/commands/control.rb +1 -1
  12. data/lib/byebug/commands/display.rb +0 -2
  13. data/lib/byebug/commands/enable.rb +4 -16
  14. data/lib/byebug/commands/eval.rb +5 -3
  15. data/lib/byebug/commands/frame.rb +68 -69
  16. data/lib/byebug/commands/help.rb +2 -1
  17. data/lib/byebug/commands/info.rb +43 -42
  18. data/lib/byebug/commands/method.rb +4 -3
  19. data/lib/byebug/commands/set.rb +10 -19
  20. data/lib/byebug/commands/show.rb +6 -13
  21. data/lib/byebug/interface.rb +1 -1
  22. data/lib/byebug/processor.rb +14 -17
  23. data/lib/byebug/version.rb +1 -2
  24. data/old_doc/byebug.texi +576 -847
  25. data/test/breakpoints_test.rb +0 -1
  26. data/test/conditions_test.rb +35 -33
  27. data/test/display_test.rb +14 -13
  28. data/test/edit_test.rb +28 -25
  29. data/test/eval_test.rb +0 -2
  30. data/test/finish_test.rb +4 -3
  31. data/test/frame_test.rb +20 -21
  32. data/test/help_test.rb +26 -23
  33. data/test/info_test.rb +105 -108
  34. data/test/irb_test.rb +26 -25
  35. data/test/kill_test.rb +19 -19
  36. data/test/list_test.rb +140 -156
  37. data/test/method_test.rb +21 -22
  38. data/test/post_mortem_test.rb +2 -5
  39. data/test/quit_test.rb +16 -17
  40. data/test/reload_test.rb +2 -2
  41. data/test/restart_test.rb +0 -1
  42. data/test/save_test.rb +31 -32
  43. data/test/set_test.rb +50 -47
  44. data/test/show_test.rb +67 -66
  45. data/test/source_test.rb +31 -34
  46. data/test/stepping_test.rb +32 -34
  47. data/test/support/test_dsl.rb +1 -1
  48. data/test/trace_test.rb +1 -2
  49. data/test/variables_test.rb +36 -34
  50. metadata +2 -4
  51. data/lib/byebug/commands/tmate.rb +0 -36
  52. data/test/tmate_test.rb +0 -44
@@ -4,26 +4,23 @@ describe 'Post Mortem' do
4
4
  include TestDsl
5
5
 
6
6
  it 'must enter into post mortem mode' do
7
- skip('No post morten mode for now')
8
7
  enter 'cont'
9
8
  debug_file('post_mortem') { Byebug.post_mortem?.must_equal true }
10
9
  end
11
10
 
12
11
  it 'must stop at the correct line' do
13
- skip('No post morten mode for now')
14
12
  enter 'cont'
15
13
  debug_file('post_mortem') { state.line.must_equal 8 }
16
14
  end
17
15
 
18
16
  it 'must exit from post mortem mode after stepping command' do
19
- skip('No post morten mode for now')
20
17
  enter 'cont', 'break 12', 'cont'
21
18
  debug_file('post_mortem') { Byebug.post_mortem?.must_equal false }
22
19
  end
23
20
 
24
21
  it 'must save the raised exception' do
25
- skip('No post morten mode for now')
26
22
  enter 'cont'
27
- debug_file('post_mortem') { Byebug.last_exception.must_be_kind_of RuntimeError }
23
+ debug_file('post_mortem') {
24
+ Byebug.last_exception.must_be_kind_of RuntimeError }
28
25
  end
29
26
  end
@@ -1,55 +1,54 @@
1
1
  require_relative 'test_helper'
2
2
 
3
- describe "Quit Command" do
3
+ describe 'Quit Command' do
4
4
  include TestDsl
5
5
 
6
- it "must quit if user confirmed" do
6
+ it 'must quit if user confirmed' do
7
7
  Byebug::QuitCommand.any_instance.expects(:exit!)
8
8
  enter 'quit', 'y'
9
9
  debug_file 'quit'
10
- check_output_includes "Really quit? (y/n)", interface.confirm_queue
10
+ check_output_includes 'Really quit? (y/n)', interface.confirm_queue
11
11
  end
12
12
 
13
- it "must not quit if user didn't confirm" do
13
+ it 'must not quit if user didn\'t confirm' do
14
14
  Byebug::QuitCommand.any_instance.expects(:exit!).never
15
15
  enter 'quit', 'n'
16
16
  debug_file 'quit'
17
- check_output_includes "Really quit? (y/n)", interface.confirm_queue
17
+ check_output_includes 'Really quit? (y/n)', interface.confirm_queue
18
18
  end
19
19
 
20
- it "must quit immediatly if used with !" do
20
+ it 'must quit immediatly if used with !' do
21
21
  Byebug::QuitCommand.any_instance.expects(:exit!)
22
22
  enter 'quit!'
23
23
  debug_file 'quit'
24
- check_output_doesnt_include "Really quit? (y/n)", interface.confirm_queue
24
+ check_output_doesnt_include 'Really quit? (y/n)', interface.confirm_queue
25
25
  end
26
26
 
27
- it "must quit immediatly if used with 'unconditionally'" do
27
+ it 'must quit immediatly if used with "unconditionally"' do
28
28
  Byebug::QuitCommand.any_instance.expects(:exit!)
29
29
  enter 'quit unconditionally'
30
30
  debug_file 'quit'
31
- check_output_doesnt_include "Really quit? (y/n)", interface.confirm_queue
31
+ check_output_doesnt_include 'Really quit? (y/n)', interface.confirm_queue
32
32
  end
33
33
 
34
- it "must finalize interface before quitting" do
34
+ it 'must finalize interface before quitting' do
35
35
  Byebug::QuitCommand.any_instance.stubs(:exit!)
36
36
  interface.expects(:finalize)
37
37
  enter 'quit!'
38
38
  debug_file 'quit'
39
39
  end
40
40
 
41
- it "must quit if used 'exit' alias" do
41
+ it 'must quit if used "exit" alias' do
42
42
  Byebug::QuitCommand.any_instance.expects(:exit!)
43
43
  enter 'exit!'
44
44
  debug_file 'quit'
45
45
  end
46
46
 
47
- describe "Post Mortem" do
48
- it "must work in post-mortem mode" do
49
- skip("No post morten mode for now")
50
- #Byebug::QuitCommand.any_instance.expects(:exit!)
51
- #enter 'cont', 'exit!'
52
- #debug_file 'post_mortem'
47
+ describe 'Post Mortem' do
48
+ it 'must work in post-mortem mode' do
49
+ Byebug::QuitCommand.any_instance.expects(:exit!)
50
+ enter 'cont', 'exit!'
51
+ debug_file 'post_mortem'
53
52
  end
54
53
  end
55
54
 
@@ -34,9 +34,9 @@ describe 'Reload Command' do
34
34
  end
35
35
 
36
36
  describe 'Post Mortem' do
37
- after { change_line_in_file(fullpath('post_mortem'), 7, ' z = 4') }
37
+ after { change_line_in_file(fullpath('post_mortem'), 7, ' z = 4') }
38
+
38
39
  it 'must work in post-mortem mode' do
39
- skip('No post morten mode for now')
40
40
  enter 'cont', -> do
41
41
  change_line_in_file(fullpath('post_mortem'), 7, 'z = 100')
42
42
  'reload'
@@ -143,7 +143,6 @@ describe 'Restart Command' do
143
143
 
144
144
  describe 'Post Mortem' do
145
145
  it 'must work in post-mortem mode' do
146
- skip('No post morten mode for now')
147
146
  must_restart
148
147
  enter 'cont', 'restart'
149
148
  debug_file 'post_mortem'
@@ -1,9 +1,9 @@
1
1
  require_relative 'test_helper'
2
2
 
3
- describe "Save Command" do
3
+ describe 'Save Command' do
4
4
  include TestDsl
5
5
 
6
- describe "successful saving" do
6
+ describe 'successful saving' do
7
7
  let(:file_name) { 'save_output.txt' }
8
8
  let(:file_contents) { File.read(file_name) }
9
9
  before do
@@ -16,77 +16,76 @@ describe "Save Command" do
16
16
  FileUtils.rm(file_name)
17
17
  end
18
18
 
19
- it "must save usual breakpoints" do
19
+ it 'must save usual breakpoints' do
20
20
  file_contents.must_include "break #{fullpath('save')}:2"
21
21
  end
22
22
 
23
- it "must save conditinal breakpoints" do
23
+ it 'must save conditinal breakpoints' do
24
24
  file_contents.must_include "break #{fullpath('save')}:3 if true"
25
25
  end
26
26
 
27
- it "must save catchpoints" do
28
- file_contents.must_include "catch NoMethodError"
27
+ it 'must save catchpoints' do
28
+ file_contents.must_include 'catch NoMethodError'
29
29
  end
30
30
 
31
31
  # Not sure why it is suppressed, but this is like it is now.
32
- it "must not save displays" do
33
- file_contents.wont_include "display 2 + 3"
32
+ it 'must not save displays' do
33
+ file_contents.wont_include 'display 2 + 3'
34
34
  end
35
35
 
36
- describe "saving settings" do
37
- it "must save autoeval" do
38
- file_contents.must_include "set autoeval on"
36
+ describe 'saving settings' do
37
+ it 'must save autoeval' do
38
+ file_contents.must_include 'set autoeval on'
39
39
  end
40
40
 
41
- it "must save basename" do
42
- file_contents.must_include "set basename off"
41
+ it 'must save basename' do
42
+ file_contents.must_include 'set basename off'
43
43
  end
44
44
 
45
- it "must save byebugtesting" do
46
- file_contents.must_include "set byebugtesting on"
45
+ it 'must save byebugtesting' do
46
+ file_contents.must_include 'set byebugtesting on'
47
47
  end
48
48
 
49
- it "must save autolist" do
50
- file_contents.must_include "set autolist on"
49
+ it 'must save autolist' do
50
+ file_contents.must_include 'set autolist on'
51
51
  end
52
52
 
53
- it "must save autoirb" do
54
- file_contents.must_include "set autoirb off"
53
+ it 'must save autoirb' do
54
+ file_contents.must_include 'set autoirb off'
55
55
  end
56
56
  end
57
57
 
58
- it "must show a message about successful saving" do
58
+ it 'must show a message about successful saving' do
59
59
  check_output_includes "Saved to '#{file_name}'"
60
60
  end
61
61
 
62
62
  end
63
63
 
64
- describe "without filename" do
64
+ describe 'without filename' do
65
65
  let(:file_contents) { File.read(interface.restart_file) }
66
66
  after { FileUtils.rm(interface.restart_file) }
67
67
 
68
- it "must fabricate a filename if not provided" do
69
- enter "save"
68
+ it 'must fabricate a filename if not provided' do
69
+ enter 'save'
70
70
  debug_file 'save'
71
- file_contents.must_include "set autoirb"
71
+ file_contents.must_include 'set autoirb'
72
72
  end
73
73
 
74
- it "must show a message where the file is saved" do
75
- enter "save"
74
+ it 'must show a message where the file is saved' do
75
+ enter 'save'
76
76
  debug_file 'save'
77
77
  check_output_includes "Saved to '#{interface.restart_file}'"
78
78
  end
79
79
  end
80
80
 
81
- describe "Post Mortem" do
81
+ describe 'Post Mortem' do
82
82
  let(:file_name) { 'save_output.txt' }
83
- #let(:file_contents) { File.read(file_name) }
84
- #after { FileUtils.rm(file_name) }
85
- it "must work in post-mortem mode" do
86
- skip("No post morten mode for now")
83
+ let(:file_contents) { File.read(file_name) }
84
+ after { FileUtils.rm(file_name) }
85
+ it 'must work in post-mortem mode' do
87
86
  enter 'cont', "save #{file_name}"
88
87
  debug_file 'post_mortem'
89
- file_contents.must_include "set autoirb off"
88
+ file_contents.must_include 'set autoirb off'
90
89
  end
91
90
  end
92
91
 
@@ -1,174 +1,177 @@
1
1
  require_relative 'test_helper'
2
2
 
3
- describe "Set Command" do
3
+ describe 'Set Command' do
4
4
  include TestDsl
5
5
 
6
- describe "setting to on" do
6
+ describe 'setting to on' do
7
7
  Byebug::Command.settings[:autolist] = 0
8
8
 
9
- it "must set a setting to on" do
9
+ it 'must set a setting to on' do
10
10
  enter 'set autolist on'
11
11
  debug_file 'set'
12
12
  Byebug::Command.settings[:autolist].must_equal 1
13
13
  end
14
14
 
15
- it "must set a setting to on by 1" do
15
+ it 'must set a setting to on by 1' do
16
16
  enter 'set autolist 1'
17
17
  debug_file 'set'
18
18
  Byebug::Command.settings[:autolist].must_equal 1
19
19
  end
20
20
 
21
- it "must set a setting to on by default" do
21
+ it 'must set a setting to on by default' do
22
22
  enter 'set autolist'
23
23
  debug_file 'set'
24
24
  Byebug::Command.settings[:autolist].must_equal 1
25
25
  end
26
26
 
27
- it "must set a setting using shortcut" do
27
+ it 'must set a setting using shortcut' do
28
28
  enter 'set autol'
29
29
  debug_file 'set'
30
30
  Byebug::Command.settings[:autolist].must_equal 1
31
31
  end
32
32
  end
33
33
 
34
- describe "setting to off" do
34
+ describe 'setting to off' do
35
35
  Byebug::Command.settings[:autolist] = 1
36
36
 
37
- it "must set a setting to off" do
37
+ it 'must set a setting to off' do
38
38
  enter 'set autolist off'
39
39
  debug_file 'set'
40
40
  Byebug::Command.settings[:autolist].must_equal 0
41
41
  end
42
42
 
43
- it "must set a setting to off by 0" do
43
+ it 'must set a setting to off by 0' do
44
44
  enter 'set autolist 0'
45
45
  debug_file 'set'
46
46
  Byebug::Command.settings[:autolist].must_equal 0
47
47
  end
48
48
 
49
- it "must set a setting to off by 'no' suffix" do
49
+ it 'must set a setting to off by "no" prefix' do
50
50
  enter 'set noautolist'
51
51
  debug_file 'set'
52
52
  Byebug::Command.settings[:autolist].must_equal 0
53
53
  end
54
54
  end
55
55
 
56
- describe "messages" do
56
+ describe 'messages' do
57
57
  Byebug::Command.settings[:autolist] = 0
58
58
 
59
- it "must show a message after setting" do
59
+ it 'must show a message after setting' do
60
60
  enter 'set autolist on'
61
61
  debug_file 'set'
62
- check_output_includes "autolist is on."
62
+ check_output_includes 'autolist is on.'
63
63
  end
64
64
  end
65
65
 
66
- describe "byebugtesting" do
67
- it "must set $byebug_state if byebugsetting is on" do
66
+ describe 'byebugtesting' do
67
+ it 'must set $byebug_state if byebugsetting is on' do
68
68
  enter 'set byebugtesting', 'break 3', 'cont'
69
69
  debug_file('set') {
70
70
  state.must_be_kind_of Byebug::CommandProcessor::State }
71
71
  end
72
72
 
73
- it "must set basename on too" do
73
+ it 'must set basename on too' do
74
74
  temporary_change_hash_value(Byebug::Command.settings, :basename, false) do
75
75
  enter 'set byebugtesting', 'show basename'
76
76
  debug_file('set')
77
- check_output_includes "basename is on."
77
+ check_output_includes 'basename is on.'
78
78
  end
79
79
  end
80
80
 
81
- it "must not set $byebug_state if byebugsetting is off" do
81
+ it 'must not set $byebug_state if byebugsetting is off' do
82
82
  enter 'set nobyebugtesting', 'break 3', 'cont'
83
83
  debug_file('set') { $byebug_state.must_be_nil }
84
84
  end
85
85
  end
86
86
 
87
- describe "history" do
88
- describe "save" do
89
- it "must set history save to on" do
87
+ describe 'history' do
88
+ describe 'save' do
89
+ it 'must set history save to on' do
90
90
  enter 'set history save on'
91
91
  debug_file 'set'
92
92
  interface.history_save.must_equal true
93
93
  end
94
94
 
95
- it "must show a message" do
95
+ it 'must show a message' do
96
96
  enter 'set history save on'
97
97
  debug_file 'set'
98
- check_output_includes "Saving of history save is on."
98
+ check_output_includes 'Saving of history save is on.'
99
99
  end
100
100
 
101
- it "must set history save to off" do
101
+ it 'must set history save to off' do
102
102
  enter 'set history save off'
103
103
  debug_file 'set'
104
104
  interface.history_save.must_equal false
105
105
  end
106
106
  end
107
107
 
108
- describe "size" do
109
- it "must set history size" do
108
+ describe 'size' do
109
+ it 'must set history size' do
110
110
  enter 'set history size 250'
111
111
  debug_file 'set'
112
112
  interface.history_length.must_equal 250
113
113
  end
114
114
 
115
- it "must show a message" do
115
+ it 'must show a message' do
116
116
  enter 'set history size 250'
117
117
  debug_file 'set'
118
- check_output_includes "Byebug history size is 250"
118
+ check_output_includes 'Byebug history size is 250'
119
119
  end
120
120
  end
121
121
 
122
- describe "filename" do
123
- it "must set history filename" do
122
+ describe 'filename' do
123
+ it 'must set history filename' do
124
124
  enter 'set history filename .byebug-hist'
125
125
  debug_file 'set'
126
- interface.histfile.must_equal File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", '.byebug-hist')
126
+ interface.histfile.must_equal \
127
+ File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist')
127
128
  end
128
129
 
129
- it "must show a message" do
130
+ it 'must show a message' do
130
131
  enter 'set history filename .byebug-hist'
131
132
  debug_file 'set'
132
- check_output_includes "The filename in which to record the command history is \"#{File.join(ENV["HOME"]||ENV["HOMEPATH"]||".", ".byebug-hist")}\""
133
+ check_output_includes \
134
+ 'The filename in which to record the command history is ' \
135
+ "\"#{File.join(ENV['HOME']||ENV['HOMEPATH']||'.', '.byebug-hist')}\""
133
136
  end
134
137
  end
135
138
 
136
- it "must show an error message if used wrong subcommand" do
139
+ it 'must show an error message if used wrong subcommand' do
137
140
  enter 'set history bla 2'
138
141
  debug_file 'set'
139
- check_output_includes "Invalid history parameter bla. Should be 'filename', 'save' or 'size'."
142
+ check_output_includes \
143
+ 'Invalid history parameter bla. Should be "filename", "save" or "size".'
140
144
  end
141
145
 
142
- it "must show an error message if provided only one argument" do
146
+ it 'must show an error message if provided only one argument' do
143
147
  enter 'set history save'
144
148
  debug_file 'set'
145
- check_output_includes "Need two parameters for 'set history'; got 1."
149
+ check_output_includes 'Need two parameters for "set history"; got 1.'
146
150
  end
147
151
  end
148
152
 
149
- describe "width" do
153
+ describe 'width' do
150
154
  Byebug::Command.settings[:width] = 20
151
155
 
152
- it "must set ENV['COLUMNS'] by the 'set width' command" do
153
- old_columns = ENV["COLUMNS"]
156
+ it 'must set ENV[\'COLUMNS\'] by the "set width" command' do
157
+ old_columns = ENV['COLUMNS']
154
158
  begin
155
159
  enter 'set width 10'
156
160
  debug_file 'set'
157
- ENV["COLUMNS"].must_equal '10'
161
+ ENV['COLUMNS'].must_equal '10'
158
162
  ensure
159
- ENV["COLUMNS"] = old_columns
163
+ ENV['COLUMNS'] = old_columns
160
164
  end
161
165
  end
162
166
  end
163
167
 
164
- describe "Post Mortem" do
168
+ describe 'Post Mortem' do
165
169
  Byebug::Command.settings[:autolist] = 0
166
170
 
167
- it "must work in post-mortem mode" do
168
- skip("No post morten mode for now")
169
- enter 'cont', "set autolist on"
171
+ it 'must work in post-mortem mode' do
172
+ enter 'cont', 'set autolist on'
170
173
  debug_file 'post_mortem'
171
- check_output_includes "autolist is on."
174
+ check_output_includes 'autolist is on.'
172
175
  end
173
176
  end
174
177