ruby-debug-ide19 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'basic_test'
4
- require 'rd_test_base'
5
-
6
- class RDSteppingAndBreakpointsTest < RDTestBase
7
-
8
- include BasicTest
9
-
10
- end
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
-
5
- class RDCatchpointTest < RDTestBase
6
-
7
- def test_catchpoint_basics
8
- create_socket ['sleep 0.01', '5/0', 'sleep 0.01']
9
- run_to_line(1)
10
- send_next
11
- assert_suspension(@test_path, 2, 1)
12
- send_ruby('catch ZeroDivisionError')
13
- assert_catchpoint_set('ZeroDivisionError')
14
- send_next
15
- assert_exception(@test_path, 2, 'ZeroDivisionError')
16
- send_next
17
- end
18
-
19
- end
20
-
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
- require 'condition_test'
5
-
6
- class RDConditionTest < RDTestBase
7
-
8
- include ConditionTest
9
-
10
- end
11
-
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
-
5
- class RDEnableDisableTest < RDTestBase
6
-
7
- def test_enable_disable_basics
8
- create_socket ['1.upto(10) do', 'sleep 0.01', 'sleep 0.01', 'end']
9
-
10
- send_test_breakpoint(2)
11
- assert_breakpoint_added_no(1)
12
- send_test_breakpoint(3)
13
- assert_breakpoint_added_no(2)
14
-
15
- start_debugger
16
- assert_test_breakpoint(2)
17
- send_cont
18
- assert_test_breakpoint(3)
19
- send_cont
20
- assert_test_breakpoint(2)
21
- send_ruby('disable 2')
22
- assert_breakpoint_disabled(2)
23
- send_cont
24
- assert_test_breakpoint(2)
25
- send_cont
26
- assert_test_breakpoint(2)
27
- send_ruby('enable 2')
28
- assert_breakpoint_enabled(2)
29
- send_cont
30
- assert_test_breakpoint(3)
31
- send_cont
32
- assert_test_breakpoint(2)
33
- send_cont
34
- assert_test_breakpoint(3)
35
- send_ruby('disable 1')
36
- assert_breakpoint_disabled(1)
37
- send_ruby('disable 2')
38
- assert_breakpoint_disabled(2)
39
- send_cont
40
- end
41
-
42
- end
43
-
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
- require 'inspect_test'
5
-
6
- class RDInspectTest < RDTestBase
7
-
8
- include InspectTest
9
-
10
- end
11
-
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
- require 'stepping_breakpoints_test'
5
-
6
- class RDSteppingAndBreakpointsTest < RDTestBase
7
-
8
- include SteppingAndBreakpointsTest
9
-
10
- def test_hit_breakpoint_while_stepping_over
11
- create_test2 ["class Test2", "def print", "puts 'XX'", "puts 'XX'", "end", "end"]
12
- create_socket ["require 'test2.rb'", "Test2.new.print", "puts 'a'"]
13
- send_ruby("b #{@test2_name}:4")
14
- assert_breakpoint_added_no(1)
15
- run_to_line(2)
16
- send_next
17
- assert_breakpoint(@test2_name, 4)
18
- send_cont
19
- end
20
-
21
- def test_breakpoint_and_continue_from_other_file
22
- create_test2 ["class Test2", "def print12", "puts 'one'","puts 'two'", "end", "end"]
23
- create_socket ["require 'test2.rb'", "Test2.new.print12", "puts 'three'"]
24
- send_test_breakpoint(2)
25
- assert_breakpoint_added_no(1)
26
- send_ruby("b #{@test2_name}:4")
27
- assert_breakpoint_added_no(2)
28
- start_debugger
29
- assert_test_breakpoint(2)
30
- send_next # test:1 -> test2:4
31
- assert_breakpoint(@test2_name, 4)
32
- send_cont # test2:4 -> test:3
33
- end
34
-
35
- end
36
-
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift File.join(File.dirname(__FILE__), "..", "test-base")
4
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
-
6
- require 'test_base'
7
-
8
- class RDTestBase < TestBase
9
-
10
- def setup
11
- super
12
- @rdebug_ide = config_load('rdebug_ide', true) || find_rdebug_ide
13
- unless @rdebug_ide and File.exist?(@rdebug_ide)
14
- @fast_fail = true
15
- assert_not_nil(@rdebug_ide, "Cannot find rdebug-ide executable. " +
16
- "Neither set in the config(.private).yaml nor found on the PATH")
17
- assert(false, "#{@rdebug_ide} exist")
18
- end
19
- end
20
-
21
- def debug_command(script, port)
22
- cmd = "#{interpreter}"
23
- cmd << " --debug" if jruby?
24
- cmd << " -J-Xdebug -J-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y" if jruby? and debug_jruby?
25
- cmd << " -I '#{File.dirname(script)}' #{@rdebug_ide} _0.4.9_" +
26
- (@verbose_server ? " -d" : "") +
27
- " -p #{port} -- '#{script}'"
28
- end
29
-
30
- def start_debugger
31
- send_ruby("start")
32
- end
33
-
34
- private
35
-
36
- def find_rdebug_ide
37
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|
38
- rdebug_ide = File.join(dir, 'rdebug-ide')
39
- return rdebug_ide if File.exists?(rdebug_ide)
40
- end
41
- nil
42
- end
43
-
44
- end
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
- require 'threads_and_frames_test'
5
-
6
- class RDThreadsAndFrames < RDTestBase
7
-
8
- include ThreadsAndFrames
9
-
10
- end
11
-
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rd_test_base'
4
- require 'variables_test'
5
-
6
- class RDVariablesTest < RDTestBase
7
-
8
- include VariablesTest
9
-
10
- end
11
-
@@ -1,105 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),'..','lib')
2
-
3
- require 'test/unit'
4
- require 'ruby-debug'
5
-
6
- class XmlPrinterTest < Test::Unit::TestCase
7
-
8
- def teardown
9
- Debugger.xml_debug = false
10
- end
11
-
12
- def test_print_msg
13
- interface = MockInterface.new
14
- printer = Debugger::XmlPrinter.new(interface)
15
- printer.print_msg('%s test', 'message')
16
- assert_equal(['<message>message test</message>'], interface.data)
17
- end
18
-
19
- def test_print_msg_with_debug
20
- Debugger.xml_debug = true
21
- interface = MockInterface.new
22
- printer = Debugger::XmlPrinter.new(interface)
23
- printer.print_msg('%s test', 'message')
24
- expected = ["<message>message test</message>"]
25
- assert_equal(expected, interface.data)
26
- end
27
-
28
- def test_print_debug
29
- Debugger.xml_debug = true
30
- interface = MockInterface.new
31
- printer = Debugger::XmlPrinter.new(interface)
32
- printer.print_debug('%s test', 'debug message 1')
33
- printer.print_debug('%s test', 'debug message 2')
34
- expected = [
35
- "<message debug='true'>debug message 1 test</message>",
36
- "<message debug='true'>debug message 2 test</message>"]
37
- assert_equal(expected, interface.data)
38
- end
39
-
40
- def test_print_frames
41
- interface = MockInterface.new
42
- printer = Debugger::XmlPrinter.new(interface)
43
- Debugger.start
44
- begin
45
- context = MockContext.new(2)
46
- printer.print_frames(context, 0)
47
- ensure
48
- Debugger.stop
49
- end
50
- test_path = File.join(Dir.pwd, 'test.rb')
51
- expected = [
52
- "<frames>",
53
- "<frame no='1' file='#{test_path}' line='0' current='true' />",
54
- "<frame no='2' file='#{test_path}' line='10' />",
55
- "</frames>"]
56
- assert_equal(expected, interface.data)
57
- end
58
-
59
- def test_print_at_line
60
- interface = MockInterface.new
61
- printer = Debugger::XmlPrinter.new(interface)
62
- Debugger.start
63
- begin
64
- printer.print_at_line(Debugger.current_context, 'test.rb', 1)
65
- ensure
66
- Debugger.stop
67
- end
68
- test_path = File.join(Dir.pwd, 'test.rb')
69
- expected = ["<suspended file='#{test_path}' line='1' threadId='1' frames='2'/>"]
70
- assert_equal(expected, interface.data)
71
- end
72
-
73
- class MockContext < Debugger::Context
74
-
75
- attr_accessor :stack_size
76
-
77
- def initialize(stack_size)
78
- @stack_size = stack_size
79
- end
80
-
81
- def frame_file(id)
82
- "test.rb"
83
- end
84
-
85
- def frame_line(id)
86
- id * 10
87
- end
88
-
89
- end
90
-
91
- class MockInterface
92
-
93
- attr_accessor :data
94
-
95
- def initialize
96
- @data = []
97
- end
98
-
99
- def print(*args)
100
- @data << format(*args)
101
- end
102
-
103
- end
104
-
105
- end