ruby-debug 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +94 -2
- data/ChangeLog +5225 -0
- data/README +30 -1
- data/Rakefile +55 -24
- data/bin/rdebug +249 -128
- data/cli/ruby-debug/command.rb +30 -3
- data/cli/ruby-debug/commands/breakpoints.rb +54 -24
- data/cli/ruby-debug/commands/catchpoint.rb +13 -12
- data/cli/ruby-debug/commands/condition.rb +49 -0
- data/cli/ruby-debug/commands/continue.rb +32 -0
- data/cli/ruby-debug/commands/control.rb +19 -43
- data/cli/ruby-debug/commands/disassemble.RB +38 -0
- data/cli/ruby-debug/commands/display.rb +1 -1
- data/cli/ruby-debug/commands/edit.rb +48 -0
- data/cli/ruby-debug/commands/enable.rb +78 -35
- data/cli/ruby-debug/commands/eval.rb +6 -5
- data/cli/ruby-debug/commands/finish.rb +42 -0
- data/cli/ruby-debug/commands/frame.rb +64 -33
- data/cli/ruby-debug/commands/help.rb +19 -15
- data/cli/ruby-debug/commands/info.rb +295 -36
- data/cli/ruby-debug/commands/irb.rb +3 -1
- data/cli/ruby-debug/commands/list.rb +27 -50
- data/cli/ruby-debug/commands/quit.rb +38 -0
- data/cli/ruby-debug/commands/reload.rb +40 -0
- data/cli/ruby-debug/commands/save.rb +80 -0
- data/cli/ruby-debug/commands/{settings.rb → set.rb} +50 -12
- data/cli/ruby-debug/commands/show.rb +83 -27
- data/cli/ruby-debug/commands/source.rb +36 -0
- data/cli/ruby-debug/commands/stepping.rb +36 -72
- data/cli/ruby-debug/commands/threads.rb +32 -23
- data/cli/ruby-debug/commands/variables.rb +34 -4
- data/cli/ruby-debug/helper.rb +10 -75
- data/cli/ruby-debug/interface.rb +72 -9
- data/cli/ruby-debug/processor.rb +203 -100
- data/doc/rdebug.1 +7 -2
- data/rdbg.rb +33 -0
- data/test/{test-ruby-debug-base.rb → base/base.rb} +27 -29
- data/test/base/binding.rb +31 -0
- data/test/base/catchpoint.rb +26 -0
- data/test/base/load.rb +40 -0
- data/test/data/annotate.cmd +29 -0
- data/test/data/annotate.right +137 -0
- data/test/data/break_bad.cmd +18 -0
- data/test/data/break_bad.right +28 -0
- data/test/data/breakpoints.cmd +38 -0
- data/test/data/breakpoints.right +98 -0
- data/test/data/condition.cmd +28 -0
- data/test/data/condition.right +65 -0
- data/test/data/ctrl.cmd +23 -0
- data/test/data/ctrl.right +69 -0
- data/test/{display.cmd → data/display.cmd} +7 -1
- data/test/{display.right → data/display.right} +13 -6
- data/test/data/dollar-0.right +2 -0
- data/test/data/dollar-0a.right +2 -0
- data/test/data/dollar-0b.right +2 -0
- data/test/data/edit.cmd +12 -0
- data/test/data/edit.right +19 -0
- data/test/{breakpoints.cmd → data/emacs_basic.cmd} +0 -0
- data/test/{breakpoints.right → data/emacs_basic.right} +24 -12
- data/test/data/enable.cmd +20 -0
- data/test/data/enable.right +36 -0
- data/test/data/finish.cmd +16 -0
- data/test/data/finish.right +43 -0
- data/test/{frame.cmd → data/frame.cmd} +2 -0
- data/test/{frame.right → data/frame.right} +8 -2
- data/test/{help.cmd → data/help.cmd} +8 -0
- data/test/data/help.right +21 -0
- data/test/data/history.right +7 -0
- data/test/data/info-thread.cmd +13 -0
- data/test/data/info-thread.right +37 -0
- data/test/data/info-var-bug2.cmd +5 -0
- data/test/data/info-var-bug2.right +10 -0
- data/test/{info-var.cmd → data/info-var.cmd} +3 -3
- data/test/{info-var.right → data/info-var.right} +20 -15
- data/test/{info.cmd → data/info.cmd} +10 -1
- data/test/data/info.right +65 -0
- data/test/data/linetrace.cmd +6 -0
- data/test/data/linetrace.right +32 -0
- data/test/data/linetracep.cmd +7 -0
- data/test/data/linetracep.right +25 -0
- data/test/data/list.cmd +19 -0
- data/test/data/list.right +127 -0
- data/test/data/noquit.right +1 -0
- data/test/data/output.cmd +6 -0
- data/test/data/output.right +41 -0
- data/test/data/post-mortem-next.cmd +8 -0
- data/test/data/post-mortem-next.right +14 -0
- data/test/data/post-mortem-osx.right +31 -0
- data/test/data/post-mortem.cmd +13 -0
- data/test/data/post-mortem.right +31 -0
- data/test/{quit.cmd → data/quit.cmd} +2 -5
- data/test/data/quit.right +9 -0
- data/test/data/raise.cmd +11 -0
- data/test/data/raise.right +26 -0
- data/test/{setshow.cmd → data/setshow.cmd} +0 -1
- data/test/{setshow.right → data/setshow.right} +0 -1
- data/test/data/source.cmd +5 -0
- data/test/data/source.right +15 -0
- data/test/{stepping.cmd → data/stepping.cmd} +6 -2
- data/test/{stepping.right → data/stepping.right} +13 -3
- data/test/data/test-init-cygwin.right +7 -0
- data/test/data/test-init-osx.right +4 -0
- data/test/data/test-init.right +5 -0
- data/test/data/trace.right +23 -0
- data/test/dollar-0.rb +5 -0
- data/test/except-bug2.rb +7 -0
- data/test/gcd-dbg-nox.rb +31 -0
- data/test/gcd-dbg.rb +30 -0
- data/test/helper.rb +44 -14
- data/test/info-var-bug.rb +2 -0
- data/test/info-var-bug2.rb +2 -0
- data/test/null.rb +1 -0
- data/test/output.rb +2 -0
- data/test/pm-base.rb +22 -0
- data/test/pm.rb +11 -0
- data/test/raise.rb +3 -0
- data/test/tdebug.rb +88 -40
- data/test/test-annotate.rb +25 -0
- data/test/test-break-bad.rb +25 -0
- data/test/test-breakpoints.rb +14 -17
- data/test/test-condition.rb +25 -0
- data/test/test-ctrl.rb +54 -0
- data/test/test-display.rb +15 -15
- data/test/test-dollar-0.rb +39 -0
- data/test/test-edit.rb +26 -0
- data/test/test-emacs-basic.rb +26 -0
- data/test/test-enable.rb +25 -0
- data/test/test-finish.rb +34 -0
- data/test/test-frame.rb +15 -16
- data/test/test-help.rb +34 -18
- data/test/test-hist.rb +68 -0
- data/test/test-info-thread.rb +32 -0
- data/test/test-info-var.rb +28 -14
- data/test/test-info.rb +15 -17
- data/test/test-init.rb +41 -0
- data/test/test-list.rb +25 -0
- data/test/test-output.rb +26 -0
- data/test/test-pm.rb +46 -0
- data/test/test-quit.rb +19 -17
- data/test/test-raise.rb +25 -0
- data/test/test-setshow.rb +14 -13
- data/test/test-source.rb +25 -0
- data/test/test-stepping.rb +14 -14
- data/test/test-trace.rb +63 -0
- data/test/thread1.rb +26 -0
- metadata +125 -31
- data/cli/ruby-debug/commands/script.rb +0 -64
- data/runner.sh +0 -7
- data/test/help.right +0 -4
- data/test/info.right +0 -35
- data/test/quit.right +0 -22
- data/test/test-columnize.rb +0 -46
data/test/test-edit.rb
ADDED
|
@@ -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 'edit' command handling.
|
|
8
|
+
class TestEdit < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
@@SRC_DIR = 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='edit'
|
|
18
|
+
Dir.chdir(@@SRC_DIR) do
|
|
19
|
+
script = File.join('data', testname + '.cmd')
|
|
20
|
+
ENV['EDITOR']='echo FAKE-EDITOR '
|
|
21
|
+
assert_equal(true,
|
|
22
|
+
run_debugger(testname,
|
|
23
|
+
"--script #{script} -- gcd.rb 3 5"))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
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 the --emacs-basic option.
|
|
8
|
+
class TestEmacsBasic < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
@@SRC_DIR = File.dirname(__FILE__) unless
|
|
11
|
+
defined?(@@SRC_DIR)
|
|
12
|
+
|
|
13
|
+
require File.join(@@SRC_DIR, 'helper.rb')
|
|
14
|
+
|
|
15
|
+
include TestHelper
|
|
16
|
+
|
|
17
|
+
def test_basic
|
|
18
|
+
testname='emacs_basic'
|
|
19
|
+
Dir.chdir(@@SRC_DIR) do
|
|
20
|
+
script = File.join('data', testname + '.cmd')
|
|
21
|
+
assert_equal(true,
|
|
22
|
+
run_debugger(testname,
|
|
23
|
+
"--emacs-basic --script #{script} -- gcd.rb 3 5"))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/test/test-enable.rb
ADDED
|
@@ -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 enable and disable commands
|
|
8
|
+
class TestEnable < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
@@SRC_DIR = 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='enable'
|
|
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
|
data/test/test-finish.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
|
|
4
|
+
# require 'rubygems'
|
|
5
|
+
# require 'ruby-debug'; Debugger.start
|
|
6
|
+
|
|
7
|
+
# Test finish command
|
|
8
|
+
class TestFinish < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
@@src_dir = 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='finish'
|
|
18
|
+
# Ruby 1.8.6 and earlier have a trace-line number bug for return
|
|
19
|
+
# statements.
|
|
20
|
+
filter = Proc.new{|got_lines, correct_lines|
|
|
21
|
+
[got_lines[31], got_lines[34]].flatten.each do |s|
|
|
22
|
+
s.sub!(/gcd.rb:\d+/, 'gcd.rb:13')
|
|
23
|
+
end
|
|
24
|
+
got_lines[32] = 'return a'
|
|
25
|
+
}
|
|
26
|
+
Dir.chdir(@@src_dir) do
|
|
27
|
+
script = File.join('data', testname + '.cmd')
|
|
28
|
+
assert_equal(true,
|
|
29
|
+
run_debugger(testname,
|
|
30
|
+
"--script #{script} -- gcd.rb 3 5",
|
|
31
|
+
nil, filter))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
data/test/test-frame.rb
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
require
|
|
3
|
-
require "fileutils"
|
|
2
|
+
require 'test/unit'
|
|
4
3
|
|
|
5
|
-
# require
|
|
6
|
-
# require
|
|
7
|
-
|
|
8
|
-
SRC_DIR = File.expand_path(File.dirname(__FILE__)) + "/" unless
|
|
9
|
-
defined?(SRC_DIR)
|
|
10
|
-
|
|
11
|
-
require File.join(SRC_DIR, "helper.rb")
|
|
12
|
-
|
|
13
|
-
include TestHelper
|
|
4
|
+
# begin require 'rubygems' rescue LoadError end
|
|
5
|
+
# require 'ruby-debug'; Debugger.start
|
|
14
6
|
|
|
15
7
|
# Test frame commands
|
|
16
8
|
class TestFrame < Test::Unit::TestCase
|
|
17
|
-
require 'stringio'
|
|
18
9
|
|
|
19
|
-
|
|
10
|
+
@@SRC_DIR = File.dirname(__FILE__) unless
|
|
11
|
+
defined?(@@SRC_DIR)
|
|
12
|
+
|
|
13
|
+
require File.join(@@SRC_DIR, 'helper')
|
|
14
|
+
include TestHelper
|
|
15
|
+
|
|
16
|
+
# Test commands in frame.rb
|
|
20
17
|
def test_basic
|
|
21
|
-
|
|
18
|
+
testname='frame'
|
|
19
|
+
Dir.chdir(@@SRC_DIR) do
|
|
20
|
+
script = File.join('data', testname + '.cmd')
|
|
22
21
|
assert_equal(true,
|
|
23
|
-
run_debugger(
|
|
24
|
-
"--script
|
|
22
|
+
run_debugger(testname,
|
|
23
|
+
"--script #{script} -- gcd.rb 3 5"))
|
|
25
24
|
end
|
|
26
25
|
end
|
|
27
26
|
end
|
data/test/test-help.rb
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
# require
|
|
4
|
-
# require
|
|
3
|
+
# begin require 'rubygems' rescue LoadError end
|
|
4
|
+
# require 'ruby-debug' ; Debugger.start
|
|
5
5
|
|
|
6
|
-
require
|
|
7
|
-
SRC_DIR = File.
|
|
6
|
+
require 'test/unit'
|
|
7
|
+
SRC_DIR = File.dirname(__FILE__) unless
|
|
8
8
|
defined?(SRC_DIR)
|
|
9
9
|
%w(ext lib cli).each do |dir|
|
|
10
|
-
|
|
10
|
+
$:.unshift File.join(SRC_DIR, '..', dir)
|
|
11
11
|
end
|
|
12
|
-
require
|
|
13
|
-
|
|
12
|
+
require 'ruby_debug'
|
|
13
|
+
|
|
14
|
+
require File.join(SRC_DIR, '..', 'cli', 'ruby-debug')
|
|
15
|
+
$:.shift; $:.shift; $:.shift
|
|
14
16
|
|
|
15
17
|
def cheap_diff(got_lines, correct_lines)
|
|
18
|
+
puts got_lines if $DEBUG
|
|
16
19
|
correct_lines.each_with_index do |line, i|
|
|
17
20
|
correct_lines[i].chomp!
|
|
18
21
|
if got_lines[i] != correct_lines[i]
|
|
@@ -21,24 +24,37 @@ def cheap_diff(got_lines, correct_lines)
|
|
|
21
24
|
puts "need: #{correct_lines[i]}"
|
|
22
25
|
return false
|
|
23
26
|
end
|
|
24
|
-
|
|
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
|
|
25
33
|
end
|
|
26
34
|
end
|
|
27
35
|
|
|
28
|
-
# Test
|
|
29
|
-
class
|
|
36
|
+
# Test Help commands
|
|
37
|
+
class TestHelp < Test::Unit::TestCase
|
|
30
38
|
require 'stringio'
|
|
31
39
|
|
|
32
40
|
# Test initial variables and setting/getting state.
|
|
33
41
|
def test_basic
|
|
34
42
|
testbase = 'help'
|
|
35
|
-
op = StringIO.new(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
43
59
|
end
|
|
44
60
|
end
|
data/test/test-hist.rb
ADDED
|
@@ -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.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.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
|
data/test/test-info-var.rb
CHANGED
|
@@ -1,33 +1,47 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
require
|
|
3
|
-
require "fileutils"
|
|
2
|
+
require 'test/unit'
|
|
4
3
|
|
|
5
|
-
# require
|
|
6
|
-
# require
|
|
7
|
-
|
|
8
|
-
SRC_DIR = File.expand_path(File.dirname(__FILE__)) + "/" unless
|
|
9
|
-
defined?(SRC_DIR)
|
|
10
|
-
|
|
11
|
-
require File.join(SRC_DIR, "helper.rb")
|
|
12
|
-
include TestHelper
|
|
4
|
+
# begin require 'rubygems' rescue LoadError end
|
|
5
|
+
# require 'ruby-debug'; Debugger.start
|
|
13
6
|
|
|
14
7
|
# Test info variables command
|
|
15
8
|
class TestInfoVar < Test::Unit::TestCase
|
|
16
9
|
|
|
10
|
+
@@SRC_DIR = File.dirname(__FILE__) unless
|
|
11
|
+
defined?(@@SRC_DIR)
|
|
12
|
+
|
|
13
|
+
require File.join(@@SRC_DIR, 'helper')
|
|
14
|
+
include TestHelper
|
|
15
|
+
|
|
17
16
|
def test_info_variables
|
|
18
17
|
|
|
19
|
-
Dir.chdir(SRC_DIR) do
|
|
18
|
+
Dir.chdir(@@SRC_DIR) do
|
|
20
19
|
|
|
21
20
|
filter = Proc.new{|got_lines, correct_lines|
|
|
22
|
-
[got_lines[
|
|
21
|
+
[got_lines[13-1], correct_lines[13-1]].each do |s|
|
|
23
22
|
s.sub!(/Mine:0x[0-9,a-f]+/, 'Mine:')
|
|
24
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
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
testname='info-var'
|
|
33
|
+
script = File.join('data', testname + '.cmd')
|
|
27
34
|
assert_equal(true,
|
|
28
|
-
run_debugger(
|
|
29
|
-
"--script
|
|
35
|
+
run_debugger(testname,
|
|
36
|
+
"--script #{script} -- info-var-bug.rb",
|
|
30
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
|
+
|
|
31
45
|
end
|
|
32
46
|
end
|
|
33
47
|
end
|
data/test/test-info.rb
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
require
|
|
3
|
-
require "fileutils"
|
|
2
|
+
require 'test/unit'
|
|
4
3
|
|
|
5
|
-
# require
|
|
6
|
-
# require
|
|
7
|
-
# Debugger.start
|
|
8
|
-
|
|
9
|
-
SRC_DIR = File.expand_path(File.dirname(__FILE__)) + "/" unless
|
|
10
|
-
defined?(SRC_DIR)
|
|
11
|
-
|
|
12
|
-
require File.join(SRC_DIR, "helper.rb")
|
|
13
|
-
|
|
14
|
-
include TestHelper
|
|
4
|
+
# begin require 'rubygems' rescue LoadError end
|
|
5
|
+
# require 'ruby-debug'; Debugger.start
|
|
15
6
|
|
|
16
7
|
# Test info commands
|
|
17
8
|
class TestInfo < Test::Unit::TestCase
|
|
18
|
-
require 'stringio'
|
|
19
9
|
|
|
20
|
-
|
|
10
|
+
@@SRC_DIR = 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
|
|
21
17
|
def test_basic
|
|
22
|
-
|
|
18
|
+
testname='info'
|
|
19
|
+
Dir.chdir(@@SRC_DIR) do
|
|
20
|
+
script = File.join('data', testname + '.cmd')
|
|
23
21
|
assert_equal(true,
|
|
24
|
-
run_debugger(
|
|
25
|
-
"--script
|
|
22
|
+
run_debugger(testname,
|
|
23
|
+
"--script #{script} -- gcd.rb 3 5"))
|
|
26
24
|
end
|
|
27
25
|
end
|
|
28
26
|
end
|