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.
- data/ChangeLog +762 -238
- data/NEWS +44 -0
- data/Rakefile +61 -32
- data/app/breakpoint.rb +2 -0
- data/app/brkptmgr.rb +9 -11
- data/app/client.rb +0 -1
- data/app/cmd_parse.kpeg +21 -4
- data/app/cmd_parse.rb +10 -10
- data/app/cmd_parser.rb +1029 -840
- data/app/complete.rb +1 -1
- data/app/display.rb +38 -0
- data/app/file.rb +24 -0
- data/app/frame.rb +11 -4
- data/app/irb.rb +41 -39
- data/app/iseq.rb +71 -0
- data/app/options.rb +55 -30
- data/app/rbx-llvm.rb +0 -2
- data/app/run.rb +13 -9
- data/app/util.rb +55 -5
- data/bin/trepanx +3 -3
- data/data/irbrc +13 -13
- data/{interface/base_intf.rb → interface.rb} +5 -1
- data/interface/client.rb +4 -0
- data/interface/script.rb +13 -5
- data/interface/server.rb +5 -1
- data/interface/user.rb +8 -1
- data/{io/base_io.rb → io.rb} +0 -0
- data/io/input.rb +1 -1
- data/io/null_output.rb +28 -24
- data/io/string_array.rb +2 -3
- data/io/tcpclient.rb +1 -1
- data/io/tcpserver.rb +1 -1
- data/lib/trepanning.rb +11 -13
- data/{processor/main.rb → processor.rb} +50 -54
- data/processor/breakpoint.rb +150 -137
- data/processor/{command/base/cmd.rb → command.rb} +1 -1
- data/processor/command/alias.rb +14 -3
- data/processor/command/backtrace.rb +2 -1
- data/processor/command/base/subcmd.rb +1 -5
- data/processor/command/base/submgr.rb +5 -2
- data/processor/command/base/subsubcmd.rb +1 -1
- data/processor/command/base/subsubmgr.rb +4 -4
- data/processor/command/break.rb +1 -1
- data/processor/command/complete.rb +2 -1
- data/processor/command/condition.rb +2 -2
- data/processor/command/continue.rb +4 -4
- data/processor/command/delete.rb +34 -20
- data/processor/command/directory.rb +4 -4
- data/processor/command/disable.rb +71 -0
- data/processor/command/disassemble.rb +55 -22
- data/processor/command/display.rb +3 -1
- data/processor/command/down.rb +8 -8
- data/processor/command/edit.rb +74 -0
- data/processor/command/enable.rb +43 -0
- data/processor/command/eval.rb +37 -15
- data/processor/command/exit.rb +25 -6
- data/processor/command/finish.rb +5 -5
- data/processor/command/frame.rb +2 -2
- data/processor/command/help.rb +7 -9
- data/processor/command/help/README +10 -0
- data/processor/command/help/command.txt +37 -27
- data/processor/command/help/examples.txt +16 -0
- data/processor/command/help/filename.txt +1 -1
- data/processor/command/help/suffixes.txt +17 -0
- data/processor/command/info.rb +3 -1
- data/processor/command/info_subcmd/files.rb +3 -2
- data/processor/command/info_subcmd/frame.rb +2 -1
- data/processor/command/info_subcmd/line.rb +17 -28
- data/processor/command/info_subcmd/locals.rb +22 -0
- data/processor/command/{show_subcmd → info_subcmd}/macro.rb +4 -4
- data/processor/command/info_subcmd/program.rb +2 -0
- data/processor/command/info_subcmd/ruby.rb +2 -0
- data/processor/command/info_subcmd/source.rb +75 -0
- data/processor/command/info_subcmd/stack.rb +25 -0
- data/processor/command/info_subcmd/variables.rb +23 -36
- data/processor/command/info_subcmd/variables_subcmd/.gitignore +2 -0
- data/processor/command/info_subcmd/variables_subcmd/class.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/constant.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/globals.rb +69 -0
- data/processor/command/info_subcmd/variables_subcmd/instance.rb +42 -0
- data/processor/command/info_subcmd/variables_subcmd/locals.rb +80 -0
- data/processor/command/kill.rb +8 -9
- data/processor/command/list.rb +101 -167
- data/processor/command/macro.rb +28 -10
- data/processor/command/next.rb +2 -1
- data/processor/command/nexti.rb +1 -1
- data/processor/command/parsetree.rb +51 -0
- data/processor/command/pr.rb +1 -2
- data/processor/command/ps.rb +1 -1
- data/processor/command/restart.rb +2 -2
- data/processor/command/save.rb +1 -1
- data/processor/command/server.rb +1 -1
- data/processor/command/set_subcmd/abbrev.rb +25 -0
- data/processor/command/set_subcmd/auto.rb +7 -1
- data/processor/command/set_subcmd/auto_subcmd/eval.rb +1 -2
- data/processor/command/set_subcmd/auto_subcmd/irb.rb +2 -3
- data/processor/command/set_subcmd/auto_subcmd/list.rb +2 -3
- data/processor/command/set_subcmd/different.rb +1 -1
- data/processor/command/set_subcmd/highlight.rb +7 -1
- data/processor/command/set_subcmd/reload.rb +42 -0
- data/processor/command/set_subcmd/timer.rb +58 -0
- data/processor/command/set_subcmd/trace.rb +4 -3
- data/processor/command/{irb.rb → shell.rb} +22 -19
- data/processor/command/show_subcmd/abbrev.rb +20 -0
- data/processor/command/show_subcmd/{alias.rb → aliases.rb} +2 -2
- data/processor/command/show_subcmd/auto_subcmd/eval.rb +2 -6
- data/processor/command/show_subcmd/directories.rb +22 -0
- data/processor/command/show_subcmd/hidelevel.rb +1 -1
- data/processor/command/show_subcmd/highlight.rb +2 -1
- data/processor/command/show_subcmd/reload.rb +18 -0
- data/processor/command/show_subcmd/timer.rb +18 -0
- data/processor/command/source.rb +9 -9
- data/processor/command/step.rb +1 -1
- data/processor/command/tbreak.rb +3 -2
- data/processor/command/unalias.rb +11 -6
- data/processor/command/undisplay.rb +13 -9
- data/processor/command/up.rb +13 -14
- data/processor/default.rb +47 -44
- data/processor/disassemble.rb +48 -35
- data/processor/display.rb +38 -3
- data/processor/eval.rb +54 -53
- data/processor/eventbuf.rb +69 -69
- data/processor/frame.rb +186 -187
- data/processor/help.rb +6 -4
- data/processor/hook.rb +103 -102
- data/processor/list.rb +123 -0
- data/processor/load_cmds.rb +9 -1
- data/processor/location.rb +193 -188
- data/processor/mock.rb +1 -7
- data/processor/msg.rb +56 -42
- data/processor/running.rb +26 -15
- data/processor/stepping.rb +2 -1
- data/processor/subcmd.rb +18 -43
- data/processor/validate.rb +41 -30
- data/processor/virtual.rb +33 -0
- data/rbx-trepanning.gemspec +7 -8
- data/sample/rocky-trepanx-colors.rb +0 -1
- data/test/data/fname-with-blank.right +2 -0
- data/test/data/inline-call.right +11 -10
- data/test/data/quit.right +1 -0
- data/test/example/debugger-stop.rb +1 -1
- data/test/example/goto2goto.rb +11 -0
- data/test/functional/fn_helper.rb +2 -2
- data/test/functional/test-list.rb +7 -6
- data/test/integration/helper.rb +5 -5
- data/test/unit/cmd-helper.rb +2 -6
- data/test/unit/test-app-cmd_parser.rb +3 -2
- data/test/unit/test-app-display.rb +22 -0
- data/test/unit/test-app-options.rb +14 -10
- data/test/unit/test-app-run.rb +0 -2
- data/test/unit/test-app-util.rb +21 -4
- data/test/unit/test-base-cmd.rb +5 -7
- data/test/unit/test-base-subcmd.rb +1 -5
- data/test/unit/test-base-submgr.rb +1 -1
- data/test/unit/test-base-subsubcmd.rb +0 -4
- data/test/unit/test-bin-trepanx.rb +2 -2
- data/test/unit/test-cmd-break.rb +2 -0
- data/test/unit/test-cmd-edit.rb +34 -0
- data/test/unit/test-cmd-kill.rb +11 -4
- data/test/unit/test-cmd-parse_list_cmd.rb +36 -0
- data/test/unit/test-command.rb +45 -0
- data/test/unit/test-completion.rb +1 -1
- data/test/unit/test-proc-eval.rb +1 -2
- data/test/unit/test-proc-frame.rb +5 -3
- data/test/unit/test-proc-list.rb +55 -0
- data/test/unit/test-proc-load_cmds.rb +4 -3
- data/test/unit/test-proc-location.rb +32 -29
- data/test/unit/test-proc-main.rb +1 -5
- data/test/unit/test-proc-validate.rb +14 -4
- data/test/unit/test-subcmd-help.rb +1 -5
- 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
|
data/rbx-trepanning.gemspec
CHANGED
@@ -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"
|
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.
|
12
|
-
s.add_dependency('rbx-require-relative')
|
13
|
-
s.add_dependency('rbx-linecache', '~>1.
|
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.
|
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
|
data/test/data/inline-call.right
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
-- (inline-call.rb:11 @12)
|
2
2
|
if a > b
|
3
3
|
basename is off.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
@@ -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
|
-
|
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
|
-
"
|
39
|
-
"
|
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
|
-
"
|
44
|
-
"
|
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
|
48
|
-
" 32
|
48
|
+
" 31 ->\t foo",
|
49
|
+
" 32 \t ##############################"
|
49
50
|
]
|
50
51
|
compare_output(out, d, cmds)
|
51
52
|
end
|
data/test/integration/helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
+
require 'rubygems'; require 'require_relative'
|
1
2
|
require 'diff/lcs'
|
2
3
|
require 'fileutils'
|
3
|
-
|
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
|
-
[
|
40
|
+
[RbConfig.ruby, programfile, opts[:args], outfile, cmdfile]
|
41
41
|
elsif opts[:standalone]
|
42
42
|
"%s %s %s >%s 2>&1" %
|
43
|
-
[
|
43
|
+
[RbConfig.ruby, programfile, opts[:args], outfile]
|
44
44
|
else
|
45
45
|
"%s %s --nx --command %s %s '%s' %s >%s 2>&1" %
|
46
|
-
[
|
46
|
+
[RbConfig.ruby, dbgr_path, cmdfile, opts[:dbgr],
|
47
47
|
programfile, opts[:args], outfile]
|
48
48
|
end
|
49
49
|
puts cmd if opts[:verbose]
|
data/test/unit/cmd-helper.rb
CHANGED
@@ -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
|
11
|
+
@cmdproc ||= Trepan::CmdProcessor.new(@dbg)
|
16
12
|
@cmdproc.frame_initialize
|
17
|
-
@cmdproc.dbgr
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
data/test/unit/test-app-run.rb
CHANGED
@@ -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
|
data/test/unit/test-app-util.rb
CHANGED
@@ -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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
data/test/unit/test-base-cmd.rb
CHANGED
@@ -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
|
4
|
+
require_relative '../../processor/command'
|
5
5
|
|
6
|
-
class Trepan
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
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
|
12
|
-
rb_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
|
|
data/test/unit/test-cmd-break.rb
CHANGED
@@ -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
|