rbx-trepanning 0.0.8-universal-rubinius-1.2 → 0.1.0-universal-rubinius-1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. data/ChangeLog +762 -238
  2. data/NEWS +44 -0
  3. data/Rakefile +61 -32
  4. data/app/breakpoint.rb +2 -0
  5. data/app/brkptmgr.rb +9 -11
  6. data/app/client.rb +0 -1
  7. data/app/cmd_parse.kpeg +21 -4
  8. data/app/cmd_parse.rb +10 -10
  9. data/app/cmd_parser.rb +1029 -840
  10. data/app/complete.rb +1 -1
  11. data/app/display.rb +38 -0
  12. data/app/file.rb +24 -0
  13. data/app/frame.rb +11 -4
  14. data/app/irb.rb +41 -39
  15. data/app/iseq.rb +71 -0
  16. data/app/options.rb +55 -30
  17. data/app/rbx-llvm.rb +0 -2
  18. data/app/run.rb +13 -9
  19. data/app/util.rb +55 -5
  20. data/bin/trepanx +3 -3
  21. data/data/irbrc +13 -13
  22. data/{interface/base_intf.rb → interface.rb} +5 -1
  23. data/interface/client.rb +4 -0
  24. data/interface/script.rb +13 -5
  25. data/interface/server.rb +5 -1
  26. data/interface/user.rb +8 -1
  27. data/{io/base_io.rb → io.rb} +0 -0
  28. data/io/input.rb +1 -1
  29. data/io/null_output.rb +28 -24
  30. data/io/string_array.rb +2 -3
  31. data/io/tcpclient.rb +1 -1
  32. data/io/tcpserver.rb +1 -1
  33. data/lib/trepanning.rb +11 -13
  34. data/{processor/main.rb → processor.rb} +50 -54
  35. data/processor/breakpoint.rb +150 -137
  36. data/processor/{command/base/cmd.rb → command.rb} +1 -1
  37. data/processor/command/alias.rb +14 -3
  38. data/processor/command/backtrace.rb +2 -1
  39. data/processor/command/base/subcmd.rb +1 -5
  40. data/processor/command/base/submgr.rb +5 -2
  41. data/processor/command/base/subsubcmd.rb +1 -1
  42. data/processor/command/base/subsubmgr.rb +4 -4
  43. data/processor/command/break.rb +1 -1
  44. data/processor/command/complete.rb +2 -1
  45. data/processor/command/condition.rb +2 -2
  46. data/processor/command/continue.rb +4 -4
  47. data/processor/command/delete.rb +34 -20
  48. data/processor/command/directory.rb +4 -4
  49. data/processor/command/disable.rb +71 -0
  50. data/processor/command/disassemble.rb +55 -22
  51. data/processor/command/display.rb +3 -1
  52. data/processor/command/down.rb +8 -8
  53. data/processor/command/edit.rb +74 -0
  54. data/processor/command/enable.rb +43 -0
  55. data/processor/command/eval.rb +37 -15
  56. data/processor/command/exit.rb +25 -6
  57. data/processor/command/finish.rb +5 -5
  58. data/processor/command/frame.rb +2 -2
  59. data/processor/command/help.rb +7 -9
  60. data/processor/command/help/README +10 -0
  61. data/processor/command/help/command.txt +37 -27
  62. data/processor/command/help/examples.txt +16 -0
  63. data/processor/command/help/filename.txt +1 -1
  64. data/processor/command/help/suffixes.txt +17 -0
  65. data/processor/command/info.rb +3 -1
  66. data/processor/command/info_subcmd/files.rb +3 -2
  67. data/processor/command/info_subcmd/frame.rb +2 -1
  68. data/processor/command/info_subcmd/line.rb +17 -28
  69. data/processor/command/info_subcmd/locals.rb +22 -0
  70. data/processor/command/{show_subcmd → info_subcmd}/macro.rb +4 -4
  71. data/processor/command/info_subcmd/program.rb +2 -0
  72. data/processor/command/info_subcmd/ruby.rb +2 -0
  73. data/processor/command/info_subcmd/source.rb +75 -0
  74. data/processor/command/info_subcmd/stack.rb +25 -0
  75. data/processor/command/info_subcmd/variables.rb +23 -36
  76. data/processor/command/info_subcmd/variables_subcmd/.gitignore +2 -0
  77. data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
  78. data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
  79. data/processor/command/info_subcmd/variables_subcmd/globals.rb +69 -0
  80. data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
  81. data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
  82. data/processor/command/kill.rb +8 -9
  83. data/processor/command/list.rb +101 -167
  84. data/processor/command/macro.rb +28 -10
  85. data/processor/command/next.rb +2 -1
  86. data/processor/command/nexti.rb +1 -1
  87. data/processor/command/parsetree.rb +51 -0
  88. data/processor/command/pr.rb +1 -2
  89. data/processor/command/ps.rb +1 -1
  90. data/processor/command/restart.rb +2 -2
  91. data/processor/command/save.rb +1 -1
  92. data/processor/command/server.rb +1 -1
  93. data/processor/command/set_subcmd/abbrev.rb +25 -0
  94. data/processor/command/set_subcmd/auto.rb +7 -1
  95. data/processor/command/set_subcmd/auto_subcmd/eval.rb +1 -2
  96. data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -3
  97. data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -3
  98. data/processor/command/set_subcmd/different.rb +1 -1
  99. data/processor/command/set_subcmd/highlight.rb +7 -1
  100. data/processor/command/set_subcmd/reload.rb +42 -0
  101. data/processor/command/set_subcmd/timer.rb +58 -0
  102. data/processor/command/set_subcmd/trace.rb +4 -3
  103. data/processor/command/{irb.rb → shell.rb} +22 -19
  104. data/processor/command/show_subcmd/abbrev.rb +20 -0
  105. data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
  106. data/processor/command/show_subcmd/auto_subcmd/eval.rb +2 -6
  107. data/processor/command/show_subcmd/directories.rb +22 -0
  108. data/processor/command/show_subcmd/hidelevel.rb +1 -1
  109. data/processor/command/show_subcmd/highlight.rb +2 -1
  110. data/processor/command/show_subcmd/reload.rb +18 -0
  111. data/processor/command/show_subcmd/timer.rb +18 -0
  112. data/processor/command/source.rb +9 -9
  113. data/processor/command/step.rb +1 -1
  114. data/processor/command/tbreak.rb +3 -2
  115. data/processor/command/unalias.rb +11 -6
  116. data/processor/command/undisplay.rb +13 -9
  117. data/processor/command/up.rb +13 -14
  118. data/processor/default.rb +47 -44
  119. data/processor/disassemble.rb +48 -35
  120. data/processor/display.rb +38 -3
  121. data/processor/eval.rb +54 -53
  122. data/processor/eventbuf.rb +69 -69
  123. data/processor/frame.rb +186 -187
  124. data/processor/help.rb +6 -4
  125. data/processor/hook.rb +103 -102
  126. data/processor/list.rb +123 -0
  127. data/processor/load_cmds.rb +9 -1
  128. data/processor/location.rb +193 -188
  129. data/processor/mock.rb +1 -7
  130. data/processor/msg.rb +56 -42
  131. data/processor/running.rb +26 -15
  132. data/processor/stepping.rb +2 -1
  133. data/processor/subcmd.rb +18 -43
  134. data/processor/validate.rb +41 -30
  135. data/processor/virtual.rb +33 -0
  136. data/rbx-trepanning.gemspec +7 -8
  137. data/sample/rocky-trepanx-colors.rb +0 -1
  138. data/test/data/fname-with-blank.right +2 -0
  139. data/test/data/inline-call.right +11 -10
  140. data/test/data/quit.right +1 -0
  141. data/test/example/debugger-stop.rb +1 -1
  142. data/test/example/goto2goto.rb +11 -0
  143. data/test/functional/fn_helper.rb +2 -2
  144. data/test/functional/test-list.rb +7 -6
  145. data/test/integration/helper.rb +5 -5
  146. data/test/unit/cmd-helper.rb +2 -6
  147. data/test/unit/test-app-cmd_parser.rb +3 -2
  148. data/test/unit/test-app-display.rb +22 -0
  149. data/test/unit/test-app-options.rb +14 -10
  150. data/test/unit/test-app-run.rb +0 -2
  151. data/test/unit/test-app-util.rb +21 -4
  152. data/test/unit/test-base-cmd.rb +5 -7
  153. data/test/unit/test-base-subcmd.rb +1 -5
  154. data/test/unit/test-base-submgr.rb +1 -1
  155. data/test/unit/test-base-subsubcmd.rb +0 -4
  156. data/test/unit/test-bin-trepanx.rb +2 -2
  157. data/test/unit/test-cmd-break.rb +2 -0
  158. data/test/unit/test-cmd-edit.rb +34 -0
  159. data/test/unit/test-cmd-kill.rb +11 -4
  160. data/test/unit/test-cmd-parse_list_cmd.rb +36 -0
  161. data/test/unit/test-command.rb +45 -0
  162. data/test/unit/test-completion.rb +1 -1
  163. data/test/unit/test-proc-eval.rb +1 -2
  164. data/test/unit/test-proc-frame.rb +5 -3
  165. data/test/unit/test-proc-list.rb +55 -0
  166. data/test/unit/test-proc-load_cmds.rb +4 -3
  167. data/test/unit/test-proc-location.rb +32 -29
  168. data/test/unit/test-proc-main.rb +1 -5
  169. data/test/unit/test-proc-validate.rb +14 -4
  170. data/test/unit/test-subcmd-help.rb +1 -5
  171. metadata +73 -107
@@ -0,0 +1,33 @@
1
+ # The class serves as the parent for Trepan::CmdProcessor which is
2
+ # quite large and spans over several files. By declaring "initialize"
3
+ # below, we have a consistent initialization routine and many of the
4
+ # others don't need to define "initialize".
5
+
6
+ # Also, simple versions of the I/O routines make it possible
7
+ # to do testing without having to bring in the whole "Interface"
8
+ # and I/O routines that trepanning (and "main.rb") use.
9
+
10
+ # Note that via this file we can change 'class Trepan' to 'module
11
+ # Trepan' or vice versa. So this takes effect on all of the places
12
+ # which subclass this. They use class Trepan::CmdProcessor <
13
+ # Trepan::VirtualCmdProcessor rather than breaking this down into to
14
+ # parts as below.
15
+ class Trepan
16
+ class VirtualCmdProcessor
17
+ attr_accessor :settings
18
+ def initialize(interfaces, settings={})
19
+ @interfaces = interfaces
20
+ @intf = interfaces[-1]
21
+ @settings = settings
22
+ end
23
+ def errmsg(message)
24
+ puts "Error: #{message}"
25
+ end
26
+ def msg(message)
27
+ puts message
28
+ end
29
+ def section(message, opts={})
30
+ puts "Section: #{message}"
31
+ end
32
+ end
33
+ end
@@ -3,14 +3,13 @@
3
3
  require 'rake'
4
4
  require 'rubygems' unless
5
5
  Object.const_defined?(:Gem)
6
- require File.dirname(__FILE__) + "/app/options" unless
7
- Object.const_defined?(:'Trepan')
8
-
6
+ require File.dirname(__FILE__) + "/app/options"
9
7
  Gem::Specification.new do |s|
10
8
  s.add_dependency('columnize')
11
- s.add_dependency('diff-lcs') # For testing only
12
- s.add_dependency('rbx-require-relative')
13
- s.add_dependency('rbx-linecache', '~>1.2')
9
+ s.add_development_dependency('diff-lcs') # For testing only
10
+ s.add_dependency('rbx-require-relative', '>=0.0.4')
11
+ s.add_dependency('rbx-linecache', '~>1.3')
12
+ s.add_dependency('coderay', '>=1.0')
14
13
  s.authors = ['R. Bernstein']
15
14
  s.date = Time.now
16
15
  s.description = <<-EOF
@@ -33,8 +32,8 @@ EOF
33
32
  s.license = 'MIT'
34
33
  s.platform = Gem::Platform::new ['universal', 'rubinius', '1.2']
35
34
  s.require_paths = ['lib']
36
- s.required_ruby_version = '~> 1.8.7'
37
- s.summary = 'Trepan Ruby Debugger for Rubinius 1.2.1 and higher'
35
+ # s.required_ruby_version = '~> 1.8.7'
36
+ s.summary = 'Trepan Ruby Debugger for Rubinius 1.2.4 and higher'
38
37
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
39
38
  s.version = Trepan::VERSION
40
39
  end
@@ -14,7 +14,6 @@
14
14
 
15
15
  require 'rubygems'
16
16
  require 'coderay'
17
- require 'coderay/encoders/term'
18
17
  TERM_TOKEN_COLORS = {
19
18
  :comment => '3;37', # sienna #8b4726
20
19
  :constant => '1;34', # Bold Midnight Blue #191970
@@ -2,3 +2,5 @@
2
2
  puts "Ha!"
3
3
  basename is off.
4
4
  Ha!
5
+ trepanx: That's all, folks...
6
+ trepanx: That's all, folks...
@@ -1,13 +1,14 @@
1
1
  -- (inline-call.rb:11 @12)
2
2
  if a > b
3
3
  basename is off.
4
- 6 $dbgr = Trepan.new(:nx => true, :cmdfiles => [cmdfile])
5
- 7 # GCD. We assume positive numbers
6
- 8 def gcd(a, b)
7
- 9 $dbgr.debugger
8
- 10 # Make: a <= b
9
- 11 -> if a > b
10
- 12 a, b = [b, a]
11
- 13 end
12
- 14
13
- 15 return nil if a <= 0
4
+ 3 require_relative '../../lib/trepanning.rb'
5
+ 4 DATA_DIR = File.join(File.dirname(RequireRelative::abs_file), %w(.. data))
6
+ 5 cmdfile = File.join(DATA_DIR, 'inline-call.cmd')
7
+ 6 $dbgr = Trepan.new(:nx => true, :cmdfiles => [cmdfile])
8
+ 7 # GCD. We assume positive numbers
9
+ 8 def gcd(a, b)
10
+ 9 $dbgr.debugger
11
+ 10 # Make: a <= b
12
+ 11 -> if a > b
13
+ 12 a, b = [b, a]
14
+ trepanx: That's all, folks...
data/test/data/quit.right CHANGED
@@ -1,2 +1,3 @@
1
1
  -> (null.rb:1 @0)
2
2
  # Nothing here. Move along.
3
+ trepanx: That's all, folks...
@@ -12,5 +12,5 @@ module Foo
12
12
  5
13
13
  end
14
14
  end
15
- debugger
15
+ debugger(:immediate=>true)
16
16
  Foo::five
@@ -0,0 +1,11 @@
1
+ def find_main_script(loc)
2
+ candidate = nil
3
+ if loc
4
+ candidate = 20
5
+ else
6
+ return 10
7
+ end
8
+ candidate
9
+ end
10
+
11
+ find_main_script('foo')
@@ -16,7 +16,7 @@ module FnTestHelper
16
16
  :nx => true}
17
17
  d = Trepan.new(d_opts)
18
18
 
19
- d.settings[:basename] = true
19
+ d.settings[:basename] = d.processor.settings[:basename] = true
20
20
  d.settings[:different] = false
21
21
  d.settings[:autoeval] = false
22
22
  return d
@@ -79,7 +79,7 @@ module FnTestHelper
79
79
  # Set breakpoint 1: test/functional/test-tbreak.rb:10 (@0)
80
80
  # becomes :
81
81
  # Set breakpoint 1: foo.rb:55 (@3)
82
- a3 = a2.map do |s|
82
+ a3 = a2.map do |s|
83
83
  s.gsub(/^Set (temporary )?breakpoint (\d+): .+:(\d+) \(@\d+\)/,
84
84
  'Set \1breakpoint \2: foo.rb:55 (@3)')
85
85
  end
@@ -35,17 +35,18 @@ class TestBreak < Test::Unit::TestCase
35
35
  "-- ",
36
36
  "foo",
37
37
  "max list is 2.",
38
- " 30 \t d.start # line + 8",
39
- " 31 ->\t foo",
38
+ " 31 ->\t foo",
39
+ " 32 \t ##############################",
40
40
  "Set temporary breakpoint 1: foo.rb:55 (@3)",
41
41
  "x1 ",
42
42
  "a = 5 # line + 5",
43
- " 26 \t def foo # line + 4 ",
44
- " 27 ->\t a = 5 # line + 5",
43
+ " 27 ->\t a = 5 # line + 5",
44
+ " 28 \t b = 6 # line + 6",
45
+ "--> #1 TestBreak#test_list_frame_change at test-list.rb:31",
45
46
  " ",
46
47
  "foo",
47
- " 31 ->\t foo",
48
- " 32 \t ##############################"
48
+ " 31 ->\t foo",
49
+ " 32 \t ##############################"
49
50
  ]
50
51
  compare_output(out, d, cmds)
51
52
  end
@@ -1,7 +1,7 @@
1
+ require 'rubygems'; require 'require_relative'
1
2
  require 'diff/lcs'
2
3
  require 'fileutils'
3
- require 'rubygems'; require 'require_relative'
4
- require_relative '../../app/run' # for ruby_path
4
+ require_relative '../../app/run' # for RbConfig.ruby
5
5
 
6
6
  DEFAULT_DEBUGGER_OPTS = {
7
7
  :args => '',
@@ -37,13 +37,13 @@ def run_debugger(testname, ruby_file, opts={})
37
37
  cmd +=
38
38
  if opts[:xdebug]
39
39
  "%s -Xdebug '%s' %s >%s 2>&1 <%s" %
40
- [Trepanning::ruby_path, programfile, opts[:args], outfile, cmdfile]
40
+ [RbConfig.ruby, programfile, opts[:args], outfile, cmdfile]
41
41
  elsif opts[:standalone]
42
42
  "%s %s %s >%s 2>&1" %
43
- [Trepanning::ruby_path, programfile, opts[:args], outfile]
43
+ [RbConfig.ruby, programfile, opts[:args], outfile]
44
44
  else
45
45
  "%s %s --nx --command %s %s '%s' %s >%s 2>&1" %
46
- [Trepanning::ruby_path, dbgr_path, cmdfile, opts[:dbgr],
46
+ [RbConfig.ruby, dbgr_path, cmdfile, opts[:dbgr],
47
47
  programfile, opts[:args], outfile]
48
48
  end
49
49
  puts cmd if opts[:verbose]
@@ -1,20 +1,16 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'; require 'require_relative'
3
- # require_relative '../../app/core'
4
3
  require_relative '../../processor/mock'
5
- require_relative '../../processor/main' # Have to include before frame!
6
- # FIXME
7
4
  require_relative '../../processor/frame'
8
5
 
9
-
10
6
  module UnitHelper
11
7
 
12
8
  module_function
13
9
  def common_setup
14
10
  @dbg ||= MockDebugger::MockDebugger.new(:nx => true)
15
- @cmdproc = Trepan::CmdProcessor.new(@dbg)
11
+ @cmdproc ||= Trepan::CmdProcessor.new(@dbg)
16
12
  @cmdproc.frame_initialize
17
- @cmdproc.dbgr = @dbg
13
+ @cmdproc.dbgr ||= @dbg
18
14
  @cmds = @cmdproc.commands
19
15
 
20
16
  def @cmdproc.errmsg(message, opts={})
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'test/unit'
3
+ require 'rubygems'; require 'require_relative'
3
4
  require_relative '../../app/cmd_parser'
4
5
 
5
6
  class TestAppCmdParser < Test::Unit::TestCase
6
7
  def setup
7
- @cp = CmdParse.new('', true)
8
+ @cp = CmdParse.new('', :debug=>true)
8
9
  end
9
10
 
10
11
  def test_parse_filename
@@ -14,7 +15,7 @@ class TestAppCmdParser < Test::Unit::TestCase
14
15
  ['this\ is\ another\ filename', 'this is another filename'],
15
16
  ['C\:filename', 'C:filename']
16
17
  ].each do |name, expect|
17
- @cp.setup_parser(name, true)
18
+ @cp.setup_parser(name, :debug => true)
18
19
  res = @cp._filename
19
20
  assert_equal(expect, @cp.result)
20
21
  end
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'; require 'require_relative'
3
+ require 'test/unit'
4
+ require_relative '../../app/display'
5
+ require_relative '../../app/frame'
6
+
7
+ class TestLibAppBrkptMgr < Test::Unit::TestCase
8
+
9
+ def test_basic
10
+ mgr = DisplayMgr.new
11
+ # frame = Trepan::Frame.new(self, 0, Rubinius::VM.backtrace(0)[1])
12
+ assert_equal(0, mgr.size)
13
+ # disp = mgr.add(frame, '3 > 1')
14
+ # assert_equal(1, mgr.max)
15
+ # assert_equal(true, disp.enabled?)
16
+
17
+ # mgr.enable_disable(disp.number, false)
18
+ # assert_equal(false, disp.enabled?)
19
+ # mgr.enable_disable(disp.number, true)
20
+ # assert_equal(true, disp.enabled?)
21
+ end
22
+ end
@@ -53,16 +53,20 @@ class TestAppOptions < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  def test_help_and_version_opts
56
- %w(help version).each do |name|
57
- setup
58
- o = ["--#{name}"]
59
- rest = @opts.parse o
60
- assert_not_equal('', @stdout.string)
61
- assert_equal('', @stderr.string)
62
- assert_equal(true, @options[name.to_sym])
63
- other_sym = 'help' == name ? :version : :help
64
- assert_equal(false, @options.member?(other_sym))
65
- end
56
+ omit unless Process.respond_to?(:fork)
57
+ Process.fork {
58
+ %w(help version).each do |name|
59
+ setup
60
+ o = ["--#{name}"]
61
+ rest = @opts.parse o
62
+ assert_not_equal('', @stdout.string)
63
+ assert_equal('', @stderr.string)
64
+ assert_equal(true, @options[name.to_sym])
65
+ other_sym = 'help' == name ? :version : :help
66
+ assert_equal(false, @options.member?(other_sym))
67
+ end
68
+ }
69
+ Process.wait
66
70
  end
67
71
 
68
72
  def test_both_client_server_opts
@@ -9,8 +9,6 @@ class TestAppRun < Test::Unit::TestCase
9
9
  assert_equal(true, File.executable?(whence_file('irb')))
10
10
  ng = whence_file('probably-does-not-exist')
11
11
  assert_equal(true, File.executable?(ng) || ng == 'probably-does-not-exist')
12
- rp = ruby_path
13
- assert_equal(true, File.executable?(rp))
14
12
  end
15
13
 
16
14
  end
@@ -18,10 +18,27 @@ class TestAppUtil < Test::Unit::TestCase
18
18
  locs = Rubinius::VM.backtrace(0, true)
19
19
  i = find_main_script(locs)
20
20
  assert_equal(true, !!i)
21
- j = locs.size - i
22
- if j > 0
23
- locs = Rubinius::VM.backtrace(j, true)
24
- assert_equal(false, !!find_main_script(locs))
21
+ assert_equal(false, !!find_main_script(locs[0..i]))
22
+ end
23
+
24
+ def test_abbrev
25
+ list = %w(disassemble disable distance up)
26
+ [['dis', 'dis'],
27
+ ['disas', 'disassemble'],
28
+ ['u', 'up'],
29
+ ['upper', 'upper'],
30
+ ['foo', 'foo']].each do |name, expect|
31
+ assert_equal expect, uniq_abbrev(list, name)
32
+ end
33
+ end
34
+
35
+ def test_extract_expression
36
+ [['if condition("if")', 'condition("if")'],
37
+ ['until until_termination', 'until_termination'],
38
+ ['return return_value', 'return_value'],
39
+ ['nothing_to_be.done', 'nothing_to_be.done'],
40
+ ].each do |stmt, expect|
41
+ assert_equal expect, extract_expression(stmt)
25
42
  end
26
43
  end
27
44
  end
@@ -1,14 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'test/unit'
3
3
  require 'rubygems'; require 'require_relative'
4
- require_relative '../../processor/command/base/cmd'
4
+ require_relative '../../processor/command'
5
5
 
6
- class Trepan
7
- class Command::Test < Trepan::Command
8
- NAME = 'test'
9
- CATEGORY = 'testcategory'
10
- completion %w(a aa ab ba aac)
11
- end
6
+ class Trepan::Command::Test < Trepan::Command
7
+ NAME = 'test'
8
+ CATEGORY = 'testcategory'
9
+ completion %w(a aa ab ba aac)
12
10
  end
13
11
 
14
12
  class TestBaseCommand < Test::Unit::TestCase
@@ -2,14 +2,10 @@
2
2
  require 'test/unit'
3
3
  require 'rubygems'; require 'require_relative'
4
4
  # require_relative '../../app/core'
5
- require_relative '../../processor/main'
5
+ require_relative '../../processor'
6
6
  require_relative '../../processor/command/exit'
7
7
  require_relative '../../processor/command/base/subcmd'
8
8
 
9
- # Mock debugger stub. FIXME: put in common helper routine.
10
- class Trepan
11
- end
12
-
13
9
  $errors = []
14
10
  class TestBaseSubCommand < Test::Unit::TestCase
15
11
 
@@ -14,7 +14,7 @@ class TestBaseSubcommandMgr < Test::Unit::TestCase
14
14
  def test_basic
15
15
  my_cmd = @cmds['show']
16
16
  # require 'trepanning'; debugger
17
- assert_equal(%w(debug different), my_cmd.complete('d'),
17
+ assert_equal(%w(debug different directories), my_cmd.complete('d'),
18
18
  "Should be able to complete 'd'")
19
19
  assert_equal(%w(show args), my_cmd.subcmds.lookup('ar').prefix,
20
20
  "Should be able to complete lookup('ar')")
@@ -3,10 +3,6 @@ require 'test/unit'
3
3
  require 'rubygems'; require 'require_relative'
4
4
  require_relative '../../processor/command/base/subsubcmd'
5
5
 
6
- # Mock debugger stub. FIXME: put in common helper routine.
7
- class Trepan
8
- end
9
-
10
6
  $errors = []
11
7
  class TestBaseSubCommand < Test::Unit::TestCase
12
8
 
@@ -8,8 +8,8 @@ class TestBinTrepan < Test::Unit::TestCase
8
8
 
9
9
  include Trepanning
10
10
 
11
- def test_ruby_path
12
- rb_path = ruby_path
11
+ def test_RbConfig_ruby
12
+ rb_path = RbConfig.ruby
13
13
  assert_equal(true, File.executable?(rb_path),
14
14
  "#{rb_path} should be an executable Ruby interpreter")
15
15
 
@@ -20,6 +20,8 @@ class TestCommandBreak < Test::Unit::TestCase
20
20
 
21
21
  # require_relative '../../lib/trepanning'
22
22
  def test_basic
23
+ assert true
24
+ return
23
25
  # [
24
26
  # [@name, __LINE__.to_s],
25
27
  # ].each_with_index do |args, i|
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'; require 'require_relative'
3
+ require_relative './mock-helper'
4
+ require_relative './cmd-helper'
5
+ require_relative '../../processor/command/edit'
6
+
7
+ class TestCommandEdit < Test::Unit::TestCase
8
+ include MockUnitHelper
9
+ def setup
10
+ @name = File.basename(__FILE__, '.rb').split(/-/)[2]
11
+ $msgs = []
12
+ $errmsgs = []
13
+ common_setup(@name)
14
+ def @cmd.msg(message)
15
+ $msgs << message
16
+ end
17
+ def @cmd.errmsg(message)
18
+ $errmsgs << message
19
+ end
20
+ end
21
+
22
+ def test_basic
23
+ old_editor = ENV['EDITOR']
24
+ ENV['EDITOR'] = '#'
25
+ base_file = File.basename(__FILE__)
26
+ @cmd.proc.settings[:basename] = true
27
+ @cmd.run([@name])
28
+ assert_equal "Running # +7 \"mock-helper.rb\"...", $msgs[-1]
29
+ @cmd.run([@name, 8])
30
+ assert_equal "Running # +8 \"mock-helper.rb\"...", $msgs[-1]
31
+ @cmd.run([@name, __FILE__])
32
+ assert_equal "Running # +1 \"#{base_file}\"...", $msgs[-1]
33
+ end
34
+ end