aquarium 0.1.6 → 0.1.7
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 +18 -0
- data/README +68 -39
- data/RELEASE-PLAN +25 -1
- data/UPGRADE +4 -0
- data/examples/aspect_design_example.rb +9 -3
- data/examples/aspect_design_example_spec.rb +7 -2
- data/examples/method_tracing_example.rb +1 -1
- data/examples/method_tracing_example_spec.rb +2 -2
- data/lib/aquarium/aspects/aspect.rb +53 -60
- data/lib/aquarium/aspects/dsl/aspect_dsl.rb +0 -1
- data/lib/aquarium/aspects/pointcut.rb +72 -17
- data/lib/aquarium/aspects/pointcut_composition.rb +4 -1
- data/lib/aquarium/extensions/hash.rb +65 -28
- data/lib/aquarium/extensions/set.rb +2 -0
- data/lib/aquarium/finders/finder_result.rb +13 -2
- data/lib/aquarium/finders/method_finder.rb +54 -28
- data/lib/aquarium/finders/type_finder.rb +36 -19
- data/lib/aquarium/utils/method_utils.rb +3 -12
- data/lib/aquarium/utils/name_utils.rb +27 -1
- data/lib/aquarium/version.rb +1 -1
- data/spec/aquarium/aspects/aspect_invocation_spec.rb +182 -51
- data/spec/aquarium/aspects/aspect_spec.rb +43 -8
- data/spec/aquarium/aspects/pointcut_and_composition_spec.rb +32 -3
- data/spec/aquarium/aspects/pointcut_or_composition_spec.rb +36 -5
- data/spec/aquarium/aspects/pointcut_spec.rb +373 -99
- data/spec/aquarium/extensions/hash_spec.rb +129 -38
- data/spec/aquarium/finders/finder_result_spec.rb +73 -15
- data/spec/aquarium/finders/method_finder_spec.rb +156 -72
- data/spec/aquarium/finders/object_finder_spec.rb +1 -0
- data/spec/aquarium/finders/type_finder_spec.rb +43 -0
- data/spec/aquarium/utils/name_utils_spec.rb +79 -4
- metadata +3 -3
@@ -118,6 +118,7 @@ describe Aquarium::Finders::ObjectFinder, "#find" do
|
|
118
118
|
actual = Aquarium::Finders::ObjectFinder.new.find :type => OBase
|
119
119
|
actual.matched.size.should == 1
|
120
120
|
actual.matched[OBase].sort_by {|o| o.name}.should == [b1, b2, d1, d2]
|
121
|
+
actual.matched[OBase].each {|o| [b1, b2, d1, d2].include?(o)}
|
121
122
|
actual.not_matched.should == {}
|
122
123
|
end
|
123
124
|
|
@@ -157,6 +157,49 @@ describe Aquarium::Finders::TypeFinder, "#find with :types, :names, :type, and :
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
+
describe Aquarium::Finders::TypeFinder, "#find with :exclude_types" do
|
161
|
+
it "should exclude types specified with a regular expression." do
|
162
|
+
expected_found_types = [Class, Module, Object]
|
163
|
+
actual = Aquarium::Finders::TypeFinder.new.find :types => [/K.+l/, /^Mod.+e$/, /^Object$/, /^Clas{2}$/], :exclude_types => /^Kernel$/
|
164
|
+
actual.matched_keys.sort_by {|x| x.to_s}.should == expected_found_types.sort_by {|x| x.to_s}
|
165
|
+
actual.not_matched.size.should == 0
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should exclude types specified by name." do
|
169
|
+
expected_found_types = [Class, Module]
|
170
|
+
actual = Aquarium::Finders::TypeFinder.new.find :types => [/K.+l/, /^Mod.+e$/, /^Object$/, /^Clas{2}$/], :exclude_types => [Kernel, Object]
|
171
|
+
actual.matched_keys.sort_by {|x| x.to_s}.should == expected_found_types.sort_by {|x| x.to_s}
|
172
|
+
actual.not_matched.size.should == 0
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should not add excluded types to the #not_matched result." do
|
176
|
+
expected_found_types = [Class, Module]
|
177
|
+
actual = Aquarium::Finders::TypeFinder.new.find :types => [/K.+l/, /^Mod.+e$/, /^Object$/, /^Clas{2}$/], :exclude_types => [Kernel, Object]
|
178
|
+
actual.not_matched.size.should == 0
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should be a synonym for :exclude_type." do
|
182
|
+
expected_found_types = [Class, Module]
|
183
|
+
actual = Aquarium::Finders::TypeFinder.new.find :types => [/K.+l/, /^Mod.+e$/, /^Object$/, /^Clas{2}$/], :exclude_type => [Kernel, Object]
|
184
|
+
actual.matched_keys.sort_by {|x| x.to_s}.should == expected_found_types.sort_by {|x| x.to_s}
|
185
|
+
actual.not_matched.size.should == 0
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should be a synonym for :exclude_names." do
|
189
|
+
expected_found_types = [Class, Module]
|
190
|
+
actual = Aquarium::Finders::TypeFinder.new.find :types => [/K.+l/, /^Mod.+e$/, /^Object$/, /^Clas{2}$/], :exclude_names => [Kernel, Object]
|
191
|
+
actual.matched_keys.sort_by {|x| x.to_s}.should == expected_found_types.sort_by {|x| x.to_s}
|
192
|
+
actual.not_matched.size.should == 0
|
193
|
+
end
|
194
|
+
|
195
|
+
it "should be a synonym for :exclude_name." do
|
196
|
+
expected_found_types = [Class, Module]
|
197
|
+
actual = Aquarium::Finders::TypeFinder.new.find :types => [/K.+l/, /^Mod.+e$/, /^Object$/, /^Clas{2}$/], :exclude_name => [Kernel, Object]
|
198
|
+
actual.matched_keys.sort_by {|x| x.to_s}.should == expected_found_types.sort_by {|x| x.to_s}
|
199
|
+
actual.not_matched.size.should == 0
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
160
203
|
describe Aquarium::Finders::TypeFinder, "#find" do
|
161
204
|
it "should find types when types given." do
|
162
205
|
expected_found_types = [Outside::Inside1, Outside::Inside2]
|
@@ -3,10 +3,18 @@ require File.dirname(__FILE__) + '/../spec_example_classes'
|
|
3
3
|
require 'aquarium/utils/name_utils'
|
4
4
|
|
5
5
|
describe Aquarium::Utils::NameUtils, ".make_valid_attr_name_from_method_name" do
|
6
|
-
it "should convert an equal sign into
|
7
|
-
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar=baz").should eql(:
|
6
|
+
it "should convert an equal sign into _equal_" do
|
7
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar=baz").should eql(:foo_equal_bar_equal_baz)
|
8
8
|
end
|
9
9
|
|
10
|
+
it "should convert an '==' sign into _equal__equal_" do
|
11
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo==bar==baz").should eql(:foo_equal__equal_bar_equal__equal_baz)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should convert an '===' sign into _equal__equal__equal_" do
|
15
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo===bar===baz").should eql(:foo_equal__equal__equal_bar_equal__equal__equal_baz)
|
16
|
+
end
|
17
|
+
|
10
18
|
it "should convert a question mark into _questionmark_" do
|
11
19
|
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo?bar?baz").should eql(:foo_questionmark_bar_questionmark_baz)
|
12
20
|
end
|
@@ -15,12 +23,79 @@ describe Aquarium::Utils::NameUtils, ".make_valid_attr_name_from_method_name" do
|
|
15
23
|
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo!bar!baz").should eql(:foo_exclamationmark_bar_exclamationmark_baz)
|
16
24
|
end
|
17
25
|
|
18
|
-
it "should convert
|
26
|
+
it "should convert a tilde into _tilde_" do
|
19
27
|
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo~bar~baz").should eql(:foo_tilde_bar_tilde_baz)
|
20
28
|
end
|
21
29
|
|
30
|
+
it "should convert a minus sign into _minus_" do
|
31
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo-bar-baz").should eql(:foo_minus_bar_minus_baz)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should convert a plus sign into _plus_" do
|
35
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo+bar+baz").should eql(:foo_plus_bar_plus_baz)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should convert a slash into _slash_" do
|
39
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo/bar/baz").should eql(:foo_slash_bar_slash_baz)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should convert a star into _star_" do
|
43
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo*bar*baz").should eql(:foo_star_bar_star_baz)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should convert a less than sign into _lessthan_" do
|
47
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo<bar<baz").should eql(:foo_lessthan_bar_lessthan_baz)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should convert a greater than sign into _greaterthan_" do
|
51
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo>bar>baz").should eql(:foo_greaterthan_bar_greaterthan_baz)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should convert a '<=>' (spaceship operator) into _greaterthan_" do
|
55
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo<=>bar<=>baz").should eql(:foo_lessthan__equal__greaterthan_bar_lessthan__equal__greaterthan_baz)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should convert a left shift into _leftshift_" do
|
59
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo<<bar<<baz").should eql(:foo_leftshift_bar_leftshift_baz)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should convert a right shift into _rightshift_" do
|
63
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo>>bar>>baz").should eql(:foo_rightshift_bar_rightshift_baz)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should convert an '=~' into _matches_" do
|
67
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=~bar=~baz").should eql(:foo_matches_bar_matches_baz)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should convert a percent sign into _percent_" do
|
71
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo%bar%baz").should eql(:foo_percent_bar_percent_baz)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should convert a caret into _caret_" do
|
75
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo^bar^baz").should eql(:foo_caret_bar_caret_baz)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should convert a [] into _brackets_" do
|
79
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo[]bar[]baz").should eql(:foo_brackets_bar_brackets_baz)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should convert a & into _ampersand_" do
|
83
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo&bar&baz").should eql(:foo_ampersand_bar_ampersand_baz)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should convert a | into _pipe_" do
|
87
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo|bar|baz").should eql(:foo_pipe_bar_pipe_baz)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should convert a back tick into _backtick_" do
|
91
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo`bar`baz").should eql(:foo_backtick_bar_backtick_baz)
|
92
|
+
end
|
93
|
+
|
22
94
|
it "should convert all of the above in the same symbol" do
|
23
|
-
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar?baz!boz~bat").should eql(
|
95
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar?baz!boz~bat-bot+bit").should eql(
|
96
|
+
:foo_equal_bar_questionmark_baz_exclamationmark_boz_tilde_bat_minus_bot_plus_bit)
|
97
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name('x/a*b<c>d<<e>>f=~g%i^j[]k&l|m`n'.intern).should eql(
|
98
|
+
:x_slash_a_star_b_lessthan_c_greaterthan_d_leftshift_e_rightshift_f_matches_g_percent_i_caret_j_brackets_k_ampersand_l_pipe_m_backtick_n)
|
24
99
|
end
|
25
100
|
end
|
26
101
|
|
metadata
CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: aquarium
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-10-
|
8
|
-
summary: Aquarium-0.1.
|
6
|
+
version: 0.1.7
|
7
|
+
date: 2007-10-27 00:00:00 -05:00
|
8
|
+
summary: Aquarium-0.1.7 (r7) - Aspect-Oriented Programming toolkit for Ruby http://aquarium.rubyforge.org
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: aquarium-devel@rubyforge.org
|