ruby-prof 0.16.2 → 0.17.0
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.
- checksums.yaml +4 -4
- data/CHANGES +15 -0
- data/README.rdoc +36 -5
- data/bin/ruby-prof +7 -2
- data/doc/LICENSE.html +2 -1
- data/doc/README_rdoc.html +42 -8
- data/doc/Rack.html +2 -1
- data/doc/Rack/RubyProf.html +25 -18
- data/doc/Rack/RubyProf/RackProfiler.html +343 -0
- data/doc/RubyProf.html +14 -2
- data/doc/RubyProf/AbstractPrinter.html +91 -12
- data/doc/RubyProf/AggregateCallInfo.html +2 -1
- data/doc/RubyProf/CallInfo.html +18 -78
- data/doc/RubyProf/CallInfoPrinter.html +2 -1
- data/doc/RubyProf/CallInfoVisitor.html +2 -1
- data/doc/RubyProf/CallStackPrinter.html +35 -29
- data/doc/RubyProf/CallTreePrinter.html +98 -14
- data/doc/RubyProf/Cmd.html +11 -5
- data/doc/RubyProf/DeprecationWarnings.html +148 -0
- data/doc/RubyProf/DotPrinter.html +2 -1
- data/doc/RubyProf/FlatPrinter.html +2 -1
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +7 -5
- data/doc/RubyProf/GraphHtmlPrinter.html +18 -12
- data/doc/RubyProf/GraphPrinter.html +2 -1
- data/doc/RubyProf/MethodInfo.html +19 -88
- data/doc/RubyProf/MultiPrinter.html +231 -17
- data/doc/RubyProf/Profile.html +184 -39
- data/doc/RubyProf/Profile/ExcludeCommonMethods.html +411 -0
- data/doc/RubyProf/Profile/LegacyMethodElimination.html +158 -0
- data/doc/RubyProf/ProfileTask.html +2 -1
- data/doc/RubyProf/Thread.html +4 -39
- data/doc/created.rid +21 -19
- data/doc/css/fonts.css +6 -6
- data/doc/examples/flat_txt.html +2 -1
- data/doc/examples/graph_html.html +2 -1
- data/doc/examples/graph_txt.html +2 -1
- data/doc/index.html +47 -7
- data/doc/js/darkfish.js +7 -7
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +1 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +190 -80
- data/ext/ruby_prof/extconf.rb +4 -0
- data/ext/ruby_prof/rp_call_info.c +19 -1
- data/ext/ruby_prof/rp_call_info.h +8 -3
- data/ext/ruby_prof/rp_method.c +282 -57
- data/ext/ruby_prof/rp_method.h +28 -5
- data/ext/ruby_prof/rp_stack.c +69 -24
- data/ext/ruby_prof/rp_stack.h +21 -9
- data/ext/ruby_prof/rp_thread.c +4 -1
- data/ext/ruby_prof/ruby_prof.c +142 -39
- data/ext/ruby_prof/ruby_prof.h +3 -0
- data/lib/ruby-prof.rb +10 -0
- data/lib/ruby-prof/call_info.rb +0 -11
- data/lib/ruby-prof/method_info.rb +4 -12
- data/lib/ruby-prof/printers/abstract_printer.rb +19 -1
- data/lib/ruby-prof/printers/call_info_printer.rb +1 -1
- data/lib/ruby-prof/printers/call_stack_printer.rb +9 -4
- data/lib/ruby-prof/printers/call_tree_printer.rb +15 -2
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +23 -4
- data/lib/ruby-prof/printers/graph_html_printer.rb +10 -5
- data/lib/ruby-prof/printers/graph_printer.rb +2 -2
- data/lib/ruby-prof/printers/multi_printer.rb +44 -18
- data/lib/ruby-prof/profile.rb +13 -42
- data/lib/ruby-prof/profile/exclude_common_methods.rb +201 -0
- data/lib/ruby-prof/profile/legacy_method_elimination.rb +49 -0
- data/lib/ruby-prof/rack.rb +130 -51
- data/lib/ruby-prof/thread.rb +0 -6
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +4 -3
- data/test/aggregate_test.rb +1 -1
- data/test/exclude_methods_test.rb +146 -0
- data/test/line_number_test.rb +12 -3
- data/test/multi_printer_test.rb +23 -2
- data/test/no_method_class_test.rb +1 -1
- data/test/printers_test.rb +21 -1
- data/test/rack_test.rb +64 -0
- data/test/recursive_test.rb +15 -15
- data/test/test_helper.rb +11 -0
- metadata +20 -13
data/lib/ruby-prof/thread.rb
CHANGED
@@ -10,12 +10,6 @@ module RubyProf
|
|
10
10
|
top_methods.map(&:call_infos).flatten.select(&:root?)
|
11
11
|
end
|
12
12
|
|
13
|
-
# This method detect recursive calls in the call tree of a given thread
|
14
|
-
# It should be called only once for each thread
|
15
|
-
def detect_recursion
|
16
|
-
top_call_infos.each(&:detect_recursion)
|
17
|
-
end
|
18
|
-
|
19
13
|
def total_time
|
20
14
|
self.top_methods.inject(0) do |sum, method_info|
|
21
15
|
method_info.call_infos.each do |call_info|
|
data/lib/ruby-prof/version.rb
CHANGED
data/ruby-prof.gemspec
CHANGED
@@ -44,6 +44,7 @@ EOF
|
|
44
44
|
'lib/unprof.rb',
|
45
45
|
'lib/ruby-prof/*.rb',
|
46
46
|
'lib/ruby-prof/assets/*.{html,png}',
|
47
|
+
'lib/ruby-prof/profile/*.rb',
|
47
48
|
'lib/ruby-prof/printers/*.rb',
|
48
49
|
'test/*.rb']
|
49
50
|
|
@@ -51,7 +52,7 @@ EOF
|
|
51
52
|
spec.required_ruby_version = '>= 1.9.3'
|
52
53
|
spec.date = Time.now.strftime('%Y-%m-%d')
|
53
54
|
spec.homepage = 'https://github.com/ruby-prof/ruby-prof'
|
54
|
-
spec.add_development_dependency('minitest', '~> 5.
|
55
|
-
spec.add_development_dependency('rake-compiler')
|
56
|
-
spec.add_development_dependency('rdoc')
|
55
|
+
spec.add_development_dependency('minitest', '~> 5.0')
|
56
|
+
spec.add_development_dependency('rake-compiler', '~> 1.0')
|
57
|
+
spec.add_development_dependency('rdoc', '~> 5.0')
|
57
58
|
end
|
data/test/aggregate_test.rb
CHANGED
@@ -0,0 +1,146 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require File.expand_path('../test_helper', __FILE__)
|
5
|
+
|
6
|
+
module ExcludeMethodsModule
|
7
|
+
def c
|
8
|
+
1.times { |i| ExcludeMethodsModule.d }
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.d
|
12
|
+
1.times { |i| ExcludeMethodsClass.e }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class ExcludeMethodsClass
|
17
|
+
include ExcludeMethodsModule
|
18
|
+
|
19
|
+
def a
|
20
|
+
1.times { |i| b }
|
21
|
+
end
|
22
|
+
|
23
|
+
def b
|
24
|
+
1.times { |i| c; self.class.e }
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.e
|
28
|
+
1.times { |i| f }
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.f
|
32
|
+
sleep 0.1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class ExcludeMethodsTest < TestCase
|
37
|
+
def setup
|
38
|
+
# Need to use wall time for this test due to the sleep calls
|
39
|
+
RubyProf::measure_mode = RubyProf::WALL_TIME
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_methods_can_be_profiled
|
43
|
+
obj = ExcludeMethodsClass.new
|
44
|
+
prf = RubyProf::Profile.new
|
45
|
+
|
46
|
+
result = prf.profile { 5.times {obj.a} }
|
47
|
+
methods = result.threads.first.methods.sort.reverse
|
48
|
+
|
49
|
+
assert_equal(10, methods.count)
|
50
|
+
assert_equal('ExcludeMethodsTest#test_methods_can_be_profiled', methods[0].full_name)
|
51
|
+
assert_equal('Integer#times', methods[1].full_name)
|
52
|
+
assert_equal('ExcludeMethodsClass#a', methods[2].full_name)
|
53
|
+
assert_equal('ExcludeMethodsClass#b', methods[3].full_name)
|
54
|
+
assert_equal('<Class::ExcludeMethodsClass>#e', methods[4].full_name)
|
55
|
+
assert_equal('<Class::ExcludeMethodsClass>#f', methods[5].full_name)
|
56
|
+
assert_equal('Kernel#sleep', methods[6].full_name)
|
57
|
+
assert_equal('ExcludeMethodsModule#c', methods[7].full_name)
|
58
|
+
assert_equal('<Module::ExcludeMethodsModule>#d', methods[8].full_name)
|
59
|
+
assert_equal('Kernel#class', methods[9].full_name)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_methods_can_be_hidden1
|
63
|
+
obj = ExcludeMethodsClass.new
|
64
|
+
prf = RubyProf::Profile.new
|
65
|
+
|
66
|
+
prf.exclude_methods!(Integer, :times)
|
67
|
+
|
68
|
+
result = prf.profile { 5.times {obj.a} }
|
69
|
+
methods = result.threads.first.methods.sort.reverse
|
70
|
+
|
71
|
+
assert_equal(9, methods.count)
|
72
|
+
assert_equal('ExcludeMethodsTest#test_methods_can_be_hidden1', methods[0].full_name)
|
73
|
+
assert_equal('ExcludeMethodsClass#a', methods[1].full_name)
|
74
|
+
assert_equal('ExcludeMethodsClass#b', methods[2].full_name)
|
75
|
+
assert_equal('<Class::ExcludeMethodsClass>#e', methods[3].full_name)
|
76
|
+
assert_equal('<Class::ExcludeMethodsClass>#f', methods[4].full_name)
|
77
|
+
assert_equal('Kernel#sleep', methods[5].full_name)
|
78
|
+
assert_equal('ExcludeMethodsModule#c', methods[6].full_name)
|
79
|
+
assert_equal('<Module::ExcludeMethodsModule>#d', methods[7].full_name)
|
80
|
+
assert_equal('Kernel#class', methods[8].full_name)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_methods_can_be_hidden2
|
84
|
+
obj = ExcludeMethodsClass.new
|
85
|
+
prf = RubyProf::Profile.new
|
86
|
+
|
87
|
+
prf.exclude_methods!(Integer, :times)
|
88
|
+
prf.exclude_methods!(ExcludeMethodsClass.singleton_class, :f)
|
89
|
+
prf.exclude_methods!(ExcludeMethodsModule.singleton_class, :d)
|
90
|
+
|
91
|
+
result = prf.profile { 5.times {obj.a} }
|
92
|
+
methods = result.threads.first.methods.sort.reverse
|
93
|
+
|
94
|
+
assert_equal(7, methods.count)
|
95
|
+
assert_equal('ExcludeMethodsTest#test_methods_can_be_hidden2', methods[0].full_name)
|
96
|
+
assert_equal('ExcludeMethodsClass#a', methods[1].full_name)
|
97
|
+
assert_equal('ExcludeMethodsClass#b', methods[2].full_name)
|
98
|
+
assert_equal('<Class::ExcludeMethodsClass>#e', methods[3].full_name)
|
99
|
+
assert_equal('Kernel#sleep', methods[4].full_name)
|
100
|
+
assert_equal('ExcludeMethodsModule#c', methods[5].full_name)
|
101
|
+
assert_equal('Kernel#class', methods[6].full_name)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_exclude_common_methods1
|
105
|
+
obj = ExcludeMethodsClass.new
|
106
|
+
prf = RubyProf::Profile.new
|
107
|
+
|
108
|
+
prf.exclude_common_methods!
|
109
|
+
|
110
|
+
result = prf.profile { 5.times {obj.a} }
|
111
|
+
methods = result.threads.first.methods.sort.reverse
|
112
|
+
|
113
|
+
assert_equal(9, methods.count)
|
114
|
+
assert_equal('ExcludeMethodsTest#test_exclude_common_methods1', methods[0].full_name)
|
115
|
+
assert_equal('ExcludeMethodsClass#a', methods[1].full_name)
|
116
|
+
assert_equal('ExcludeMethodsClass#b', methods[2].full_name)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_exclude_common_methods2
|
120
|
+
obj = ExcludeMethodsClass.new
|
121
|
+
|
122
|
+
result = RubyProf.profile(exclude_common: true) { 5.times {obj.a} }
|
123
|
+
methods = result.threads.first.methods.sort.reverse
|
124
|
+
|
125
|
+
assert_equal(9, methods.count)
|
126
|
+
assert_equal('ExcludeMethodsTest#test_exclude_common_methods2', methods[0].full_name)
|
127
|
+
assert_equal('ExcludeMethodsClass#a', methods[1].full_name)
|
128
|
+
assert_equal('ExcludeMethodsClass#b', methods[2].full_name)
|
129
|
+
end
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
def assert_method_has_been_eliminated(result, eliminated_method)
|
134
|
+
result.threads.each do |thread|
|
135
|
+
thread.methods.each do |method|
|
136
|
+
method.call_infos.each do |ci|
|
137
|
+
assert(ci.target != eliminated_method, "broken self")
|
138
|
+
assert(ci.parent.target != eliminated_method, "broken parent") if ci.parent
|
139
|
+
ci.children.each do |callee|
|
140
|
+
assert(callee.target != eliminated_method, "broken kid")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/test/line_number_test.rb
CHANGED
@@ -34,7 +34,11 @@ class LineNumbersTest < TestCase
|
|
34
34
|
|
35
35
|
method = methods[1]
|
36
36
|
assert_equal('LineNumbers#method2', method.full_name)
|
37
|
-
|
37
|
+
if RUBY_VERSION < "2.5"
|
38
|
+
assert_equal(10, method.line)
|
39
|
+
else
|
40
|
+
assert_equal(11, method.line)
|
41
|
+
end
|
38
42
|
|
39
43
|
method = methods[2]
|
40
44
|
assert_equal('LineNumbers#method1', method.full_name)
|
@@ -62,10 +66,15 @@ class LineNumbersTest < TestCase
|
|
62
66
|
|
63
67
|
method = methods[1]
|
64
68
|
assert_equal('LineNumbers#method3', method.full_name)
|
65
|
-
|
69
|
+
if RUBY_VERSION < "2.5"
|
70
|
+
assert_equal(14, method.line)
|
71
|
+
else
|
72
|
+
assert_equal(15, method.line)
|
73
|
+
end
|
66
74
|
|
67
75
|
method = methods[2]
|
68
76
|
assert_equal('LineNumbersTest#test_c_function', method.full_name)
|
69
|
-
assert_equal(
|
77
|
+
assert_equal(52, method.line)
|
70
78
|
end
|
79
|
+
|
71
80
|
end
|
data/test/multi_printer_test.rb
CHANGED
@@ -32,6 +32,28 @@ class MultiPrinterTest < TestCase
|
|
32
32
|
RubyProf::measure_mode = RubyProf::WALL_TIME
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_refuses_io_objects
|
36
|
+
# we don't need a real profile for this test
|
37
|
+
p = RubyProf::MultiPrinter.new nil
|
38
|
+
begin
|
39
|
+
p.print(STDOUT)
|
40
|
+
flunk "should have raised an ArgumentError"
|
41
|
+
rescue ArgumentError => e
|
42
|
+
assert_match(/IO/, e.to_s)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_refuses_non_hashes
|
47
|
+
# we don't need a real profile for this test
|
48
|
+
p = RubyProf::MultiPrinter.new nil
|
49
|
+
begin
|
50
|
+
p.print([])
|
51
|
+
flunk "should have raised an ArgumentError"
|
52
|
+
rescue ArgumentError => e
|
53
|
+
assert_match(/hash/, e.to_s)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
35
57
|
def test_all_profiles_can_be_created
|
36
58
|
start_time = Time.now
|
37
59
|
RubyProf.start
|
@@ -39,8 +61,7 @@ class MultiPrinterTest < TestCase
|
|
39
61
|
result = RubyProf.stop
|
40
62
|
end_time = Time.now
|
41
63
|
expected_time = end_time - start_time
|
42
|
-
|
43
|
-
assert_nothing_raised { stack, graph = print(result) }
|
64
|
+
graph = print(result)[1]
|
44
65
|
re = Regexp.new('
|
45
66
|
\s*<table>
|
46
67
|
\s*<tr>
|
@@ -10,6 +10,6 @@ end
|
|
10
10
|
|
11
11
|
methods = result.threads.first.methods
|
12
12
|
global_method = methods.sort_by {|method| method.full_name}.first
|
13
|
-
if global_method.full_name != '
|
13
|
+
if global_method.full_name != 'Kernel#sleep'
|
14
14
|
raise(RuntimeError, "Wrong method name. Expected: Global#[No method]. Actual: #{global_method.full_name}")
|
15
15
|
end
|
data/test/printers_test.rb
CHANGED
@@ -63,6 +63,26 @@ class PrintersTest < TestCase
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def test_refuses_io_objects
|
67
|
+
p = RubyProf::MultiPrinter.new(@result)
|
68
|
+
begin
|
69
|
+
p.print(STDOUT)
|
70
|
+
flunk "should have raised an ArgumentError"
|
71
|
+
rescue ArgumentError => e
|
72
|
+
assert_match(/IO/, e.to_s)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_refuses_non_hashes
|
77
|
+
p = RubyProf::MultiPrinter.new (@result)
|
78
|
+
begin
|
79
|
+
p.print([])
|
80
|
+
flunk "should have raised an ArgumentError"
|
81
|
+
rescue ArgumentError => e
|
82
|
+
assert_match(/hash/, e.to_s)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
66
86
|
def test_flat_string
|
67
87
|
output = helper_test_flat_string(RubyProf::FlatPrinter)
|
68
88
|
refute_match(/prime.rb/, output)
|
@@ -120,7 +140,7 @@ class PrintersTest < TestCase
|
|
120
140
|
main_output_file_name = File.join(RubyProf.tmpdir, "lolcat.callgrind.out.#{$$}")
|
121
141
|
assert(File.exist?(main_output_file_name))
|
122
142
|
output = File.read(main_output_file_name)
|
123
|
-
assert_match(/fn=Object
|
143
|
+
assert_match(/fn=Object::find_primes/i, output)
|
124
144
|
assert_match(/events: wall_time/i, output)
|
125
145
|
refute_match(/d\d\d\d\d\d/, output) # old bug looked [in error] like Object::run_primes(d5833116)
|
126
146
|
end
|
data/test/rack_test.rb
CHANGED
@@ -24,6 +24,16 @@ module Rack
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
module Rack
|
28
|
+
class RubyProf
|
29
|
+
attr_reader :_profiler
|
30
|
+
|
31
|
+
def public_delete_profiler!
|
32
|
+
delete_profiler!
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
27
37
|
class RackTest < TestCase
|
28
38
|
def test_create_print_path
|
29
39
|
path = Dir.mktmpdir
|
@@ -90,4 +100,58 @@ class RackTest < TestCase
|
|
90
100
|
file_path = ::File.join(path, 'path-to-resource.json-dynamic.txt')
|
91
101
|
assert(File.exist?(file_path))
|
92
102
|
end
|
103
|
+
|
104
|
+
def test_works_for_multiple_requests
|
105
|
+
path = Dir.mktmpdir
|
106
|
+
|
107
|
+
adapter = Rack::RubyProf.new(FakeRackApp.new, :path => path, :max_requests => 2)
|
108
|
+
|
109
|
+
# make a 1st request, and check that this didn't create any files
|
110
|
+
adapter.call(:fake_env)
|
111
|
+
assert(Dir["#{path}/*"].empty?)
|
112
|
+
|
113
|
+
# now a second request should create all the expected files
|
114
|
+
adapter.call(:fake_env)
|
115
|
+
%w(flat.txt graph.txt graph.html call_stack.html).each do |base_name|
|
116
|
+
file_path = ::File.join(path, "multi-requests-2-#{base_name}")
|
117
|
+
assert(File.exist?(file_path))
|
118
|
+
end
|
119
|
+
|
120
|
+
# let's clean up
|
121
|
+
FileUtils.rm_rf(Dir["#{path}/*"])
|
122
|
+
|
123
|
+
# and do the same again for the next 2 requests
|
124
|
+
adapter.call(:fake_env)
|
125
|
+
assert(Dir["#{path}/*"].empty?)
|
126
|
+
|
127
|
+
adapter.call(:fake_env)
|
128
|
+
%w(flat.txt graph.txt graph.html call_stack.html).each do |base_name|
|
129
|
+
file_path = ::File.join(path, "multi-requests-2-#{base_name}")
|
130
|
+
assert(File.exist?(file_path))
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_tries_to_print_results_if_shut_down_before_max_requests_reached
|
135
|
+
path = Dir.mktmpdir
|
136
|
+
|
137
|
+
adapter = Rack::RubyProf.new(FakeRackApp.new, :path => path, :max_requests => 100)
|
138
|
+
|
139
|
+
# make a 1st request, and check that this didn't create any files
|
140
|
+
adapter.call(:fake_env)
|
141
|
+
assert(Dir["#{path}/*"].empty?)
|
142
|
+
|
143
|
+
adapter.public_delete_profiler!
|
144
|
+
|
145
|
+
%w(flat.txt graph.txt graph.html call_stack.html).each do |base_name|
|
146
|
+
file_path = ::File.join(path, "multi-requests-1-#{base_name}")
|
147
|
+
assert(File.exist?(file_path))
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_it_uses_separate_profilers_if_not_aggregating_multiple_requests
|
152
|
+
adapter1 = Rack::RubyProf.new(FakeRackApp.new)
|
153
|
+
adapter2 = Rack::RubyProf.new(FakeRackApp.new)
|
154
|
+
|
155
|
+
assert(adapter1.object_id != adapter2.object_id)
|
156
|
+
end
|
93
157
|
end
|
data/test/recursive_test.rb
CHANGED
@@ -64,7 +64,7 @@ class RecursiveTest < TestCase
|
|
64
64
|
|
65
65
|
assert_equal(1, method.call_infos.length)
|
66
66
|
call_info = method.call_infos[0]
|
67
|
-
assert(!call_info.recursive)
|
67
|
+
assert(!call_info.recursive?)
|
68
68
|
assert_equal('RecursiveTest#test_simple', call_info.call_sequence)
|
69
69
|
assert_equal(1, call_info.children.length)
|
70
70
|
|
@@ -82,12 +82,12 @@ class RecursiveTest < TestCase
|
|
82
82
|
call_info = method.call_infos.first
|
83
83
|
assert_equal(2, call_info.children.length)
|
84
84
|
assert_equal('RecursiveTest#test_simple->SimpleRecursion#simple', call_info.call_sequence)
|
85
|
-
assert(!call_info.recursive)
|
85
|
+
assert(!call_info.recursive?)
|
86
86
|
|
87
87
|
call_info = method.call_infos.last
|
88
88
|
assert_equal(1, call_info.children.length)
|
89
89
|
assert_equal('RecursiveTest#test_simple->SimpleRecursion#simple->SimpleRecursion#simple', call_info.call_sequence)
|
90
|
-
assert(call_info.recursive)
|
90
|
+
assert(call_info.recursive?)
|
91
91
|
|
92
92
|
method = methods[2]
|
93
93
|
assert_equal('Kernel#sleep', method.full_name)
|
@@ -101,12 +101,12 @@ class RecursiveTest < TestCase
|
|
101
101
|
call_info = method.call_infos[0]
|
102
102
|
assert_equal('RecursiveTest#test_simple->SimpleRecursion#simple->Kernel#sleep', call_info.call_sequence)
|
103
103
|
assert_equal(0, call_info.children.length)
|
104
|
-
assert(!call_info.recursive)
|
104
|
+
assert(!call_info.recursive?)
|
105
105
|
|
106
106
|
call_info = method.call_infos[1]
|
107
107
|
assert_equal('RecursiveTest#test_simple->SimpleRecursion#simple->SimpleRecursion#simple->Kernel#sleep', call_info.call_sequence)
|
108
108
|
assert_equal(0, call_info.children.length)
|
109
|
-
assert(!call_info.recursive)
|
109
|
+
assert(!call_info.recursive?)
|
110
110
|
end
|
111
111
|
|
112
112
|
def test_cycle
|
@@ -129,7 +129,7 @@ class RecursiveTest < TestCase
|
|
129
129
|
call_info = method.call_infos[0]
|
130
130
|
assert_equal('RecursiveTest#test_cycle', call_info.call_sequence)
|
131
131
|
assert_equal(1, call_info.children.length)
|
132
|
-
assert(!call_info.recursive)
|
132
|
+
assert(!call_info.recursive?)
|
133
133
|
|
134
134
|
method = methods[1]
|
135
135
|
assert_equal('SimpleRecursion#render', method.full_name)
|
@@ -143,7 +143,7 @@ class RecursiveTest < TestCase
|
|
143
143
|
call_info = method.call_infos[0]
|
144
144
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render', call_info.call_sequence)
|
145
145
|
assert_equal(1, call_info.children.length)
|
146
|
-
assert(!call_info.recursive)
|
146
|
+
assert(!call_info.recursive?)
|
147
147
|
|
148
148
|
method = methods[2]
|
149
149
|
assert_equal('Integer#times', method.full_name)
|
@@ -157,12 +157,12 @@ class RecursiveTest < TestCase
|
|
157
157
|
call_info = method.call_infos[0]
|
158
158
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times', call_info.call_sequence)
|
159
159
|
assert_equal(1, call_info.children.length)
|
160
|
-
assert(!call_info.recursive)
|
160
|
+
assert(!call_info.recursive?)
|
161
161
|
|
162
162
|
call_info = method.call_infos[1]
|
163
163
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial->Integer#times', call_info.call_sequence)
|
164
164
|
assert_equal(1, call_info.children.length)
|
165
|
-
assert(call_info.recursive)
|
165
|
+
assert(call_info.recursive?)
|
166
166
|
|
167
167
|
method = methods[3]
|
168
168
|
assert_equal('SimpleRecursion#render_partial', method.full_name)
|
@@ -176,17 +176,17 @@ class RecursiveTest < TestCase
|
|
176
176
|
call_info = method.call_infos[0]
|
177
177
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial', call_info.call_sequence)
|
178
178
|
assert_equal(3, call_info.children.length)
|
179
|
-
assert(!call_info.recursive)
|
179
|
+
assert(!call_info.recursive?)
|
180
180
|
|
181
181
|
call_info = method.call_infos[1]
|
182
182
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial->SimpleRecursion#render_partial', call_info.call_sequence)
|
183
183
|
assert_equal(1, call_info.children.length)
|
184
|
-
assert(call_info.recursive)
|
184
|
+
assert(call_info.recursive?)
|
185
185
|
|
186
186
|
call_info = method.call_infos[2]
|
187
187
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial->Integer#times->SimpleRecursion#render_partial', call_info.call_sequence)
|
188
188
|
assert_equal(1, call_info.children.length)
|
189
|
-
assert(call_info.recursive)
|
189
|
+
assert(call_info.recursive?)
|
190
190
|
|
191
191
|
method = methods[4]
|
192
192
|
assert_equal('Kernel#sleep', method.full_name)
|
@@ -200,16 +200,16 @@ class RecursiveTest < TestCase
|
|
200
200
|
call_info = method.call_infos[0]
|
201
201
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial->Kernel#sleep', call_info.call_sequence)
|
202
202
|
assert_equal(0, call_info.children.length)
|
203
|
-
assert(!call_info.recursive)
|
203
|
+
assert(!call_info.recursive?)
|
204
204
|
|
205
205
|
call_info = method.call_infos[1]
|
206
206
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial->SimpleRecursion#render_partial->Kernel#sleep', call_info.call_sequence)
|
207
207
|
assert_equal(0, call_info.children.length)
|
208
|
-
assert(!call_info.recursive)
|
208
|
+
assert(!call_info.recursive?)
|
209
209
|
|
210
210
|
call_info = method.call_infos[2]
|
211
211
|
assert_equal('RecursiveTest#test_cycle->SimpleRecursion#render->Integer#times->SimpleRecursion#render_partial->Integer#times->SimpleRecursion#render_partial->Kernel#sleep', call_info.call_sequence)
|
212
212
|
assert_equal(0, call_info.children.length)
|
213
|
-
assert(!call_info.recursive)
|
213
|
+
assert(!call_info.recursive?)
|
214
214
|
end
|
215
215
|
end
|