ruby-debug 0.10.5.rc1 → 0.10.5.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +54 -0
- data/Rakefile +34 -239
- metadata +15 -182
- data/test/base/base.rb +0 -77
- data/test/base/binding.rb +0 -22
- data/test/base/catchpoint.rb +0 -19
- data/test/base/load.rb +0 -44
- data/test/base/reload_bug.rb +0 -8
- data/test/cli/commands/catchpoint_test.rb +0 -24
- data/test/cli/commands/unit/regexp.rb +0 -36
- data/test/config.yaml +0 -8
- data/test/data/annotate.cmd +0 -29
- data/test/data/annotate.right +0 -139
- data/test/data/at-exit.cmd +0 -4
- data/test/data/at-exit.right +0 -12
- data/test/data/break_bad.cmd +0 -16
- data/test/data/break_bad.right +0 -26
- data/test/data/break_loop_bug.cmd +0 -5
- data/test/data/break_loop_bug.right +0 -15
- data/test/data/break_tracelines.cmd +0 -9
- data/test/data/break_tracelines.right +0 -17
- data/test/data/breakpoints-basename.cmd +0 -2
- data/test/data/breakpoints-basename.right +0 -10
- data/test/data/breakpoints.cmd +0 -37
- data/test/data/breakpoints.right +0 -96
- data/test/data/brkpt-class-bug.cmd +0 -9
- data/test/data/brkpt-class-bug.right +0 -18
- data/test/data/catch.cmd +0 -18
- data/test/data/catch.right +0 -41
- data/test/data/condition.cmd +0 -29
- data/test/data/condition.right +0 -67
- data/test/data/continue_bad.cmd +0 -4
- data/test/data/continue_bad.right +0 -9
- data/test/data/ctrl.cmd +0 -23
- data/test/data/ctrl.right +0 -70
- data/test/data/display.cmd +0 -24
- data/test/data/display.right +0 -44
- data/test/data/dollar-0.right +0 -3
- data/test/data/dollar-0a.right +0 -3
- data/test/data/dollar-0b.right +0 -3
- data/test/data/edit.cmd +0 -12
- data/test/data/edit.right +0 -19
- data/test/data/emacs_basic.cmd +0 -10
- data/test/data/emacs_basic.right +0 -24
- data/test/data/enable.cmd +0 -20
- data/test/data/enable.right +0 -36
- data/test/data/except-bug1.cmd +0 -7
- data/test/data/except-bug1.right +0 -13
- data/test/data/file-with-space.cmd +0 -7
- data/test/data/file-with-space.right +0 -9
- data/test/data/finish.cmd +0 -16
- data/test/data/finish.right +0 -31
- data/test/data/frame.cmd +0 -29
- data/test/data/frame.right +0 -62
- data/test/data/help.cmd +0 -20
- data/test/data/help.right +0 -21
- data/test/data/history.right +0 -7
- data/test/data/info-file-break.cmd +0 -4
- data/test/data/info-file-break.right +0 -11
- data/test/data/info-thread.cmd +0 -13
- data/test/data/info-thread.right +0 -37
- data/test/data/info-var-bug2.cmd +0 -5
- data/test/data/info-var-bug2.right +0 -10
- data/test/data/info-var.cmd +0 -23
- data/test/data/info-var.right +0 -52
- data/test/data/info.cmd +0 -21
- data/test/data/info.right +0 -80
- data/test/data/linetrace-jruby.right +0 -23
- data/test/data/linetrace.cmd +0 -6
- data/test/data/linetrace.right +0 -32
- data/test/data/linetracep.cmd +0 -7
- data/test/data/linetracep.right +0 -25
- data/test/data/list.cmd +0 -19
- data/test/data/list.right +0 -127
- data/test/data/method.cmd +0 -10
- data/test/data/method.right +0 -21
- data/test/data/methodsig.cmd +0 -10
- data/test/data/methodsig.right +0 -20
- data/test/data/noquit.right +0 -1
- data/test/data/output.cmd +0 -6
- data/test/data/output.right +0 -31
- data/test/data/pm-bug.cmd +0 -7
- data/test/data/pm-bug.right +0 -12
- data/test/data/post-mortem-next.cmd +0 -8
- data/test/data/post-mortem-next.right +0 -14
- data/test/data/post-mortem-osx.right +0 -32
- data/test/data/post-mortem.cmd +0 -13
- data/test/data/post-mortem.right +0 -32
- data/test/data/quit.cmd +0 -6
- data/test/data/quit.right +0 -9
- data/test/data/raise-jruby.right +0 -26
- data/test/data/raise.cmd +0 -11
- data/test/data/raise.right +0 -26
- data/test/data/save.cmd +0 -34
- data/test/data/save.right +0 -61
- data/test/data/setshow.cmd +0 -46
- data/test/data/setshow.right +0 -80
- data/test/data/source.cmd +0 -5
- data/test/data/source.right +0 -15
- data/test/data/stepping.cmd +0 -21
- data/test/data/stepping.right +0 -50
- data/test/data/test-init-cygwin.right +0 -7
- data/test/data/test-init-osx.right +0 -4
- data/test/data/test-init.right +0 -5
- data/test/data/trace-jruby.right +0 -14
- data/test/data/trace.right +0 -23
- data/test/example/a/example.rb +0 -1
- data/test/example/at-exit.rb +0 -3
- data/test/example/b/example.rb +0 -1
- data/test/example/bp_loop_issue.rb +0 -3
- data/test/example/breakpoints-basename.rb +0 -2
- data/test/example/brkpt-class-bug.rb +0 -8
- data/test/example/classes.rb +0 -11
- data/test/example/dollar-0.rb +0 -6
- data/test/example/except-bug1.rb +0 -4
- data/test/example/file with space.rb +0 -1
- data/test/example/gcd.rb +0 -18
- data/test/example/info-var-bug.rb +0 -47
- data/test/example/info-var-bug2.rb +0 -2
- data/test/example/null.rb +0 -1
- data/test/example/output.rb +0 -2
- data/test/example/pm-bug.rb +0 -3
- data/test/example/pm.rb +0 -11
- data/test/example/raise.rb +0 -3
- data/test/gcd-dbg-nox.rb +0 -31
- data/test/gcd-dbg.rb +0 -30
- data/test/helper.rb +0 -167
- data/test/pm-base.rb +0 -22
- data/test/rdebug-save.1 +0 -7
- data/test/tdebug.rb +0 -252
- data/test/test-annotate.rb +0 -13
- data/test/test-at-exit.rb +0 -13
- data/test/test-break-bad.rb +0 -25
- data/test/test-breakpoints.rb +0 -24
- data/test/test-brkpt-class-bug.rb +0 -13
- data/test/test-catch.rb +0 -13
- data/test/test-condition.rb +0 -13
- data/test/test-ctrl.rb +0 -55
- data/test/test-display.rb +0 -14
- data/test/test-dollar-0.rb +0 -33
- data/test/test-edit.rb +0 -14
- data/test/test-emacs-basic.rb +0 -13
- data/test/test-enable.rb +0 -13
- data/test/test-except-bug1.rb +0 -16
- data/test/test-file-with-space.rb +0 -18
- data/test/test-finish.rb +0 -22
- data/test/test-frame.rb +0 -28
- data/test/test-help.rb +0 -60
- data/test/test-hist.rb +0 -64
- data/test/test-info-thread.rb +0 -24
- data/test/test-info-var.rb +0 -30
- data/test/test-info.rb +0 -27
- data/test/test-init.rb +0 -49
- data/test/test-list.rb +0 -14
- data/test/test-method.rb +0 -20
- data/test/test-output.rb +0 -13
- data/test/test-pm.rb +0 -37
- data/test/test-quit.rb +0 -13
- data/test/test-raise.rb +0 -13
- data/test/test-save.rb +0 -22
- data/test/test-setshow.rb +0 -13
- data/test/test-source.rb +0 -13
- data/test/test-stepping.rb +0 -14
- data/test/test-trace.rb +0 -40
- data/test/thread1.rb +0 -26
- data/test/trunc-call.rb +0 -31
data/test/test-annotate.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test annotate handling.
|
5
|
-
class TestAnnotate < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname = 'annotate'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-at-exit.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test that it's possible to stop at breakpoints in an at_exit block.
|
5
|
-
class TestAtExit < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname = 'at-exit'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/at-exit.rb"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-break-bad.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test (mostly) invalid breakpoint commands
|
5
|
-
class TestBadBreak < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname = 'break_bad'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_tracelines
|
15
|
-
testname = 'break_tracelines'
|
16
|
-
script = File.join('data', testname + '.cmd')
|
17
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
18
|
-
end unless defined?(JRUBY_VERSION) # JRuby doesn't yet support tracelines
|
19
|
-
|
20
|
-
def test_break_loop
|
21
|
-
testname = 'break_loop_bug'
|
22
|
-
script = File.join('data', testname + '.cmd')
|
23
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/bp_loop_issue.rb"))
|
24
|
-
end
|
25
|
-
end
|
data/test/test-breakpoints.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test breakpoint commands
|
5
|
-
class TestBreakpoints < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='breakpoints'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_breakpoint_in_files_with_same_basename
|
15
|
-
filter = proc do |got_lines, correct_lines|
|
16
|
-
got_lines.each {|s| s.gsub!(/[^\s]*\/example\/(a|b)\/example.rb/, 'example/\1/example.rb') }
|
17
|
-
end
|
18
|
-
|
19
|
-
testname='breakpoints-basename'
|
20
|
-
script = File.join('data', testname + '.cmd')
|
21
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/#{testname}.rb",
|
22
|
-
:filter => filter))
|
23
|
-
end
|
24
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test (mostly) invalid breakpoint commands
|
5
|
-
class TestBrkptClassBug < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='brkpt-class-bug'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/brkpt-class-bug.rb"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-catch.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test condition command
|
5
|
-
class TestCatch < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='catch'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/pm.rb"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-condition.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test condition command
|
5
|
-
class TestCondition < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='condition'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-ctrl.rb
DELETED
@@ -1,55 +0,0 @@
|
|
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
|
-
$: << File.join(SRC_DIR, '..', dir)
|
11
|
-
end
|
12
|
-
require 'ruby_debug'
|
13
|
-
require File.join(SRC_DIR, '..', 'cli', 'ruby-debug')
|
14
|
-
|
15
|
-
# Test Local Control Interface
|
16
|
-
class TestCtrl < Test::Unit::TestCase
|
17
|
-
|
18
|
-
def cheap_diff(got_lines, correct_lines, outfile)
|
19
|
-
if correct_lines.size != got_lines.size
|
20
|
-
puts "Size difference #{correct_lines.size} vs. #{got_lines.size}"
|
21
|
-
File.open(outfile, 'w') {|f| f.puts got_lines}
|
22
|
-
return false
|
23
|
-
end
|
24
|
-
correct_lines.each_with_index do |line, i|
|
25
|
-
correct_lines[i].chomp!
|
26
|
-
if got_lines[i] != correct_lines[i]
|
27
|
-
puts "difference found at line #{i+1}"
|
28
|
-
puts "got : #{got_lines[i]}"
|
29
|
-
puts "need: #{correct_lines[i]}"
|
30
|
-
File.open(outfile, 'w') {|f| f.puts got_lines}
|
31
|
-
return false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
require 'stringio'
|
37
|
-
|
38
|
-
# Test initial variables and setting/getting state.
|
39
|
-
def test_ctrl
|
40
|
-
ENV['COLUMNS'] = '80'
|
41
|
-
ENV['EMACS'] = nil
|
42
|
-
testbase = 'ctrl'
|
43
|
-
out = StringIO.new('', 'w')
|
44
|
-
Dir.chdir(SRC_DIR) do
|
45
|
-
script = File.join('data', "#{testbase}.cmd")
|
46
|
-
interface = Debugger::ScriptInterface.new(script, out)
|
47
|
-
processor = Debugger::ControlCommandProcessor.new(interface)
|
48
|
-
processor.process_commands
|
49
|
-
got_lines = out.string.split("\n")
|
50
|
-
right_file = File.join('data', "#{testbase}.right")
|
51
|
-
correct_lines = File.readlines(right_file)
|
52
|
-
assert cheap_diff(got_lines, correct_lines, "#{testbase}.out")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
data/test/test-display.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test Display commands
|
5
|
-
class TestDisplay < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
# Test commands in display.rb
|
9
|
-
def test_basic
|
10
|
-
testname='display'
|
11
|
-
script = File.join('data', testname + '.cmd')
|
12
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
13
|
-
end
|
14
|
-
end
|
data/test/test-dollar-0.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test --no-stop and $0 setting.
|
5
|
-
class TestDollar0 < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
home_save = ENV['HOME']
|
10
|
-
ENV['HOME'] = '.'
|
11
|
-
filter = Proc.new{|got_lines, correct_lines|
|
12
|
-
[got_lines, correct_lines].flatten.each do |s|
|
13
|
-
s.gsub!(/.*dollar-0.rb$/, 'dollar-0.rb')
|
14
|
-
end
|
15
|
-
}
|
16
|
-
|
17
|
-
assert(run_debugger('dollar-0', '-nx --no-stop ./example/dollar-0.rb',
|
18
|
-
:filter => filter,
|
19
|
-
:runner => '../bin/rdebug'))
|
20
|
-
|
21
|
-
# Ruby's __FILE__ seems to prepend ./ when no directory was added.
|
22
|
-
assert(run_debugger('dollar-0a', '-nx --no-stop ./example/dollar-0.rb',
|
23
|
-
:filter => filter,
|
24
|
-
:runner => '../bin/rdebug'))
|
25
|
-
|
26
|
-
# Ruby's __FILE__ seems to prepend ./ when no directory was added.
|
27
|
-
assert(run_debugger('dollar-0b', '-nx --no-stop ' + File.join(%w(example dollar-0.rb)),
|
28
|
-
:filter => filter,
|
29
|
-
:runner => '../bin/rdebug'))
|
30
|
-
ensure
|
31
|
-
ENV['HOME'] = home_save
|
32
|
-
end
|
33
|
-
end
|
data/test/test-edit.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test 'edit' command handling.
|
5
|
-
class TestEdit < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='edit'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
ENV['EDITOR']='echo FAKE-EDITOR '
|
12
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
13
|
-
end
|
14
|
-
end
|
data/test/test-emacs-basic.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test the --emacs-basic option.
|
5
|
-
class TestEmacsBasic < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='emacs_basic'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--emacs-basic --script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-enable.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test enable and disable commands
|
5
|
-
class TestEnable < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='enable'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
12
|
-
end
|
13
|
-
end
|
data/test/test-except-bug1.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Bug in Post-mortem command was not being able to show
|
5
|
-
# variables on stack when stack stopped in a FIXNUM from 1/0.
|
6
|
-
class TestExceptBug1 < Test::Unit::TestCase
|
7
|
-
include TestHelper
|
8
|
-
|
9
|
-
# Test post-mortem handling
|
10
|
-
def test_pm_except_bug
|
11
|
-
ENV['COLUMNS'] = '80'
|
12
|
-
testname='except-bug1'
|
13
|
-
script = File.join('data', testname + '.cmd')
|
14
|
-
assert(run_debugger(testname, "--script #{script} --post-mortem ./example/#{testname}.rb"))
|
15
|
-
end
|
16
|
-
end unless defined?(JRUBY_VERSION) # post-mortem not yet supported on JRuby
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test Running a program wiht an embedded space
|
5
|
-
class TestFileWithSpace < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
testname='file-with-space'
|
10
|
-
script = File.join('data', testname + '.cmd')
|
11
|
-
# filter = Proc.new{|got_lines, correct_lines|
|
12
|
-
# [got_lines[0], correct_lines[0]].each do |s|
|
13
|
-
# s.sub!(/tdebug.rb:\d+/, 'rdebug:999')
|
14
|
-
# end
|
15
|
-
# }
|
16
|
-
assert(run_debugger(testname, "--script #{script} -- './example/file with space.rb'"))
|
17
|
-
end
|
18
|
-
end
|
data/test/test-finish.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test finish command
|
5
|
-
class TestFinish < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
def test_basic
|
9
|
-
# Ruby 1.8.6 and earlier have a trace-line number bug for return
|
10
|
-
# statements.
|
11
|
-
# filter = Proc.new{|got_lines, correct_lines|
|
12
|
-
# [got_lines[31], got_lines[34]].flatten.each do |s|
|
13
|
-
# s.sub!(/gcd.rb:\d+/, 'gcd.rb:13')
|
14
|
-
# end
|
15
|
-
# got_lines[32] = 'return a'
|
16
|
-
# }
|
17
|
-
|
18
|
-
testname = 'finish'
|
19
|
-
script = File.join('data', testname + '.cmd')
|
20
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
21
|
-
end
|
22
|
-
end
|
data/test/test-frame.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test frame commands
|
5
|
-
class TestFrame < Test::Unit::TestCase
|
6
|
-
include TestHelper
|
7
|
-
|
8
|
-
# Test commands in frame.rb
|
9
|
-
def test_basic
|
10
|
-
testname='frame'
|
11
|
-
script = File.join('data', testname + '.cmd')
|
12
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5"))
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_bad_continue
|
16
|
-
# Remove absolute paths in output.
|
17
|
-
filter = Proc.new{|got_lines, correct_lines|
|
18
|
-
[got_lines, correct_lines].flatten.each do |s|
|
19
|
-
s.sub!(/in file ".*gcd.rb/, 'in file "gcd.rb')
|
20
|
-
end
|
21
|
-
}
|
22
|
-
|
23
|
-
testname='continue_bad'
|
24
|
-
script = File.join('data', testname + '.cmd')
|
25
|
-
assert(run_debugger(testname, "--script #{script} -- ./example/gcd.rb 3 5",
|
26
|
-
:filter => filter))
|
27
|
-
end unless defined?(JRUBY_VERSION) # JRuby doesn't yet support tracelines
|
28
|
-
end
|
data/test/test-help.rb
DELETED
@@ -1,60 +0,0 @@
|
|
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
|
data/test/test-hist.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require File.expand_path("../helper", __FILE__)
|
3
|
-
|
4
|
-
# Test history commands
|
5
|
-
|
6
|
-
class TestHistory < Test::Unit::TestCase
|
7
|
-
|
8
|
-
@@SRC_DIR = File.dirname(__FILE__) unless
|
9
|
-
defined?(@@SRC_DIR)
|
10
|
-
|
11
|
-
include TestHelper
|
12
|
-
|
13
|
-
unless defined?(@@FILE_HISTORY)
|
14
|
-
@@FILE_HISTORY = '.rdebug_hist'
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_basic
|
18
|
-
# FIXME: Disable for now.
|
19
|
-
assert true, 'FIXME'
|
20
|
-
return
|
21
|
-
|
22
|
-
# Set up history file to read from.
|
23
|
-
ENV['HOME']=@@SRC_DIR
|
24
|
-
ENV['RDEBUG'] = nil
|
25
|
-
|
26
|
-
debugger_commands = ['show commands',
|
27
|
-
'set history save on',
|
28
|
-
'show history',
|
29
|
-
'quit unconditionally']
|
30
|
-
debugger_output = 'test-history.out'
|
31
|
-
|
32
|
-
Dir.chdir(@@SRC_DIR) do
|
33
|
-
correct_lines = File.read(File.join('data', 'history.right')).split(/\n/)
|
34
|
-
f = File.open(@@FILE_HISTORY, 'w')
|
35
|
-
correct_lines[0.. -(debugger_commands.length+1)].each do |line|
|
36
|
-
f.puts line
|
37
|
-
end
|
38
|
-
f.close
|
39
|
-
|
40
|
-
# Now that we've set up a history file, run the debugger
|
41
|
-
# and check that it's reading that correctly.
|
42
|
-
debug_pgm=File.join(%w(.. rdbg.rb))
|
43
|
-
debugged=File.join(%w(. example gcd.rb))
|
44
|
-
IO.popen("#{debug_pgm} #{debugged} 3 5 >#{debugger_output}", 'w') do
|
45
|
-
|pipe|
|
46
|
-
debugger_commands.each do |cmd|
|
47
|
-
pipe.puts cmd
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Compare output
|
52
|
-
got_lines = File.read(@@FILE_HISTORY).split(/\n/)
|
53
|
-
if cheap_diff(got_lines, correct_lines)
|
54
|
-
assert true
|
55
|
-
FileUtils.rm(debugger_output)
|
56
|
-
FileUtils.rm(@@FILE_HISTORY)
|
57
|
-
else
|
58
|
-
assert nil, 'Output differs'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
|