debugger 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/AUTHORS +10 -0
  2. data/CHANGES +334 -0
  3. data/ChangeLog +5655 -0
  4. data/INSTALL.SVN +154 -0
  5. data/LICENSE +23 -0
  6. data/Makefile.am +14 -0
  7. data/OLD_README +122 -0
  8. data/README.md +10 -0
  9. data/Rakefile +266 -0
  10. data/autogen.sh +4 -0
  11. data/bin/rdebug +398 -0
  12. data/cli/ruby-debug.rb +173 -0
  13. data/cli/ruby-debug/command.rb +228 -0
  14. data/cli/ruby-debug/commands/breakpoints.rb +153 -0
  15. data/cli/ruby-debug/commands/catchpoint.rb +55 -0
  16. data/cli/ruby-debug/commands/condition.rb +49 -0
  17. data/cli/ruby-debug/commands/continue.rb +38 -0
  18. data/cli/ruby-debug/commands/control.rb +107 -0
  19. data/cli/ruby-debug/commands/display.rb +120 -0
  20. data/cli/ruby-debug/commands/edit.rb +48 -0
  21. data/cli/ruby-debug/commands/enable.rb +202 -0
  22. data/cli/ruby-debug/commands/eval.rb +176 -0
  23. data/cli/ruby-debug/commands/finish.rb +42 -0
  24. data/cli/ruby-debug/commands/frame.rb +301 -0
  25. data/cli/ruby-debug/commands/help.rb +56 -0
  26. data/cli/ruby-debug/commands/info.rb +467 -0
  27. data/cli/ruby-debug/commands/irb.rb +123 -0
  28. data/cli/ruby-debug/commands/jump.rb +66 -0
  29. data/cli/ruby-debug/commands/kill.rb +51 -0
  30. data/cli/ruby-debug/commands/list.rb +94 -0
  31. data/cli/ruby-debug/commands/method.rb +84 -0
  32. data/cli/ruby-debug/commands/quit.rb +39 -0
  33. data/cli/ruby-debug/commands/reload.rb +40 -0
  34. data/cli/ruby-debug/commands/save.rb +90 -0
  35. data/cli/ruby-debug/commands/set.rb +221 -0
  36. data/cli/ruby-debug/commands/show.rb +247 -0
  37. data/cli/ruby-debug/commands/skip.rb +35 -0
  38. data/cli/ruby-debug/commands/source.rb +36 -0
  39. data/cli/ruby-debug/commands/stepping.rb +81 -0
  40. data/cli/ruby-debug/commands/threads.rb +189 -0
  41. data/cli/ruby-debug/commands/tmate.rb +36 -0
  42. data/cli/ruby-debug/commands/trace.rb +57 -0
  43. data/cli/ruby-debug/commands/variables.rb +199 -0
  44. data/cli/ruby-debug/debugger.rb +5 -0
  45. data/cli/ruby-debug/helper.rb +69 -0
  46. data/cli/ruby-debug/interface.rb +232 -0
  47. data/cli/ruby-debug/processor.rb +474 -0
  48. data/configure.ac +12 -0
  49. data/debugger.gemspec +24 -0
  50. data/doc/.cvsignore +42 -0
  51. data/doc/Makefile.am +63 -0
  52. data/doc/emacs-notes.txt +38 -0
  53. data/doc/hanoi.rb +35 -0
  54. data/doc/primes.rb +28 -0
  55. data/doc/rdebug-emacs.texi +1030 -0
  56. data/doc/rdebug.1 +241 -0
  57. data/doc/ruby-debug.texi +3791 -0
  58. data/doc/test-tri2.rb +18 -0
  59. data/doc/tri3.rb +8 -0
  60. data/doc/triangle.rb +12 -0
  61. data/emacs/Makefile.am +130 -0
  62. data/emacs/rdebug-annotate.el +385 -0
  63. data/emacs/rdebug-breaks.el +407 -0
  64. data/emacs/rdebug-cmd.el +92 -0
  65. data/emacs/rdebug-core.el +502 -0
  66. data/emacs/rdebug-dbg.el +62 -0
  67. data/emacs/rdebug-error.el +79 -0
  68. data/emacs/rdebug-fns.el +111 -0
  69. data/emacs/rdebug-frames.el +230 -0
  70. data/emacs/rdebug-gud.el +242 -0
  71. data/emacs/rdebug-help.el +104 -0
  72. data/emacs/rdebug-info.el +83 -0
  73. data/emacs/rdebug-layouts.el +180 -0
  74. data/emacs/rdebug-locring.el +118 -0
  75. data/emacs/rdebug-output.el +106 -0
  76. data/emacs/rdebug-regexp.el +118 -0
  77. data/emacs/rdebug-secondary.el +260 -0
  78. data/emacs/rdebug-shortkey.el +175 -0
  79. data/emacs/rdebug-source.el +568 -0
  80. data/emacs/rdebug-track.el +392 -0
  81. data/emacs/rdebug-varbuf.el +150 -0
  82. data/emacs/rdebug-vars.el +125 -0
  83. data/emacs/rdebug-watch.el +132 -0
  84. data/emacs/rdebug.el +326 -0
  85. data/emacs/test/elk-test.el +242 -0
  86. data/emacs/test/test-annotate.el +103 -0
  87. data/emacs/test/test-cmd.el +116 -0
  88. data/emacs/test/test-core.el +104 -0
  89. data/emacs/test/test-fns.el +65 -0
  90. data/emacs/test/test-frames.el +62 -0
  91. data/emacs/test/test-gud.el +35 -0
  92. data/emacs/test/test-indent.el +58 -0
  93. data/emacs/test/test-regexp.el +144 -0
  94. data/emacs/test/test-shortkey.el +61 -0
  95. data/ext/ruby_debug/breakpoint.c +586 -0
  96. data/ext/ruby_debug/extconf.rb +49 -0
  97. data/ext/ruby_debug/ruby_debug.c +2624 -0
  98. data/ext/ruby_debug/ruby_debug.h +148 -0
  99. data/lib/ChangeLog +1065 -0
  100. data/lib/debugger.rb +7 -0
  101. data/lib/debugger/version.rb +3 -0
  102. data/lib/ruby-debug-base.rb +304 -0
  103. data/rdbg.rb +33 -0
  104. data/runner.sh +7 -0
  105. data/svn2cl_usermap +3 -0
  106. data/test/.cvsignore +1 -0
  107. data/test/base/base.rb +74 -0
  108. data/test/base/binding.rb +31 -0
  109. data/test/base/catchpoint.rb +26 -0
  110. data/test/base/load.rb +40 -0
  111. data/test/bp_loop_issue.rb +3 -0
  112. data/test/classes.rb +11 -0
  113. data/test/cli/commands/catchpoint_test.rb +36 -0
  114. data/test/cli/commands/unit/regexp.rb +42 -0
  115. data/test/config.yaml +8 -0
  116. data/test/data/annotate.cmd +29 -0
  117. data/test/data/annotate.right +139 -0
  118. data/test/data/break_bad.cmd +18 -0
  119. data/test/data/break_bad.right +28 -0
  120. data/test/data/break_loop_bug.cmd +5 -0
  121. data/test/data/break_loop_bug.right +15 -0
  122. data/test/data/breakpoints.cmd +38 -0
  123. data/test/data/breakpoints.right +98 -0
  124. data/test/data/catch.cmd +20 -0
  125. data/test/data/catch.right +49 -0
  126. data/test/data/catch2.cmd +19 -0
  127. data/test/data/catch2.right +65 -0
  128. data/test/data/catch3.cmd +11 -0
  129. data/test/data/catch3.right +37 -0
  130. data/test/data/condition.cmd +28 -0
  131. data/test/data/condition.right +65 -0
  132. data/test/data/ctrl.cmd +23 -0
  133. data/test/data/ctrl.right +70 -0
  134. data/test/data/display.cmd +24 -0
  135. data/test/data/display.right +44 -0
  136. data/test/data/dollar-0.right +2 -0
  137. data/test/data/dollar-0a.right +2 -0
  138. data/test/data/dollar-0b.right +2 -0
  139. data/test/data/edit.cmd +12 -0
  140. data/test/data/edit.right +19 -0
  141. data/test/data/emacs_basic.cmd +43 -0
  142. data/test/data/emacs_basic.right +106 -0
  143. data/test/data/enable.cmd +20 -0
  144. data/test/data/enable.right +36 -0
  145. data/test/data/finish.cmd +16 -0
  146. data/test/data/finish.right +31 -0
  147. data/test/data/frame.cmd +26 -0
  148. data/test/data/frame.right +55 -0
  149. data/test/data/help.cmd +20 -0
  150. data/test/data/help.right +21 -0
  151. data/test/data/history.right +7 -0
  152. data/test/data/info-thread.cmd +13 -0
  153. data/test/data/info-thread.right +37 -0
  154. data/test/data/info-var-bug2.cmd +5 -0
  155. data/test/data/info-var-bug2.right +10 -0
  156. data/test/data/info-var.cmd +23 -0
  157. data/test/data/info-var.right +52 -0
  158. data/test/data/info.cmd +21 -0
  159. data/test/data/info.right +65 -0
  160. data/test/data/jump.cmd +16 -0
  161. data/test/data/jump.right +56 -0
  162. data/test/data/jump2.cmd +16 -0
  163. data/test/data/jump2.right +44 -0
  164. data/test/data/linetrace.cmd +6 -0
  165. data/test/data/linetrace.right +23 -0
  166. data/test/data/list.cmd +19 -0
  167. data/test/data/list.right +127 -0
  168. data/test/data/method.cmd +10 -0
  169. data/test/data/method.right +21 -0
  170. data/test/data/methodsig.cmd +10 -0
  171. data/test/data/methodsig.right +20 -0
  172. data/test/data/next.cmd +22 -0
  173. data/test/data/next.right +61 -0
  174. data/test/data/noquit.right +1 -0
  175. data/test/data/output.cmd +6 -0
  176. data/test/data/output.right +31 -0
  177. data/test/data/pm-bug.cmd +7 -0
  178. data/test/data/pm-bug.right +12 -0
  179. data/test/data/post-mortem-next.cmd +8 -0
  180. data/test/data/post-mortem-next.right +14 -0
  181. data/test/data/post-mortem-osx.right +31 -0
  182. data/test/data/post-mortem.cmd +13 -0
  183. data/test/data/post-mortem.right +32 -0
  184. data/test/data/quit.cmd +6 -0
  185. data/test/data/quit.right +0 -0
  186. data/test/data/raise.cmd +11 -0
  187. data/test/data/raise.right +23 -0
  188. data/test/data/save.cmd +34 -0
  189. data/test/data/save.right +59 -0
  190. data/test/data/scope-var.cmd +42 -0
  191. data/test/data/scope-var.right +587 -0
  192. data/test/data/setshow.cmd +56 -0
  193. data/test/data/setshow.right +98 -0
  194. data/test/data/source.cmd +5 -0
  195. data/test/data/source.right +15 -0
  196. data/test/data/stepping.cmd +21 -0
  197. data/test/data/stepping.right +50 -0
  198. data/test/data/test-init-cygwin.right +7 -0
  199. data/test/data/test-init-osx.right +4 -0
  200. data/test/data/test-init.right +5 -0
  201. data/test/data/trace.right +14 -0
  202. data/test/dollar-0.rb +5 -0
  203. data/test/gcd-dbg-nox.rb +31 -0
  204. data/test/gcd-dbg.rb +30 -0
  205. data/test/gcd.rb +18 -0
  206. data/test/helper.rb +144 -0
  207. data/test/info-var-bug.rb +47 -0
  208. data/test/info-var-bug2.rb +2 -0
  209. data/test/jump.rb +14 -0
  210. data/test/jump2.rb +27 -0
  211. data/test/next.rb +18 -0
  212. data/test/null.rb +1 -0
  213. data/test/output.rb +2 -0
  214. data/test/pm-base.rb +22 -0
  215. data/test/pm-bug.rb +3 -0
  216. data/test/pm-catch.rb +12 -0
  217. data/test/pm-catch2.rb +27 -0
  218. data/test/pm-catch3.rb +47 -0
  219. data/test/pm.rb +11 -0
  220. data/test/raise.rb +3 -0
  221. data/test/rdebug-save.1 +7 -0
  222. data/test/runall +12 -0
  223. data/test/scope-var.rb +29 -0
  224. data/test/tdebug.rb +248 -0
  225. data/test/test-annotate.rb +25 -0
  226. data/test/test-break-bad.rb +37 -0
  227. data/test/test-breakpoints.rb +25 -0
  228. data/test/test-catch.rb +25 -0
  229. data/test/test-catch2.rb +25 -0
  230. data/test/test-catch3.rb +25 -0
  231. data/test/test-condition.rb +25 -0
  232. data/test/test-ctrl.rb +55 -0
  233. data/test/test-display.rb +26 -0
  234. data/test/test-dollar-0.rb +40 -0
  235. data/test/test-edit.rb +26 -0
  236. data/test/test-emacs-basic.rb +26 -0
  237. data/test/test-enable.rb +25 -0
  238. data/test/test-finish.rb +34 -0
  239. data/test/test-frame.rb +34 -0
  240. data/test/test-help.rb +60 -0
  241. data/test/test-hist.rb +68 -0
  242. data/test/test-info-thread.rb +32 -0
  243. data/test/test-info-var.rb +47 -0
  244. data/test/test-info.rb +26 -0
  245. data/test/test-init.rb +44 -0
  246. data/test/test-jump.rb +35 -0
  247. data/test/test-list.rb +25 -0
  248. data/test/test-method.rb +34 -0
  249. data/test/test-next.rb +25 -0
  250. data/test/test-output.rb +26 -0
  251. data/test/test-quit.rb +30 -0
  252. data/test/test-raise.rb +25 -0
  253. data/test/test-save.rb +31 -0
  254. data/test/test-scope-var.rb +25 -0
  255. data/test/test-setshow.rb +25 -0
  256. data/test/test-source.rb +25 -0
  257. data/test/test-stepping.rb +26 -0
  258. data/test/test-trace.rb +47 -0
  259. data/test/thread1.rb +26 -0
  260. data/test/trunc-call.rb +31 -0
  261. metadata +364 -0
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # begin require 'rubygems' rescue LoadError end
4
+ # require 'ruby-debug' ; Debugger.start
5
+
6
+ require 'test/unit'
7
+ SRC_DIR = File.dirname(__FILE__) unless
8
+ defined?(SRC_DIR)
9
+ %w(ext lib cli).each do |dir|
10
+ $:.unshift File.join(SRC_DIR, '..', dir)
11
+ end
12
+ require 'ruby_debug'
13
+
14
+ require File.join(SRC_DIR, '..', 'cli', 'ruby-debug')
15
+ $:.shift; $:.shift; $:.shift
16
+
17
+ def cheap_diff(got_lines, correct_lines)
18
+ puts got_lines if $DEBUG
19
+ correct_lines.each_with_index do |line, i|
20
+ correct_lines[i].chomp!
21
+ if got_lines[i] != correct_lines[i]
22
+ puts "difference found at line #{i+1}"
23
+ puts "got : #{got_lines[i]}"
24
+ puts "need: #{correct_lines[i]}"
25
+ return false
26
+ end
27
+ if correct_lines.size != got_lines.size
28
+ puts("difference in number of lines: " +
29
+ "#{correct_lines.size} vs. #{got_lines.size}")
30
+ return false
31
+ end
32
+ return true
33
+ end
34
+ end
35
+
36
+ # Test Help commands
37
+ class TestHelp < Test::Unit::TestCase
38
+ require 'stringio'
39
+
40
+ # Test initial variables and setting/getting state.
41
+ def test_basic
42
+ testbase = 'help'
43
+ op = StringIO.new('', 'w')
44
+ Dir.chdir(SRC_DIR) do
45
+ script = File.join('data', "#{testbase}.cmd")
46
+ Debugger.const_set('Version', 'unit testing')
47
+ Debugger.run_script(script, op)
48
+ got_lines = op.string.split("\n")
49
+ right_file = File.join('data', "#{testbase}.right")
50
+ correct_lines = File.readlines(right_file)
51
+ result = cheap_diff(got_lines, correct_lines)
52
+ unless result
53
+ puts '-' * 80
54
+ puts got_lines
55
+ puts '-' * 80
56
+ end
57
+ assert result
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test history commands
8
+
9
+ class TestHistory < Test::Unit::TestCase
10
+
11
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
12
+ defined?(@@SRC_DIR)
13
+
14
+ require File.join(@@SRC_DIR, 'helper')
15
+ include TestHelper
16
+
17
+ unless defined?(@@FILE_HISTORY)
18
+ @@FILE_HISTORY = '.rdebug_hist'
19
+ end
20
+
21
+ def test_basic
22
+
23
+ # Set up history file to read from.
24
+ ENV['HOME']=@@SRC_DIR
25
+ ENV['RDEBUG'] = nil
26
+
27
+ debugger_commands = ['show commands',
28
+ 'set history save on',
29
+ 'show history',
30
+ 'quit unconditionally']
31
+ debugger_output = 'test-history.out'
32
+
33
+ Dir.chdir(@@SRC_DIR) do
34
+ correct_lines = File.read(File.join('data', 'history.right')).split(/\n/)
35
+ f = File.open(@@FILE_HISTORY, 'w')
36
+ correct_lines[0.. -(debugger_commands.length+1)].each do |line|
37
+ f.puts line
38
+ end
39
+ f.close
40
+
41
+ # Now that we've set up a history file, run the debugger
42
+ # and check that it's reading that correctly.
43
+ debug_pgm=File.join('..', 'rdbg.rb')
44
+ debugged=File.join('gcd.rb')
45
+ IO.popen("#{debug_pgm} #{debugged} 3 5 >#{debugger_output}", 'w') do
46
+ |pipe|
47
+ debugger_commands.each do |cmd|
48
+ pipe.puts cmd
49
+ end
50
+ end
51
+
52
+ # Compare output
53
+ got_lines = File.read(@@FILE_HISTORY).split(/\n/)
54
+ # FIXME: Disable for now.
55
+ assert true, 'FIXME'
56
+ return
57
+ if cheap_diff(got_lines, correct_lines)
58
+ assert true
59
+ FileUtils.rm(debugger_output)
60
+ FileUtils.rm(@@FILE_HISTORY)
61
+ else
62
+ assert nil, 'Output differs'
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test simple thread commands
8
+ class TestInfoThread < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ def test_basic
17
+ testname='info-thread'
18
+ Dir.chdir(@@SRC_DIR) do
19
+ filter = Proc.new{|got_lines, correct_lines|
20
+ [got_lines, correct_lines].each do |a|
21
+ a.each do |s|
22
+ s.sub!(/Thread:0x[0-9a-f]+/, 'Thread:0x12345678')
23
+ end
24
+ end
25
+ }
26
+ script = File.join('data', testname + '.cmd')
27
+ assert_equal(true,
28
+ run_debugger(testname,
29
+ "--script #{script} -- ./gcd.rb 3 5", nil, filter))
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test info variables command
8
+ class TestInfoVar < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ def test_info_variables
17
+
18
+ Dir.chdir(@@SRC_DIR) do
19
+
20
+ filter = Proc.new{|got_lines, correct_lines|
21
+ [got_lines[13-1], correct_lines[13-1]].each do |s|
22
+ s.sub!(/Mine:0x[0-9,a-f]+/, 'Mine:')
23
+ end
24
+ [got_lines, correct_lines].each do |a|
25
+ a.each do |s|
26
+ s.sub!(/Lousy_inspect:0x[0-9,a-f]+/, 'Lousy_inspect:')
27
+ s.sub!(/UnsuspectingClass:0x[0-9,a-f]+/, 'UnsuspectingClass:')
28
+ end
29
+ end
30
+ }
31
+
32
+ testname='info-var'
33
+ script = File.join('data', testname + '.cmd')
34
+ assert_equal(true,
35
+ run_debugger(testname,
36
+ "--script #{script} -- ./info-var-bug.rb",
37
+ nil, filter))
38
+ testname='info-var-bug2'
39
+ script = File.join('data', testname + '.cmd')
40
+ assert_equal(true,
41
+ run_debugger(testname,
42
+ "--script #{script} -- ./info-var-bug2.rb",
43
+ nil))
44
+
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test info commands
8
+ class TestInfo < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ # Test commands in info.rb
17
+ def test_basic
18
+ testname='info'
19
+ Dir.chdir(@@SRC_DIR) do
20
+ script = File.join('data', testname + '.cmd')
21
+ assert_equal(true,
22
+ run_debugger(testname,
23
+ "--script #{script} -- ./gcd.rb 3 5"))
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+ require 'rbconfig'
4
+
5
+ # begin require 'rubygems' rescue LoadError end
6
+ # require 'ruby-debug'; Debugger.start
7
+
8
+ # Test Debugger.init and setting up ruby-debug variables
9
+ class TestDebuggerInit < Test::Unit::TestCase
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+ require File.join(@@SRC_DIR, 'helper')
13
+
14
+ def test_basic
15
+ debugger_output = 'test-init.out'
16
+ Dir.chdir(@@SRC_DIR) do
17
+ old_emacs = ENV['EMACS']
18
+ old_columns = ENV['COLUMNS']
19
+ ENV['EMACS'] = nil
20
+ ENV['COLUMNS'] = '120'
21
+ ruby = "#{TestHelper.load_ruby} #{TestHelper.load_params}"
22
+ IO.popen("#{ruby} ./gcd-dbg.rb 5 >#{debugger_output}", 'w') do |pipe|
23
+ pipe.puts 'p Debugger::PROG_SCRIPT'
24
+ pipe.puts 'show args'
25
+ pipe.puts 'quit unconditionally'
26
+ end
27
+ lines = File.open(debugger_output).readlines
28
+ ENV['EMACS'] = old_emacs
29
+ ENV['COLUMNS'] = old_columns
30
+
31
+ right_file = case Config::CONFIG['host_os']
32
+ when /^darwin/
33
+ 'test-init-osx.right'
34
+ when /^cygwin/
35
+ 'test-init-cygwin.right'
36
+ else
37
+ 'test-init.right'
38
+ end
39
+ expected = File.open(File.join('data', right_file)).readlines
40
+ assert_equal(expected, lines)
41
+ File.delete(debugger_output) if expected == lines
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test jump command
8
+ class TestJumpCommand < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ def test_basic
17
+ testname='jump'
18
+ Dir.chdir(@@SRC_DIR) do
19
+ script = File.join('data', testname + '.cmd')
20
+ assert_equal(true,
21
+ run_debugger(testname,
22
+ "--script #{script} -- ./#{testname}.rb"))
23
+ end
24
+ end
25
+
26
+ def test_basic_2
27
+ testname='jump2'
28
+ Dir.chdir(@@SRC_DIR) do
29
+ script = File.join('data', testname + '.cmd')
30
+ assert_equal(true,
31
+ run_debugger(testname,
32
+ "--script #{script} -- ./#{testname}.rb"))
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test List commands
8
+ class TestList < Test::Unit::TestCase
9
+
10
+ @@src_dir = File.join(Dir.pwd, File.dirname(__FILE__))
11
+
12
+ require File.join(@@src_dir, 'helper')
13
+ include TestHelper
14
+
15
+ # Test commands in list.rb
16
+ def test_basic
17
+ testname='list'
18
+ Dir.chdir(@@src_dir) do
19
+ script = File.join('data', testname + '.cmd')
20
+ assert_equal(true,
21
+ run_debugger(testname,
22
+ "--script #{script} -- ./gcd.rb 3 5"))
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # require 'rubygems'
5
+ # require 'ruby-debug'; Debugger.start(:post_mortem => true)
6
+
7
+ class TestMethod < Test::Unit::TestCase
8
+
9
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
10
+ defined?(@@SRC_DIR)
11
+
12
+ require File.join(@@SRC_DIR, 'helper')
13
+ include TestHelper
14
+
15
+ def test_basic
16
+ testname='method'
17
+ Dir.chdir(@@SRC_DIR) do
18
+ script = File.join('data', testname + '.cmd')
19
+ assert_equal(true,
20
+ run_debugger(testname,
21
+ "--script #{script} -- ./classes.rb"))
22
+ begin
23
+ require 'methodsig'
24
+ testname='methodsig'
25
+ script = File.join('data', testname + '.cmd')
26
+ assert_equal(true,
27
+ run_debugger(testname,
28
+ "--script #{script} -- ./classes.rb"))
29
+ rescue LoadError
30
+ puts "Skipping method sig test"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test next command
8
+ class TestNextCommand < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ def test_basic
17
+ testname='next'
18
+ Dir.chdir(@@SRC_DIR) do
19
+ script = File.join('data', testname + '.cmd')
20
+ assert_equal(true,
21
+ run_debugger(testname,
22
+ "--script #{script} -- ./#{testname}.rb"))
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test 'starting' annotation.
8
+ class TestStartingAnnotate < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ def test_basic
17
+ testname='output'
18
+ Dir.chdir(@@SRC_DIR) do
19
+ script = File.join('data', testname + '.cmd')
20
+ assert_equal(true,
21
+ run_debugger(testname,
22
+ "-A 3 --script #{script} -- ./output.rb",
23
+ nil, nil, true))
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ # begin require 'rubygems' rescue LoadError end
5
+ # require 'ruby-debug'; Debugger.start
6
+
7
+ # Test Quit command
8
+ class TestQuit < Test::Unit::TestCase
9
+
10
+ @@SRC_DIR = File.join(Dir.pwd, File.dirname(__FILE__)) unless
11
+ defined?(@@SRC_DIR)
12
+
13
+ require File.join(@@SRC_DIR, 'helper')
14
+ include TestHelper
15
+
16
+ def test_basic
17
+ testname='quit'
18
+ Dir.chdir(@@SRC_DIR) do
19
+ script = File.join('data', testname + '.cmd')
20
+ # filter = Proc.new{|got_lines, correct_lines|
21
+ # [got_lines[0], correct_lines[0]].each do |s|
22
+ # s.sub!(/tdebug.rb:\d+/, 'rdebug:999')
23
+ # end
24
+ # }
25
+ assert_equal(true,
26
+ run_debugger(testname,
27
+ "--script #{script} -- ./null.rb"))
28
+ end
29
+ end
30
+ end