debugger2 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.travis.yml +3 -0
  4. data/AUTHORS +10 -0
  5. data/CHANGELOG.md +65 -0
  6. data/CONTRIBUTING.md +1 -0
  7. data/Gemfile +3 -0
  8. data/LICENSE +23 -0
  9. data/OLDER_CHANGELOG +334 -0
  10. data/OLD_CHANGELOG +5655 -0
  11. data/OLD_README +122 -0
  12. data/README.md +108 -0
  13. data/Rakefile +78 -0
  14. data/bin/rdebug +397 -0
  15. data/debugger2.gemspec +29 -0
  16. data/doc/.cvsignore +42 -0
  17. data/doc/Makefile.am +63 -0
  18. data/doc/emacs-notes.txt +38 -0
  19. data/doc/hanoi.rb +35 -0
  20. data/doc/primes.rb +28 -0
  21. data/doc/rdebug-emacs.texi +1030 -0
  22. data/doc/ruby-debug.texi +3791 -0
  23. data/doc/test-tri2.rb +18 -0
  24. data/doc/tri3.rb +8 -0
  25. data/doc/triangle.rb +12 -0
  26. data/emacs/Makefile.am +130 -0
  27. data/emacs/rdebug-annotate.el +385 -0
  28. data/emacs/rdebug-breaks.el +407 -0
  29. data/emacs/rdebug-cmd.el +92 -0
  30. data/emacs/rdebug-core.el +502 -0
  31. data/emacs/rdebug-dbg.el +62 -0
  32. data/emacs/rdebug-error.el +79 -0
  33. data/emacs/rdebug-fns.el +111 -0
  34. data/emacs/rdebug-frames.el +230 -0
  35. data/emacs/rdebug-gud.el +242 -0
  36. data/emacs/rdebug-help.el +104 -0
  37. data/emacs/rdebug-info.el +83 -0
  38. data/emacs/rdebug-layouts.el +180 -0
  39. data/emacs/rdebug-locring.el +118 -0
  40. data/emacs/rdebug-output.el +106 -0
  41. data/emacs/rdebug-regexp.el +118 -0
  42. data/emacs/rdebug-secondary.el +260 -0
  43. data/emacs/rdebug-shortkey.el +175 -0
  44. data/emacs/rdebug-source.el +568 -0
  45. data/emacs/rdebug-track.el +392 -0
  46. data/emacs/rdebug-varbuf.el +150 -0
  47. data/emacs/rdebug-vars.el +125 -0
  48. data/emacs/rdebug-watch.el +132 -0
  49. data/emacs/rdebug.el +326 -0
  50. data/emacs/test/elk-test.el +242 -0
  51. data/emacs/test/test-annotate.el +103 -0
  52. data/emacs/test/test-cmd.el +116 -0
  53. data/emacs/test/test-core.el +104 -0
  54. data/emacs/test/test-fns.el +65 -0
  55. data/emacs/test/test-frames.el +62 -0
  56. data/emacs/test/test-gud.el +35 -0
  57. data/emacs/test/test-indent.el +58 -0
  58. data/emacs/test/test-regexp.el +144 -0
  59. data/emacs/test/test-shortkey.el +61 -0
  60. data/ext/ruby_debug/breakpoint.c +630 -0
  61. data/ext/ruby_debug/extconf.rb +11 -0
  62. data/ext/ruby_debug/ruby_debug.c +2203 -0
  63. data/ext/ruby_debug/ruby_debug.h +151 -0
  64. data/lib/debugger.rb +5 -0
  65. data/lib/debugger/version.rb +5 -0
  66. data/lib/debugger2.rb +6 -0
  67. data/lib/ruby-debug-base.rb +307 -0
  68. data/lib/ruby-debug.rb +176 -0
  69. data/lib/ruby-debug/command.rb +227 -0
  70. data/lib/ruby-debug/commands/breakpoints.rb +153 -0
  71. data/lib/ruby-debug/commands/catchpoint.rb +55 -0
  72. data/lib/ruby-debug/commands/condition.rb +49 -0
  73. data/lib/ruby-debug/commands/continue.rb +38 -0
  74. data/lib/ruby-debug/commands/control.rb +107 -0
  75. data/lib/ruby-debug/commands/display.rb +120 -0
  76. data/lib/ruby-debug/commands/edit.rb +48 -0
  77. data/lib/ruby-debug/commands/enable.rb +202 -0
  78. data/lib/ruby-debug/commands/eval.rb +176 -0
  79. data/lib/ruby-debug/commands/finish.rb +42 -0
  80. data/lib/ruby-debug/commands/frame.rb +301 -0
  81. data/lib/ruby-debug/commands/help.rb +56 -0
  82. data/lib/ruby-debug/commands/info.rb +467 -0
  83. data/lib/ruby-debug/commands/irb.rb +123 -0
  84. data/lib/ruby-debug/commands/jump.rb +66 -0
  85. data/lib/ruby-debug/commands/kill.rb +51 -0
  86. data/lib/ruby-debug/commands/list.rb +94 -0
  87. data/lib/ruby-debug/commands/method.rb +84 -0
  88. data/lib/ruby-debug/commands/quit.rb +39 -0
  89. data/lib/ruby-debug/commands/reload.rb +40 -0
  90. data/lib/ruby-debug/commands/save.rb +90 -0
  91. data/lib/ruby-debug/commands/set.rb +223 -0
  92. data/lib/ruby-debug/commands/show.rb +247 -0
  93. data/lib/ruby-debug/commands/skip.rb +35 -0
  94. data/lib/ruby-debug/commands/source.rb +36 -0
  95. data/lib/ruby-debug/commands/stepping.rb +81 -0
  96. data/lib/ruby-debug/commands/threads.rb +189 -0
  97. data/lib/ruby-debug/commands/tmate.rb +36 -0
  98. data/lib/ruby-debug/commands/trace.rb +57 -0
  99. data/lib/ruby-debug/commands/variables.rb +199 -0
  100. data/lib/ruby-debug/debugger.rb +5 -0
  101. data/lib/ruby-debug/helper.rb +69 -0
  102. data/lib/ruby-debug/interface.rb +232 -0
  103. data/lib/ruby-debug/processor.rb +474 -0
  104. data/man/rdebug.1 +241 -0
  105. data/old_scripts/Makefile.am +14 -0
  106. data/old_scripts/README.md +2 -0
  107. data/old_scripts/autogen.sh +4 -0
  108. data/old_scripts/configure.ac +12 -0
  109. data/old_scripts/rdbg.rb +33 -0
  110. data/old_scripts/runner.sh +7 -0
  111. data/old_scripts/svn2cl_usermap +3 -0
  112. data/test/.cvsignore +1 -0
  113. data/test/breakpoints_test.rb +366 -0
  114. data/test/conditions_test.rb +77 -0
  115. data/test/continue_test.rb +28 -0
  116. data/test/display_test.rb +143 -0
  117. data/test/edit_test.rb +55 -0
  118. data/test/eval_test.rb +94 -0
  119. data/test/examples/breakpoint1.rb +15 -0
  120. data/test/examples/breakpoint2.rb +7 -0
  121. data/test/examples/conditions.rb +4 -0
  122. data/test/examples/continue.rb +4 -0
  123. data/test/examples/display.rb +5 -0
  124. data/test/examples/edit.rb +3 -0
  125. data/test/examples/edit2.rb +3 -0
  126. data/test/examples/eval.rb +4 -0
  127. data/test/examples/finish.rb +20 -0
  128. data/test/examples/frame.rb +31 -0
  129. data/test/examples/help.rb +2 -0
  130. data/test/examples/info.rb +48 -0
  131. data/test/examples/info2.rb +3 -0
  132. data/test/examples/irb.rb +6 -0
  133. data/test/examples/jump.rb +14 -0
  134. data/test/examples/kill.rb +2 -0
  135. data/test/examples/list.rb +12 -0
  136. data/test/examples/method.rb +15 -0
  137. data/test/examples/post_mortem.rb +19 -0
  138. data/test/examples/quit.rb +2 -0
  139. data/test/examples/reload.rb +6 -0
  140. data/test/examples/restart.rb +6 -0
  141. data/test/examples/save.rb +3 -0
  142. data/test/examples/set.rb +3 -0
  143. data/test/examples/set_annotate.rb +12 -0
  144. data/test/examples/settings.rb +1 -0
  145. data/test/examples/show.rb +2 -0
  146. data/test/examples/source.rb +3 -0
  147. data/test/examples/stepping.rb +21 -0
  148. data/test/examples/thread.rb +32 -0
  149. data/test/examples/tmate.rb +10 -0
  150. data/test/examples/trace.rb +7 -0
  151. data/test/examples/trace_threads.rb +20 -0
  152. data/test/examples/variables.rb +26 -0
  153. data/test/finish_test.rb +49 -0
  154. data/test/frame_test.rb +140 -0
  155. data/test/help_test.rb +51 -0
  156. data/test/info_test.rb +326 -0
  157. data/test/irb_test.rb +82 -0
  158. data/test/jump_test.rb +70 -0
  159. data/test/kill_test.rb +49 -0
  160. data/test/list_test.rb +147 -0
  161. data/test/method_test.rb +72 -0
  162. data/test/post_mortem_test.rb +25 -0
  163. data/test/quit_test.rb +56 -0
  164. data/test/reload_test.rb +47 -0
  165. data/test/restart_test.rb +145 -0
  166. data/test/save_test.rb +94 -0
  167. data/test/set_test.rb +183 -0
  168. data/test/show_test.rb +294 -0
  169. data/test/source_test.rb +46 -0
  170. data/test/stepping_test.rb +122 -0
  171. data/test/support/breakpoint.rb +12 -0
  172. data/test/support/context.rb +14 -0
  173. data/test/support/matchers.rb +67 -0
  174. data/test/support/mocha_extensions.rb +71 -0
  175. data/test/support/processor.rb +7 -0
  176. data/test/support/test_dsl.rb +206 -0
  177. data/test/support/test_interface.rb +66 -0
  178. data/test/test_helper.rb +9 -0
  179. data/test/thread_test.rb +124 -0
  180. data/test/tmate_test.rb +45 -0
  181. data/test/trace_test.rb +156 -0
  182. data/test/variables_test.rb +116 -0
  183. metadata +319 -0
@@ -0,0 +1,70 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Jump Command" do
4
+ include TestDsl
5
+
6
+ describe "successful" do
7
+ it "must jump with absolute line number" do
8
+ enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}"
9
+ debug_file('jump') { state.line.must_equal 8 }
10
+ end
11
+
12
+ it "must not initialize skipped variables during jump" do
13
+ enter 'break 6', 'cont', "jump 8 #{fullpath('jump')}", 'next'
14
+ enter 'var local'
15
+ debug_file('jump')
16
+ check_output_includes "a => 2", "b => nil", "c => nil", "d => 5"
17
+ end
18
+
19
+ it "must jump with relative line number (-)" do
20
+ enter 'break 8', 'cont', "jump -2 #{fullpath('jump')}"
21
+ debug_file('jump') { state.line.must_equal 6 }
22
+ end
23
+
24
+ it "must jump with relative line number (+)" do
25
+ enter 'break 8', 'cont', "jump +2 #{fullpath('jump')}"
26
+ debug_file('jump') { state.line.must_equal 10 }
27
+ end
28
+ end
29
+
30
+ describe "errors" do
31
+ it "must show an error if line number is invalid" do
32
+ enter 'jump bla'
33
+ debug_file('jump')
34
+ check_output_includes "Bad line number: bla", interface.error_queue
35
+ end
36
+
37
+ it "must show an error if line number is not specified" do
38
+ enter 'jump'
39
+ debug_file('jump')
40
+ check_output_includes '"jump" must be followed by a line number', interface.error_queue
41
+ end
42
+
43
+ describe "when there is no active code in specified line" do
44
+ it "must not jump to there" do
45
+ enter "jump 13 #{fullpath('jump')}"
46
+ debug_file('jump') { state.line.must_equal 3 }
47
+ end
48
+
49
+ it "must show an error" do
50
+ enter "jump 13 #{fullpath('jump')}"
51
+ debug_file('jump')
52
+ check_output_includes "Couldn't find active code at #{fullpath('jump')}:13", interface.error_queue
53
+ end
54
+ end
55
+ end
56
+
57
+
58
+ describe "Post Mortem" do
59
+ # TODO: This test fails with "Segmentation fault". Probably need to fix it somehow, or forbid this
60
+ # command in the post mortem mode. Seems like state.context.frame_file and state.context.frame_line
61
+ # cause that.
62
+ it "must work in post-mortem mode"# do
63
+ # enter 'cont', 'jump 12'
64
+ # debug_file 'post_mortem'
65
+ # pi
66
+ #end
67
+ end
68
+
69
+
70
+ end
@@ -0,0 +1,49 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Kill Command" do
4
+ include TestDsl
5
+
6
+ it "must send signal to some pid" do
7
+ Process.expects(:kill).with("USR1", Process.pid)
8
+ enter 'kill USR1'
9
+ debug_file('kill')
10
+ end
11
+
12
+ it "must finalize interface when sending KILL signal explicitly" do
13
+ Process.stubs(:kill).with("KILL", Process.pid)
14
+ interface.expects(:finalize)
15
+ enter 'kill KILL'
16
+ debug_file('kill')
17
+ end
18
+
19
+ it "must ask confirmation when sending KILL implicitly" do
20
+ Process.expects(:kill).with("KILL", Process.pid)
21
+ enter 'kill', 'y'
22
+ debug_file('kill')
23
+ check_output_includes "Really kill? (y/n)", interface.confirm_queue
24
+ end
25
+
26
+ describe "unknown signal" do
27
+ it "must not send the signal" do
28
+ Process.expects(:kill).with("BLA", Process.pid).never
29
+ enter 'kill BLA'
30
+ debug_file('kill')
31
+ end
32
+
33
+ it "must show an error" do
34
+ enter 'kill BLA'
35
+ debug_file('kill')
36
+ check_output_includes "signal name BLA is not a signal I know about", interface.error_queue
37
+ end
38
+ end
39
+
40
+ describe "Post Mortem" do
41
+ it "must work in post-mortem mode"
42
+
43
+ 0.times do
44
+ Process.expects(:kill).with("USR1", Process.pid)
45
+ enter 'cont', 'kill USR1'
46
+ debug_file "post_mortem"
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,147 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "List Command" do
4
+ include TestDsl
5
+ temporary_change_hash_value(Debugger::Command.settings, :listsize, 3)
6
+ before { LineCache.clear_file_cache }
7
+ after { LineCache.clear_file_cache }
8
+
9
+ describe "listsize" do
10
+ it "must show lines according to :listsize setting" do
11
+ enter 'set listsize 4', 'break 5', 'cont', 'list'
12
+ debug_file 'list'
13
+ check_output_includes "[3, 6] in #{fullpath('list')}"
14
+ end
15
+
16
+ it "must not set it if the param is not an integer" do
17
+ enter 'set listsize 4.0', 'break 5', 'cont', 'list'
18
+ debug_file 'list'
19
+ check_output_includes "[4, 6] in #{fullpath('list')}"
20
+ end
21
+ end
22
+
23
+ describe "without arguments" do
24
+ it "must show surrounding lines with the first call" do
25
+ enter 'break 5', 'cont', 'list'
26
+ debug_file 'list'
27
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
28
+ end
29
+
30
+ it "must list forward after second call" do
31
+ enter 'break 5', 'cont', 'list', 'list'
32
+ debug_file 'list'
33
+ check_output_includes "[7, 9] in #{fullpath('list')}", "7 7", "8 8", "9 9"
34
+ end
35
+ end
36
+
37
+ describe "list backward" do
38
+ it "must show surrounding lines with the first call" do
39
+ enter 'break 5', 'cont', 'list -'
40
+ debug_file 'list'
41
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
42
+ end
43
+
44
+ it "must list backward after second call" do
45
+ enter 'break 5', 'cont', 'list -', 'list -'
46
+ debug_file 'list'
47
+ check_output_includes "[1, 3] in #{fullpath('list')}", "1 debugger", "2 a = 2", "3 b = 3"
48
+ end
49
+ end
50
+
51
+ it "must show the surrounding lines with =" do
52
+ enter 'break 5', 'cont', 'list ='
53
+ debug_file 'list'
54
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 c = 4", "=> 5 d = 5", "6 e = 6"
55
+ end
56
+
57
+ describe "autolist" do
58
+ temporary_change_hash_value(Debugger::Command.settings, :autolist, 0)
59
+
60
+ it "must show the surronding lines even without 'list' command if autolist is enabled" do
61
+ enter 'set autolist', 'break 5', 'cont'
62
+ debug_file 'list'
63
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 c = 4", "=> 5 d = 5", "6 e = 6"
64
+ end
65
+ end
66
+
67
+ describe "specified lines" do
68
+ it "must show with mm-nn" do
69
+ enter 'list 4-6'
70
+ debug_file 'list'
71
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 c = 4", "5 d = 5", "6 e = 6"
72
+ end
73
+
74
+ it "must show with mm,nn" do
75
+ enter 'list 4,6'
76
+ debug_file 'list'
77
+ check_output_includes "[4, 6] in #{fullpath('list')}", "4 c = 4", "5 d = 5", "6 e = 6"
78
+ end
79
+
80
+ it "must show surroundings with mm-" do
81
+ enter 'list 4-'
82
+ debug_file 'list'
83
+ check_output_includes "[3, 5] in #{fullpath('list')}", "3 b = 3", "4 c = 4", "5 d = 5"
84
+ end
85
+
86
+ it "must show surroundings with mm," do
87
+ enter 'list 4,'
88
+ debug_file 'list'
89
+ check_output_includes "[3, 5] in #{fullpath('list')}", "3 b = 3", "4 c = 4", "5 d = 5"
90
+ end
91
+
92
+ it "must show nothing if there is no such lines" do
93
+ enter 'list 44,44'
94
+ debug_file 'list'
95
+ check_output_includes "[44, 44] in #{fullpath('list')}"
96
+ check_output_doesnt_include /^44 \S/
97
+ end
98
+
99
+ it "must show nothing if range is incorrect" do
100
+ enter 'list 5,4'
101
+ debug_file 'list'
102
+ check_output_includes "[5, 4] in #{fullpath('list')}"
103
+ check_output_doesnt_include "5 5"
104
+ check_output_doesnt_include "4 4"
105
+ end
106
+ end
107
+
108
+ describe "reload source" do
109
+ temporary_change_hash_value(Debugger::Command.settings, :reload_source_on_change, false)
110
+
111
+ after { change_line_in_file(fullpath('list'), 4, '4') }
112
+ it "must not reload if setting is false" do
113
+ enter 'set noautoreload', -> do
114
+ change_line_in_file(fullpath('list'), 4, '100')
115
+ 'list 4-4'
116
+ end
117
+ debug_file 'list'
118
+ check_output_includes "4 4"
119
+ end
120
+
121
+ it "must reload if setting is true" do
122
+ enter 'set autoreload', -> do
123
+ change_line_in_file(fullpath('list'), 4, '100')
124
+ 'list 4-4'
125
+ end
126
+ debug_file 'list'
127
+ check_output_includes "4 100"
128
+ end
129
+ end
130
+
131
+ it "must show an error when there is no such file" do
132
+ enter ->{state.file = "blabla"; 'list 4-4'}
133
+ debug_file 'list'
134
+ check_output_includes "No sourcefile available for blabla", interface.error_queue
135
+ end
136
+
137
+
138
+ describe "Post Mortem" do
139
+ it "must work in post-mortem mode"
140
+
141
+ 0.times do
142
+ enter 'cont', 'list'
143
+ debug_file 'post_mortem'
144
+ check_output_includes "[7, 9] in #{fullpath('post_mortem')}"
145
+ end
146
+ end
147
+ end
@@ -0,0 +1,72 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Method Command" do
4
+ include TestDsl
5
+
6
+ # TODO: Need to write tests for 'method signature' command, but I can't install the 'ruby-internal' gem
7
+ # on my machine, it fails to build gem native extension.
8
+
9
+ describe "show instance method of a class" do
10
+ it "must show using full command name" do
11
+ enter 'break 15', 'cont', 'm MethodEx'
12
+ debug_file 'method'
13
+ check_output_includes /bla/
14
+ check_output_doesnt_include /foo/
15
+ end
16
+
17
+ it "must show using shortcut" do
18
+ enter 'break 15', 'cont', 'method MethodEx'
19
+ debug_file 'method'
20
+ check_output_includes /bla/
21
+ end
22
+
23
+ it "must show an error if specified object is not a class or module" do
24
+ enter 'break 15', 'cont', 'm a'
25
+ debug_file 'method'
26
+ check_output_includes "Should be Class/Module: a"
27
+ end
28
+ end
29
+
30
+
31
+ describe "show methods of an object" do
32
+ it "must show using full command name" do
33
+ enter 'break 15', 'cont', 'method instance a'
34
+ debug_file 'method'
35
+ check_output_includes /bla/
36
+ check_output_doesnt_include /foo/
37
+ end
38
+
39
+ it "must show using shortcut" do
40
+ enter 'break 15', 'cont', 'm i a'
41
+ debug_file 'method'
42
+ check_output_includes /bla/
43
+ end
44
+ end
45
+
46
+
47
+ describe "show instance variables of an object" do
48
+ it "must show using full name command" do
49
+ enter 'break 15', 'cont', 'method iv a'
50
+ debug_file 'method'
51
+ check_output_includes '@a = "b"', '@c = "d"'
52
+ end
53
+
54
+ it "must show using shortcut" do
55
+ enter 'break 15', 'cont', 'm iv a'
56
+ debug_file 'method'
57
+ check_output_includes '@a = "b"', '@c = "d"'
58
+ end
59
+ end
60
+
61
+
62
+ describe "Post Mortem" do
63
+ it "must work in post-mortem mode"
64
+
65
+ 0.times do
66
+ enter 'cont', 'm i self'
67
+ debug_file 'post_mortem'
68
+ check_output_includes /to_s/
69
+ end
70
+ end
71
+
72
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Post Mortem" do
4
+ include TestDsl
5
+
6
+ it "must enter into port mortem mode" do
7
+ enter 'cont'
8
+ debug_file("post_mortem") { Debugger.post_mortem?.must_equal true }
9
+ end
10
+
11
+ it "must stop at the correct line" do
12
+ enter 'cont'
13
+ debug_file("post_mortem") { state.line.must_equal 8 }
14
+ end
15
+
16
+ it "must exit from post mortem mode after stepping command" do
17
+ enter 'cont', 'break 12', 'cont'
18
+ debug_file("post_mortem") { Debugger.post_mortem?.must_equal false }
19
+ end
20
+
21
+ it "must save the raised exception" do
22
+ enter 'cont'
23
+ debug_file("post_mortem") { Debugger.last_exception.must_be_kind_of RuntimeError }
24
+ end
25
+ end
@@ -0,0 +1,56 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Quit Command" do
4
+ include TestDsl
5
+
6
+ it "must quit if user confirmed" do
7
+ Debugger::QuitCommand.any_instance.expects(:exit!)
8
+ enter 'quit', 'y'
9
+ debug_file 'quit'
10
+ check_output_includes "Really quit? (y/n)", interface.confirm_queue
11
+ end
12
+
13
+ it "must not quit if user didn't confirm" do
14
+ Debugger::QuitCommand.any_instance.expects(:exit!).never
15
+ enter 'quit', 'n'
16
+ debug_file 'quit'
17
+ check_output_includes "Really quit? (y/n)", interface.confirm_queue
18
+ end
19
+
20
+ it "must quit immediatly if used with !" do
21
+ Debugger::QuitCommand.any_instance.expects(:exit!)
22
+ enter 'quit!'
23
+ debug_file 'quit'
24
+ check_output_doesnt_include "Really quit? (y/n)", interface.confirm_queue
25
+ end
26
+
27
+ it "must quit immediatly if used with 'unconditionally'" do
28
+ Debugger::QuitCommand.any_instance.expects(:exit!)
29
+ enter 'quit unconditionally'
30
+ debug_file 'quit'
31
+ check_output_doesnt_include "Really quit? (y/n)", interface.confirm_queue
32
+ end
33
+
34
+ it "must finalize interface before quitting" do
35
+ Debugger::QuitCommand.any_instance.stubs(:exit!)
36
+ interface.expects(:finalize)
37
+ enter 'quit!'
38
+ debug_file 'quit'
39
+ end
40
+
41
+ it "must quit if used 'exit' alias" do
42
+ Debugger::QuitCommand.any_instance.expects(:exit!)
43
+ enter 'exit!'
44
+ debug_file 'quit'
45
+ end
46
+
47
+ describe "Post Mortem" do
48
+ it "must work in post-mortem mode"
49
+ 0.times do
50
+ Debugger::QuitCommand.any_instance.expects(:exit!)
51
+ enter 'cont', 'exit!'
52
+ debug_file 'post_mortem'
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,47 @@
1
+ require_relative 'test_helper'
2
+
3
+ describe "Reload Command" do
4
+ include TestDsl
5
+ temporary_change_hash_value(Debugger::Command.settings, :reload_source_on_change, false)
6
+
7
+ it "must notify that automatic reloading is off" do
8
+ enter 'reload'
9
+ debug_file 'reload'
10
+ check_output_includes "Source code is reloaded. Automatic reloading is off."
11
+ end
12
+
13
+ it "must notify that automatic reloading is on" do
14
+ enter 'set autoreload', 'reload'
15
+ debug_file 'reload'
16
+ check_output_includes "Source code is reloaded. Automatic reloading is on."
17
+ end
18
+
19
+ describe "reloading" do
20
+ after { change_line_in_file(fullpath('reload'), 4, '4') }
21
+ it "must reload the code" do
22
+ enter 'break 3', 'cont', 'l 4-4', -> do
23
+ change_line_in_file(fullpath('reload'), 4, '100')
24
+ 'reload'
25
+ end, 'l 4-4'
26
+ debug_file 'reload'
27
+ check_output_includes "4 100"
28
+ end
29
+ end
30
+
31
+ describe "Post Mortem" do
32
+ it "must work in post-mortem mode"
33
+
34
+ if false
35
+ after { change_line_in_file(fullpath('post_mortem'), 7, ' z = 4') }
36
+ it "must work in post-mortem mode" do
37
+ enter 'cont', -> do
38
+ change_line_in_file(fullpath('post_mortem'), 7, 'z = 100')
39
+ 'reload'
40
+ end, 'l 7-7'
41
+ debug_file 'post_mortem'
42
+ check_output_includes "7 z = 100"
43
+ end
44
+ end
45
+ end
46
+
47
+ end