trace-util-adv 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO.txt +18 -2
- data/VERSION +1 -1
- data/lib/appenders/appender.rb +1 -1
- data/lib/appenders/base_appender.rb +18 -20
- data/lib/appenders/include.rb +2 -2
- data/lib/appenders/types/html_appender.rb +1 -1
- data/lib/appenders/types/logger_appender.rb +1 -1
- data/lib/appenders/types/xml_appender.rb +1 -1
- data/lib/extensions/hash_extensions.rb +41 -19
- data/lib/extensions/hash_rule_extensions.rb +4 -0
- data/lib/extensions/symbol_extensions.rb +7 -5
- data/lib/filters/composite/composite_class_filter.rb +1 -0
- data/lib/filters/composite/composite_module_filter.rb +1 -0
- data/lib/filters/executor/filter_exec.rb +6 -2
- data/lib/filters/filter.rb +12 -17
- data/lib/filters/filter_factory.rb +1 -1
- data/lib/filters/filter_mappings.rb +4 -2
- data/lib/filters/include.rb +4 -8
- data/lib/filters/list/list_instance_var_filter.rb +1 -0
- data/lib/filters/name_filter.rb +13 -0
- data/lib/filters/simple/argument_filter.rb +2 -1
- data/lib/filters/simple/class_filter.rb +1 -1
- data/lib/filters/simple/instance_var_filter.rb +9 -6
- data/lib/filters/simple/method_filter.rb +1 -0
- data/lib/filters/simple/module_filter.rb +6 -3
- data/lib/rules/rule_match.rb +5 -4
- data/lib/targets/file_target.rb +11 -0
- data/lib/templates/base_template.rb +11 -12
- data/lib/templates/html_template.rb +35 -36
- data/lib/templates/string_template.rb +0 -1
- data/lib/templates/template_mappings.rb +4 -4
- data/lib/templates/xml_template.rb +0 -1
- data/lib/trace-util-adv.rb +36 -20
- data/lib/trace_calls/trace_ext.rb +4 -17
- data/test/action_handler/include.rb +4 -0
- data/test/action_handler/test_action_handler.rb +1 -2
- data/test/action_handler/test_create_action_handler.rb +6 -9
- data/test/appenders/include.rb +4 -0
- data/test/appenders/test_appender_templates.rb +57 -0
- data/test/appenders/test_create_appender.rb +9 -10
- data/test/extensions/include.rb +4 -0
- data/test/extensions/test_filters_creation.rb +4 -28
- data/test/extensions/test_hash_extensions.rb +44 -47
- data/test/extensions/test_hash_filter_extensions.rb +46 -29
- data/test/extensions/test_set_context.rb +9 -11
- data/test/extensions/test_string_extensions.rb +1 -3
- data/test/extensions/test_symbol_extensions.rb +2 -4
- data/test/filters/chain/test_filters_chain.rb +1 -51
- data/test/filters/composite/test_composite_class_filter.rb +1 -3
- data/test/filters/composite/test_composite_module_filter.rb +1 -3
- data/test/filters/composite/test_composite_var_filter.rb +8 -11
- data/test/filters/executor/test_filter_exec.rb +1 -3
- data/test/filters/include.rb +8 -0
- data/test/filters/msg_context/test_custom_filters.rb +13 -14
- data/test/filters/simple/test_base_filter.rb +8 -6
- data/test/filters/simple/test_class_filter.rb +1 -3
- data/test/filters/simple/test_instancevar_filter.rb +5 -9
- data/test/filters/simple/test_method_filter.rb +4 -9
- data/test/filters/simple/test_module_filter.rb +13 -10
- data/test/samples/sample_composite_filters.rb +15 -12
- data/test/targets/test_create_targets.rb +21 -0
- data/test/templates/include.rb +4 -0
- data/test/templates/test_create_templates.rb +23 -0
- data/test/templates/test_exec_templates.rb +6 -0
- data/test/trace_calls/include.rb +4 -0
- data/test/trace_calls/test_configure_.rb +17 -14
- data/test/trace_calls/tracing/test_html_tracing.rb +2 -3
- data/test/trace_calls/tracing/test_logger_tracing.rb +5 -4
- data/test/trace_calls/tracing/test_stream_tracing.rb +2 -3
- data/test/trace_calls/tracing/test_teamplate_log_tracing.rb +2 -3
- data/test/trace_calls/tracing/test_xml_tracing.rb +2 -3
- data/trace-util-adv.gemspec +14 -6
- metadata +13 -5
- data/test/appenders/test_appender_tracers.rb +0 -56
- data/test/tracers/test_create_tracers.rb +0 -46
- data/test/tracers/test_exec_tracers.rb +0 -11
@@ -0,0 +1,57 @@
|
|
1
|
+
require "include"
|
2
|
+
|
3
|
+
|
4
|
+
class TestAppenderTemplates < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
# Trace filters
|
8
|
+
im_filter_1 = {:i_method_filter => "a,b"}
|
9
|
+
xym_class_1 = {:xy_class_filter => "C,D"}
|
10
|
+
@filters = [im_filter_1, xym_class_1]
|
11
|
+
|
12
|
+
@app_filter_1 = {:x_class_filter => "Dryml"}
|
13
|
+
@app_filter_2 = {:i_class_filter => "Template"}
|
14
|
+
|
15
|
+
@xml_tracer = {:type => :xml, :to_file => 'log_files/xml/traced.xml'}.template
|
16
|
+
|
17
|
+
puts "xmltracer: #{@xml_tracer.inspect}"
|
18
|
+
|
19
|
+
# @html_tracer = {:type => :html, :default_path => 'log_files/html/'}.template
|
20
|
+
# @log_tracer = {:type => :log}.template
|
21
|
+
# @stream_tracer = {:type => :stream}.template
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def test_appender_register_tracer
|
26
|
+
# Trace configuration
|
27
|
+
|
28
|
+
appender_1 = {:template => @xml_tracer}.appender
|
29
|
+
assert_equal Tracing::XmlAppender, appender_1.class, "Should create instance of XmlAppender"
|
30
|
+
|
31
|
+
# appender_2 = {:template => @html_tracer}.appender
|
32
|
+
# assert_equal Tracing::HtmlAppender, appender_2.class, "Should create instance of HtmlAppender"
|
33
|
+
#
|
34
|
+
# appender_3 = {:template => @log_tracer}.appender
|
35
|
+
# assert_equal Tracing::HtmlAppender, appender_3.class, "Should create instance of LogAppender"
|
36
|
+
#
|
37
|
+
# appender_4 = {:template => @stream_tracer}.appender
|
38
|
+
# assert_equal Tracing::StreamAppender, appender_4.class, "Should create instance of StreamAppender"
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def test_appender_register_tracer_and_filters
|
43
|
+
# Trace configuration
|
44
|
+
# appender_1 = {:template => @xml_tracer, :filters => @app_filter_1}.appender
|
45
|
+
# assert_equal Tracing::XmlAppender, appender_1.class, "Should create instance of XmlAppender"
|
46
|
+
|
47
|
+
# appender_2 = {:template => @html_tracer, :filters => @app_filter_1}.appender
|
48
|
+
# assert_equal Tracing::HtmlAppender, appender_2.class, "Should create instance of HtmlAppender"
|
49
|
+
#
|
50
|
+
# appender_3 = {:template => @log_tracer, :filters => @app_filter_1}.appender
|
51
|
+
# assert_equal Tracing::HtmlAppender, appender_3.class, "Should create instance of LogAppender"
|
52
|
+
#
|
53
|
+
# appender_4 = {:template => @stream_tracer, :filters => @app_filter_1}.appender
|
54
|
+
# assert_equal Tracing::StreamAppender, appender_4.class, "Should create instance of Streamppender"
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -1,33 +1,32 @@
|
|
1
|
-
require
|
2
|
-
require "test/unit"
|
1
|
+
require "include"
|
3
2
|
|
4
3
|
|
5
4
|
class TestAppenderTracers < Test::Unit::TestCase
|
6
5
|
|
7
6
|
def test_exec_xml_tracer
|
8
|
-
xml_tracer = {:type => :xml, :to_file => 'log_files/xml/traced.xml'}.
|
9
|
-
assert_equal Tracing::XmlAppender, xml_tracer.class, "Should create instance of
|
7
|
+
xml_tracer = {:type => :xml, :to_file => 'log_files/xml/traced.xml'}.appender
|
8
|
+
assert_equal Tracing::XmlAppender, xml_tracer.class, "Should create instance of XmlAppender"
|
10
9
|
|
11
10
|
xml_tracer.trace('hello world')
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_exec_html_tracer
|
15
|
-
html_tracer = {:type => :html, :default_path => 'log_files/html'}.
|
16
|
-
assert_equal Tracing::HtmlAppender, html_tracer.class, "Should create instance of
|
14
|
+
html_tracer = {:type => :html, :default_path => 'log_files/html'}.appender
|
15
|
+
assert_equal Tracing::HtmlAppender, html_tracer.class, "Should create instance of HtmlAppender"
|
17
16
|
|
18
17
|
html_tracer.trace('hello world')
|
19
18
|
end
|
20
19
|
|
21
20
|
def test_exec_log_tracer
|
22
|
-
log_tracer = {:type => :log, :default_path => 'log_files'}.
|
23
|
-
assert_equal Tracing::LoggerAppender, log_tracer.class, "Should create instance of
|
21
|
+
log_tracer = {:type => :log, :default_path => 'log_files'}.appender
|
22
|
+
assert_equal Tracing::LoggerAppender, log_tracer.class, "Should create instance of LogAppender"
|
24
23
|
|
25
24
|
log_tracer.trace('hello world')
|
26
25
|
end
|
27
26
|
|
28
27
|
def test_exec_log_tracer
|
29
|
-
appender = {:type => :stream, :stream => :STDOUT}.
|
30
|
-
assert_equal Tracing::StreamAppender, log_tracer.class, "Should create instance of
|
28
|
+
appender = {:type => :stream, :stream => :STDOUT}.appender
|
29
|
+
assert_equal Tracing::StreamAppender, log_tracer.class, "Should create instance of StreamAppender"
|
31
30
|
|
32
31
|
stream_tracer.trace('hello world')
|
33
32
|
end
|
@@ -1,36 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require 'filters/base_filters'
|
3
|
-
require 'rules/hash_rule_extensions'
|
4
|
-
require "test/unit"
|
5
|
-
|
1
|
+
require "include"
|
6
2
|
|
7
3
|
class TestFiltersCreation < Test::Unit::TestCase
|
8
4
|
|
9
5
|
def test_try_create_method_include_filter
|
10
6
|
hash = {:i_method_filter => 'a,b'}
|
11
|
-
|
12
|
-
expected =
|
13
|
-
|
14
|
-
assert_equal expected, filter_hash, "Should create method include filter"
|
7
|
+
imethod_filter = hash.create_filter
|
8
|
+
expected = Tracing::MethodFilter
|
9
|
+
assert_equal expected, imethod_filter.class, "Should create method include filter"
|
15
10
|
end
|
16
11
|
|
17
|
-
def test_filters_creation
|
18
|
-
# config = {:filters => []}
|
19
|
-
# result = config.filters
|
20
|
-
# assert_equal result.blank?, true, "Should result in empty filters list"
|
21
|
-
|
22
|
-
im_filter = {:i_method_filter => "a,b"}
|
23
|
-
config = {:filters => im_filter}
|
24
|
-
|
25
|
-
res = im_filter.filters
|
26
|
-
puts "res: #{res.inspect}"
|
27
|
-
|
28
|
-
result = config.filters
|
29
|
-
puts "result: #{result.inspect}"
|
30
|
-
# assert_equal Tracing::MethodFilter, result.class, "Should result in method filter"
|
31
|
-
|
32
|
-
# puts "rules: #{result.rules.inspect}"
|
33
|
-
# expected = {:method_filter => {:include => "a, b"} }
|
34
|
-
# assert_equal expected, result.rules, "Should result in method rules"
|
35
|
-
end
|
36
12
|
end
|
@@ -1,8 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require 'filters/base_filters'
|
3
|
-
require 'rules/hash_rule_extensions'
|
4
|
-
require "test/unit"
|
5
|
-
|
1
|
+
require "include"
|
6
2
|
|
7
3
|
class TestHashExtensions < Test::Unit::TestCase
|
8
4
|
|
@@ -20,39 +16,39 @@ class TestHashExtensions < Test::Unit::TestCase
|
|
20
16
|
result = mapper.map(:w)
|
21
17
|
assert_equal result, 3, ":w Should result in default 3"
|
22
18
|
end
|
23
|
-
|
19
|
+
|
24
20
|
def test_method_full_name
|
25
21
|
my_instance_variables = {:template_path => 'taglibs/rapid_core.dryml'}
|
26
|
-
|
27
|
-
context
|
22
|
+
context = {:class_name => "Alpha::Beta::Gamma", :method_name => "meth_a", :vars => [my_instance_variables], :args => {:a => 7} }.context
|
23
|
+
puts context
|
28
24
|
result = context.full_method_name
|
29
25
|
assert_equal result, 'Alpha::Beta::Gamma.meth_a', "Should result in 'Alpha::Beta::Gamma.meth_a'"
|
30
26
|
end
|
31
|
-
|
27
|
+
|
32
28
|
def test_rules_allow_action_include
|
33
29
|
rule = {:include => ['a']}
|
34
30
|
result = rule.rules_allow_action('a')
|
35
31
|
assert_equal result, :include, "Should include a"
|
36
32
|
end
|
37
|
-
|
33
|
+
|
38
34
|
def test_rules_allow_action_yield
|
39
35
|
rule = {:include => ['a']}
|
40
36
|
result = rule.rules_allow_action('b')
|
41
37
|
assert_equal result, :yield, "Should yield a"
|
42
38
|
end
|
43
|
-
|
39
|
+
|
44
40
|
def test_rules_allow_action_exclude
|
45
41
|
rule = {:exclude => ['a']}
|
46
42
|
result = rule.rules_allow_action('a')
|
47
43
|
assert_equal result, :exclude, "Should exclude a"
|
48
44
|
end
|
49
|
-
|
45
|
+
|
50
46
|
def test_rules_allow_action_exclude_and_yield
|
51
47
|
rule = {:exclude_and_yield => ['a']}
|
52
48
|
result = rule.rules_allow_action('a')
|
53
49
|
assert_equal result, :exclude_and_yield, "Should exclude_an_yield a"
|
54
50
|
end
|
55
|
-
|
51
|
+
|
56
52
|
# TODO
|
57
53
|
# rule_allow_action(name) NEEDS MAJOR CLEANUP AND REFACTOR!!!
|
58
54
|
def test_rules_allow_action_include_and_yield
|
@@ -60,80 +56,80 @@ class TestHashExtensions < Test::Unit::TestCase
|
|
60
56
|
result = rule.rules_allow_action('a')
|
61
57
|
assert_equal result, :include_and_yield, "Should include_an_yield a"
|
62
58
|
end
|
63
|
-
|
59
|
+
|
64
60
|
def test_rule_list
|
65
61
|
rules = ['a']
|
66
62
|
result = rules.rule_list
|
67
63
|
assert_equal result, rules, "Should not change rule"
|
68
|
-
|
64
|
+
|
69
65
|
rules = ['a', 'b']
|
70
66
|
result = rules.rule_list
|
71
67
|
assert_equal result, rules, "Should not change rules"
|
72
|
-
|
68
|
+
|
73
69
|
rules = "a b"
|
74
70
|
result = rules.rule_list
|
75
71
|
assert_equal result, ['a', 'b'], "Should split rules"
|
76
72
|
end
|
77
|
-
|
73
|
+
|
78
74
|
# return a symbol, either - :include, :exclude or :yield (let next filter decide)
|
79
75
|
def test_rule_allow_action
|
80
76
|
rule = {:include => ['a']}
|
81
77
|
result = rule.rule_allow_action('a')
|
82
78
|
assert_equal result, :include, "Should :include"
|
83
|
-
|
79
|
+
|
84
80
|
rule = {:exclude => ['a']}
|
85
81
|
result = rule.rule_allow_action('a')
|
86
82
|
assert_equal result, :exclude, "Should :exclude"
|
87
|
-
|
83
|
+
|
88
84
|
rule = {:include_and_yield => ['a']}
|
89
85
|
result = rule.rule_allow_action('a')
|
90
86
|
assert_equal result, :include_and_yield, "Should :include_and_yield"
|
91
|
-
|
87
|
+
|
92
88
|
rule = {:exclude_and_yield => ['a']}
|
93
89
|
result = rule.rule_allow_action('a')
|
94
90
|
assert_equal result, :exclude_and_yield, "Should :exclude_and_yield"
|
95
|
-
|
91
|
+
|
96
92
|
rule = {:yield => ['a']}
|
97
93
|
result = rule.rule_allow_action('a')
|
98
94
|
assert_equal result, :yield, "Should :yield"
|
99
|
-
|
95
|
+
|
100
96
|
rule = {:include => ['a']}
|
101
97
|
result = rule.rule_allow_action('a')
|
102
98
|
assert_equal result, :include, "Should :include"
|
103
|
-
|
99
|
+
|
104
100
|
rule = {:include => ['b'], :exclude => "a"}
|
105
101
|
result = rule.rule_allow_action('a')
|
106
102
|
assert_equal result, :exclude, "Should :exclude"
|
107
|
-
|
103
|
+
|
108
104
|
rule = {:include => ['a'], :exclude => "a"}
|
109
105
|
result = rule.rule_allow_action('a')
|
110
106
|
assert_equal result, :include, "Should :include"
|
111
|
-
|
107
|
+
|
112
108
|
end
|
113
|
-
|
114
|
-
def
|
115
|
-
rule = {:
|
116
|
-
result = rule.
|
117
|
-
assert_equal result.class, Tracing::
|
118
|
-
|
119
|
-
rule = {:
|
120
|
-
result = rule.
|
121
|
-
assert_equal result.class, Tracing::
|
122
|
-
|
123
|
-
rule = {:
|
124
|
-
result = rule.
|
125
|
-
assert_equal result.class, Tracing::
|
109
|
+
|
110
|
+
def test_create_template
|
111
|
+
rule = {:template => :html}
|
112
|
+
result = rule.template
|
113
|
+
assert_equal result.class, Tracing::HtmlTemplate, "Should result in HtmlTrace"
|
114
|
+
|
115
|
+
rule = {:template => :xml}
|
116
|
+
result = rule.template
|
117
|
+
assert_equal result.class, Tracing::XmlTemplate, "Should result in XmlTrace"
|
118
|
+
|
119
|
+
rule = {:template => :string}
|
120
|
+
result = rule.template
|
121
|
+
assert_equal result.class, Tracing::StringTemplate, "Should result in StringTrace"
|
126
122
|
end
|
127
123
|
|
128
124
|
def test_appenders
|
129
125
|
config = {:appenders => []}
|
130
126
|
result = config.appenders
|
131
127
|
assert_equal result.blank?, true, "Should result in empty appender list"
|
132
|
-
|
128
|
+
|
133
129
|
config = {:appenders => :html}
|
134
130
|
result = config.appenders
|
135
131
|
assert_equal result.class, Tracing::HtmlAppender, "Should result in empty appender list"
|
136
|
-
|
132
|
+
|
137
133
|
config = {:appenders => [:xml, :html]}
|
138
134
|
result = config.appenders
|
139
135
|
assert_equal Tracing::XmlAppender, result[0].class, "Should result in xml appender"
|
@@ -144,15 +140,15 @@ class TestHashExtensions < Test::Unit::TestCase
|
|
144
140
|
config = {:action_handlers => []}
|
145
141
|
result = config.action_handlers
|
146
142
|
assert_equal result.blank?, true, "Should result in empty action_handler list"
|
147
|
-
|
143
|
+
|
148
144
|
config = {:action_handlers => {:appenders => :html}}
|
149
145
|
result = config.action_handlers
|
150
146
|
assert_equal Tracing::HtmlAppender, result.appenders[0].class, "Should result in action handler with HtmlAppender registered"
|
151
|
-
|
147
|
+
|
152
148
|
config = {:action_handlers => {:filters => {:i_method_filter => "a,b"}}}
|
153
149
|
result = config.action_handlers
|
154
150
|
assert_equal Tracing::MethodFilter, result.filters[0].class, "Should result in action handler with MethodFilter registered"
|
155
|
-
|
151
|
+
|
156
152
|
ah1 = {:filters => {:i_method_filter => "a,b"}, :appenders => :html}
|
157
153
|
ah2 = {:filters => {:x_method_filter => "c,d"}, :appenders => :xml}
|
158
154
|
|
@@ -165,6 +161,7 @@ class TestHashExtensions < Test::Unit::TestCase
|
|
165
161
|
def test_create_filter
|
166
162
|
config = {:i_method_filter => "a,b"}
|
167
163
|
result = config.create_filter
|
164
|
+
puts result.inspect
|
168
165
|
assert_equal Tracing::MethodFilter, result.class, "Should result in method filter"
|
169
166
|
|
170
167
|
config = {:filters => {:i_method_filter => "a,b"}}
|
@@ -177,13 +174,13 @@ class TestHashExtensions < Test::Unit::TestCase
|
|
177
174
|
result = config.create_filter_hash
|
178
175
|
exp_result = {:method_filter => { :include => "a,b" } }
|
179
176
|
assert_equal exp_result, result, "Should result in :method_filter hash with :include name rules"
|
180
|
-
|
177
|
+
|
181
178
|
config = {:xy_class_filter => "a,b"}
|
182
179
|
result = config.create_filter_hash
|
183
180
|
exp_result = {:class_filter => { :exclude_and_yield => "a,b" } }
|
184
181
|
assert_equal exp_result, result, "Should result in :class_filter hash with :exclude_and_yield name rules"
|
185
182
|
end
|
186
|
-
|
183
|
+
|
187
184
|
def test_try_create_filter_hash
|
188
185
|
config = {:i_method_filter => "a,b"}
|
189
186
|
result = config.create_filter_hash
|
@@ -195,13 +192,13 @@ class TestHashExtensions < Test::Unit::TestCase
|
|
195
192
|
config = {:filters => []}
|
196
193
|
result = config.filters
|
197
194
|
assert_equal result.blank?, true, "Should result in empty filters list"
|
198
|
-
|
195
|
+
|
199
196
|
config = {:filters => {:i_method_filter => "a,b"}}
|
200
197
|
result = config.filters
|
201
198
|
assert_equal Tracing::MethodFilter, result.class, "Should result in method filter"
|
202
199
|
|
203
200
|
puts result.rules.inspect
|
204
|
-
expected = {:
|
201
|
+
expected = {:include => "a,b"}
|
205
202
|
assert_equal expected, result.rules, "Should result in method rules"
|
206
203
|
end
|
207
204
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require
|
2
|
-
require "test/unit"
|
1
|
+
require "include"
|
3
2
|
|
4
3
|
|
5
4
|
class TestHashFilterFilter < Test::Unit::TestCase
|
@@ -13,53 +12,71 @@ class TestHashFilterFilter < Test::Unit::TestCase
|
|
13
12
|
|
14
13
|
def test_try_create_method_include_filter
|
15
14
|
hash = {:i_method_filter => 'a,b'}
|
16
|
-
|
17
|
-
|
18
|
-
assert_equal
|
15
|
+
mfilter = hash.create_filter
|
16
|
+
expected = Tracing::MethodFilter
|
17
|
+
assert_equal expected, mfilter.class, "Should create method include filter"
|
18
|
+
exp = {:include => "a,b"}
|
19
|
+
assert_equal exp, mfilter.rules, "Expected include rules"
|
19
20
|
end
|
20
21
|
|
21
22
|
def test_try_create_method_exclude_filter
|
22
23
|
hash = {:x_method_filter => 'a,b'}
|
23
|
-
|
24
|
-
|
25
|
-
assert_equal
|
24
|
+
mfilter = hash.create_filter
|
25
|
+
expected = Tracing::MethodFilter
|
26
|
+
assert_equal expected, mfilter.class, "Should create method exclude filter"
|
27
|
+
exp = {:exclude =>"a,b"}
|
28
|
+
assert_equal exp, mfilter.rules, "Expected exclude rules"
|
26
29
|
end
|
27
|
-
|
30
|
+
|
28
31
|
def test_try_create_method_include_and_yield_filter
|
29
32
|
hash = {:iy_method_filter => 'a,b'}
|
30
|
-
|
31
|
-
|
32
|
-
assert_equal
|
33
|
+
mfilter = hash.create_filter
|
34
|
+
expected = Tracing::MethodFilter
|
35
|
+
assert_equal expected, mfilter.class, "Should create method include filter"
|
36
|
+
exp = {:include_and_yield => "a,b"}
|
37
|
+
assert_equal exp, mfilter.rules, "Expected include and yield rules"
|
33
38
|
end
|
34
|
-
|
39
|
+
|
35
40
|
def test_create_method_exclude_and_yield_filter
|
36
41
|
hash = {:xy_method_filter => 'a,b'}
|
37
|
-
|
38
|
-
|
39
|
-
|
42
|
+
mfilter = hash.create_filter
|
43
|
+
expected = Tracing::MethodFilter
|
44
|
+
puts "FILTER: #{mfilter.inspect}"
|
45
|
+
assert_equal expected, mfilter.class, "Should create method exclude filter"
|
46
|
+
exp = {:exclude_and_yield => "a,b"}
|
47
|
+
assert_equal exp, mfilter.rules, "Expected exclude and yield rules"
|
40
48
|
end
|
41
|
-
|
49
|
+
|
42
50
|
def test_try_create_class_exclude_and_yield_filter
|
43
51
|
hash = {:xy_class_filter => 'a,b'}
|
44
|
-
|
45
|
-
|
46
|
-
assert_equal
|
52
|
+
mfilter = hash.create_filter
|
53
|
+
expected = Tracing::ClassFilter
|
54
|
+
assert_equal expected, mfilter.class, "Should create class exclude filter"
|
55
|
+
exp = {:exclude_and_yield => "a,b"}
|
56
|
+
puts mfilter.inspect
|
57
|
+
assert_equal exp, mfilter.rules, "Expected exclude and yield rules"
|
47
58
|
end
|
48
|
-
|
59
|
+
|
49
60
|
def test_try_create_module_exclude_and_yield_filter
|
50
61
|
hash = {:xy_module_filter => 'a,b'}
|
51
|
-
|
52
|
-
|
53
|
-
assert_equal
|
62
|
+
mfilter = hash.create_filter
|
63
|
+
expected = Tracing::ModuleFilter
|
64
|
+
assert_equal expected, mfilter.class, "Should create module exclude filter"
|
65
|
+
exp = {:exclude_and_yield => "a,b"}
|
66
|
+
puts mfilter.inspect
|
67
|
+
assert_equal exp, mfilter.rules, "Expected exclude and yield rules"
|
54
68
|
end
|
55
|
-
|
69
|
+
|
56
70
|
def test_try_create_vars_exclude_and_yield_filter
|
57
71
|
hash = {:xy_vars_filter => 'a,b'}
|
58
|
-
|
59
|
-
|
60
|
-
assert_equal
|
72
|
+
mfilter = hash.create_filter
|
73
|
+
expected = Tracing::InstanceVarFilter
|
74
|
+
assert_equal expected, mfilter.class, "Should create vars exclude filter"
|
75
|
+
exp = {:exclude_and_yield => "a,b"}
|
76
|
+
puts mfilter.inspect
|
77
|
+
assert_equal exp, mfilter.rules, "Expected exclude and yield rules"
|
61
78
|
end
|
62
|
-
|
79
|
+
|
63
80
|
|
64
81
|
end
|
65
82
|
|