aquarium 0.1.0 → 0.1.5
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 +53 -0
- data/README +20 -4
- data/Rakefile +19 -4
- data/UPGRADE +41 -1
- data/examples/aspect_design_example.rb +4 -1
- data/examples/aspect_design_example_spec.rb +41 -0
- data/examples/design_by_contract_example.rb +2 -3
- data/examples/design_by_contract_example_spec.rb +92 -0
- data/examples/method_missing_example.rb +1 -1
- data/examples/method_missing_example_spec.rb +59 -0
- data/examples/method_tracing_example.rb +4 -2
- data/examples/method_tracing_example_spec.rb +141 -0
- data/lib/aquarium/aspects/advice.rb +2 -2
- data/lib/aquarium/aspects/aspect.rb +20 -35
- data/lib/aquarium/aspects/dsl.rb +2 -1
- data/lib/aquarium/aspects/dsl/aspect_dsl.rb +12 -8
- data/lib/aquarium/aspects/dsl/object_dsl.rb +8 -0
- data/lib/aquarium/aspects/join_point.rb +16 -10
- data/lib/aquarium/aspects/pointcut.rb +3 -3
- data/lib/aquarium/extras/design_by_contract.rb +20 -11
- data/lib/aquarium/utils.rb +1 -0
- data/lib/aquarium/utils/method_utils.rb +41 -0
- data/lib/aquarium/utils/name_utils.rb +35 -0
- data/lib/aquarium/utils/type_utils.rb +9 -0
- data/lib/aquarium/version.rb +3 -5
- data/rake_tasks/examples.rake +1 -1
- data/spec/aquarium/aspects/aspect_invocation_spec.rb +30 -28
- data/spec/aquarium/aspects/aspect_spec.rb +90 -0
- data/spec/aquarium/aspects/concurrent_aspects_spec.rb +5 -3
- data/spec/aquarium/aspects/concurrent_aspects_with_objects_and_types_spec.rb +3 -1
- data/spec/aquarium/aspects/dsl/aspect_dsl_spec.rb +174 -110
- data/spec/aquarium/aspects/join_point_spec.rb +120 -19
- data/spec/aquarium/aspects/pointcut_spec.rb +24 -14
- data/spec/aquarium/extras/design_by_contract_spec.rb +3 -0
- data/spec/aquarium/finders/finder_result_spec.rb +1 -1
- data/spec/aquarium/finders/method_finder_spec.rb +3 -4
- data/spec/aquarium/spec_example_classes.rb +4 -0
- data/spec/aquarium/utils/method_utils_spec.rb +124 -1
- data/spec/aquarium/utils/name_utils_spec.rb +56 -0
- data/spec/aquarium/utils/type_utils_spec.rb +17 -0
- metadata +12 -4
- data/spec/aquarium/finders/method_sorting_spec.rb +0 -16
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../spec_example_classes'
|
3
|
+
require 'aquarium/utils/name_utils'
|
4
|
+
|
5
|
+
describe Aquarium::Utils::NameUtils, ".make_valid_attr_name_from_method_name" do
|
6
|
+
it "should convert an equal sign into _equalsign_" do
|
7
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo=bar=baz").should eql(:foo_equalsign_bar_equalsign_baz)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should convert a question mark into _questionmark_" do
|
11
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo?bar?baz").should eql(:foo_questionmark_bar_questionmark_baz)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should convert an exclamation mark into _exclamationmark_" do
|
15
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo!bar!baz").should eql(:foo_exclamationmark_bar_exclamationmark_baz)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should convert question marks into _tilde_" do
|
19
|
+
Aquarium::Utils::NameUtils.make_valid_attr_name_from_method_name(:"foo~bar~baz").should eql(:foo_tilde_bar_tilde_baz)
|
20
|
+
end
|
21
|
+
|
22
|
+
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(:foo_equalsign_bar_questionmark_baz_exclamationmark_boz_tilde_bat)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe Aquarium::Utils::NameUtils, ".make_valid_object_id_name" do
|
28
|
+
it "should return the same id string with a _neg_ prefix if the id is negative" do
|
29
|
+
Aquarium::Utils::NameUtils.make_valid_object_id_name("-123").should eql("_neg_123")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the same id string if the id is positive" do
|
33
|
+
Aquarium::Utils::NameUtils.make_valid_object_id_name("123").should eql("123")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe Aquarium::Utils::NameUtils, ".make_valid_type_name" do
|
38
|
+
it "should return the same name with colons ':' converted to underscores '_'" do
|
39
|
+
Aquarium::Utils::NameUtils.make_valid_type_name(Aquarium::Utils::NameUtils).should eql("Aquarium__Utils__NameUtils")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return the same name if there are no colons" do
|
43
|
+
Aquarium::Utils::NameUtils.make_valid_type_name(String).should eql("String")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe Aquarium::Utils::NameUtils, ".make_type_or_object_key" do
|
48
|
+
it "should return the same string as :make_valid_type_name if the input is a type" do
|
49
|
+
Aquarium::Utils::NameUtils.make_type_or_object_key(Aquarium::Utils::NameUtils).should eql(Aquarium::Utils::NameUtils.make_valid_type_name(Aquarium::Utils::NameUtils))
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return the same string as :make_valid_object_name if the input is an object" do
|
53
|
+
object = "string"
|
54
|
+
Aquarium::Utils::NameUtils.make_type_or_object_key(object).should eql(Aquarium::Utils::NameUtils.make_valid_object_name(object))
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../spec_example_classes'
|
3
|
+
require 'aquarium/utils/type_utils'
|
4
|
+
|
5
|
+
describe Aquarium::Utils::TypeUtils, ".is_type?" do
|
6
|
+
it "should be true for a class" do
|
7
|
+
Aquarium::Utils::TypeUtils.is_type?(String).should be_true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be true for a Module" do
|
11
|
+
Aquarium::Utils::TypeUtils.is_type?(Kernel).should be_true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should be false for an Object" do
|
15
|
+
Aquarium::Utils::TypeUtils.is_type?("Object").should be_false
|
16
|
+
end
|
17
|
+
end
|
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-
|
8
|
-
summary: Aquarium-0.1.
|
6
|
+
version: 0.1.5
|
7
|
+
date: 2007-09-17 00:00:00 -05:00
|
8
|
+
summary: Aquarium-0.1.5 (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
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib/aquarium/aspects/aspect.rb
|
41
41
|
- lib/aquarium/aspects/default_object_handler.rb
|
42
42
|
- lib/aquarium/aspects/dsl/aspect_dsl.rb
|
43
|
+
- lib/aquarium/aspects/dsl/object_dsl.rb
|
43
44
|
- lib/aquarium/aspects/dsl.rb
|
44
45
|
- lib/aquarium/aspects/join_point.rb
|
45
46
|
- lib/aquarium/aspects/pointcut.rb
|
@@ -63,8 +64,10 @@ files:
|
|
63
64
|
- lib/aquarium/utils/html_escaper.rb
|
64
65
|
- lib/aquarium/utils/invalid_options.rb
|
65
66
|
- lib/aquarium/utils/method_utils.rb
|
67
|
+
- lib/aquarium/utils/name_utils.rb
|
66
68
|
- lib/aquarium/utils/nil_object.rb
|
67
69
|
- lib/aquarium/utils/set_utils.rb
|
70
|
+
- lib/aquarium/utils/type_utils.rb
|
68
71
|
- lib/aquarium/utils.rb
|
69
72
|
- lib/aquarium/version.rb
|
70
73
|
- lib/aquarium.rb
|
@@ -89,7 +92,6 @@ files:
|
|
89
92
|
- spec/aquarium/extras/design_by_contract_spec.rb
|
90
93
|
- spec/aquarium/finders/finder_result_spec.rb
|
91
94
|
- spec/aquarium/finders/method_finder_spec.rb
|
92
|
-
- spec/aquarium/finders/method_sorting_spec.rb
|
93
95
|
- spec/aquarium/finders/object_finder_spec.rb
|
94
96
|
- spec/aquarium/finders/type_finder_spec.rb
|
95
97
|
- spec/aquarium/spec_example_classes.rb
|
@@ -98,12 +100,18 @@ files:
|
|
98
100
|
- spec/aquarium/utils/hash_utils_spec.rb
|
99
101
|
- spec/aquarium/utils/html_escaper_spec.rb
|
100
102
|
- spec/aquarium/utils/method_utils_spec.rb
|
103
|
+
- spec/aquarium/utils/name_utils_spec.rb
|
101
104
|
- spec/aquarium/utils/nil_object_spec.rb
|
102
105
|
- spec/aquarium/utils/set_utils_spec.rb
|
106
|
+
- spec/aquarium/utils/type_utils_spec.rb
|
103
107
|
- examples/aspect_design_example.rb
|
108
|
+
- examples/aspect_design_example_spec.rb
|
104
109
|
- examples/design_by_contract_example.rb
|
110
|
+
- examples/design_by_contract_example_spec.rb
|
105
111
|
- examples/method_missing_example.rb
|
112
|
+
- examples/method_missing_example_spec.rb
|
106
113
|
- examples/method_tracing_example.rb
|
114
|
+
- examples/method_tracing_example_spec.rb
|
107
115
|
- rake_tasks/examples.rake
|
108
116
|
- rake_tasks/examples_specdoc.rake
|
109
117
|
- rake_tasks/examples_with_rcov.rake
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
-
|
3
|
-
describe "Method Extension" do
|
4
|
-
it "should compare methods by type and name." do
|
5
|
-
actual = %w[send nil? clone gsub! ].map {|m| Kernel.method(m)}
|
6
|
-
actual << Module.method(:nesting)
|
7
|
-
sorted = actual.sort_by {|method| method.to_s}
|
8
|
-
sorted.should == [
|
9
|
-
Kernel.method(:gsub!),
|
10
|
-
Kernel.method(:clone),
|
11
|
-
Kernel.method(:nil?),
|
12
|
-
Kernel.method(:send),
|
13
|
-
Module.method(:nesting)
|
14
|
-
]
|
15
|
-
end
|
16
|
-
end
|