C0 code coverage information
Generated on Sun Oct 26 11:18:15 -0500 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 # :enddoc:
2
3 require 'aquarium/dsl/aspect_dsl'
4
5 # Declares classes, etc. that support several different module specs.
6 class ExampleParentClass
7 def == other
8 self.object_id == other.object_id or self.class == other.class
9 end
10 alias :eql? :==
11 end
12
13 class ClassWithPublicInstanceMethod < ExampleParentClass
14 def public_instance_test_method; end
15 end
16 class ClassWithPublicInstanceMethod2 < ExampleParentClass
17 def public_instance_test_method2; end
18 end
19 class ClassWithProtectedInstanceMethod < ExampleParentClass
20 protected
21 def protected_instance_test_method; end
22 end
23 class ClassWithPrivateInstanceMethod < ExampleParentClass
24 private
25 def private_instance_test_method; end
26 end
27
28 class ClassWithPublicClassMethod < ExampleParentClass
29 def self.public_class_test_method; end
30 end
31 class ClassWithPrivateClassMethod < ExampleParentClass
32 def self.private_class_test_method; end
33 private_class_method :private_class_test_method
34 end
35
36 module ModuleWithPublicInstanceMethod
37 def public_instance_module_test_method; end
38 end
39 module ModuleWithProtectedInstanceMethod
40 protected
41 def protected_instance_module_test_method; end
42 end
43 module ModuleWithPrivateInstanceMethod
44 private
45 def private_instance_module_test_method; end
46 end
47
48 module ModuleWithPublicClassMethod
49 def self.public_class_module_test_method; end
50 end
51 module ModuleWithPrivateClassMethod
52 def self.private_class_module_test_method; end
53 private_class_method :private_class_module_test_method
54 end
55
56 class ClassIncludingModuleWithPublicInstanceMethod
57 include ModuleWithPublicInstanceMethod
58 def public_instance_class_including_module_test_method; end
59 end
60 class ClassIncludingModuleWithProtectedInstanceMethod
61 include ModuleWithProtectedInstanceMethod
62 protected
63 def protected_instance_class_including_module_test_method; end
64 end
65 class ClassIncludingModuleWithPrivateInstanceMethod
66 include ModuleWithPrivateInstanceMethod
67 private
68 def private_instance_class_including_module_test_method; end
69 end
70 class ClassIncludingModuleWithPublicClassMethod
71 include ModuleWithPublicClassMethod
72 def self.public_class_class_including_module_test_method; end
73 end
74 class ClassIncludingModuleWithPrivateClassMethod
75 include ModuleWithPrivateClassMethod
76 def self.private_class_class_including_module_test_method; end
77 private_class_method :private_class_class_including_module_test_method
78 end
79
80 module ModuleIncludingModuleWithPublicInstanceMethod
81 include ModuleWithPublicInstanceMethod
82 def public_instance_module_including_module_test_method; end
83 end
84 class ClassDerivedFromClassIncludingModuleWithPublicInstanceMethod < ClassIncludingModuleWithPublicInstanceMethod
85 include ModuleIncludingModuleWithPublicInstanceMethod
86 def public_instance_class_derived_from_class_including_module_test_method; end
87 end
88
89 class ClassWithAttribs < ExampleParentClass
90 attr_accessor :attrRW_ClassWithAttribs, :name
91 attr_reader :attrR_ClassWithAttribs
92 attr_writer :attrW_ClassWithAttribs
93 def initialize
94 super
95 @name = "Name"
96 end
97 def eql? other
98 super(other) && name.eql?(other.name)
99 end
100 alias :== :eql?
101 end
102
103 class Watchful
104 include Aquarium::DSL
105 class WatchfulError < Exception
106 def initialize message = nil
107 super
108 @message = message
109 end
110 end
111
112 def eql? other
113 super && instance_variables.each do |var|
114 return false unless instance_variable_get(var) == other.instance_variable_get(var)
115 end
116 end
117 alias :== :eql?
118
119 %w[public protected private].each do |protection|
120 class_eval(<<-EOF, __FILE__, __LINE__)
121 public
122 attr_accessor :#{protection}_watchful_method_args, :#{protection}_watchful_method_that_raises_args
123 #{protection}
124 def #{protection}_watchful_method *args
125 @#{protection}_watchful_method_args = args
126 yield *args if block_given?
127 end
128 def #{protection}_watchful_method_that_raises *args
129 @#{protection}_watchful_method_that_raises_args = args
130 yield *args if block_given?
131 raise WatchfulError.new #("#{protection}_watchful_method_that_raises")
132 end
133 EOF
134 end
135
136 %w[public private].each do |protection|
137 class_eval(<<-EOF, __FILE__, __LINE__)
138 @@#{protection}_class_watchful_method_args = nil
139 @@#{protection}_class_watchful_method_that_raises_args = nil
140 class << self
141 public
142 def #{protection}_class_watchful_method_args
143 @@#{protection}_class_watchful_method_args
144 end
145 def #{protection}_class_watchful_method_args= args
146 @@#{protection}_class_watchful_method_args = args
147 end
148 def #{protection}_class_watchful_method_that_raises_args
149 @@#{protection}_class_watchful_method_that_raises_args
150 end
151 def #{protection}_class_watchful_method_that_raises_args args
152 @@#{protection}_class_watchful_method_that_raises_args = args
153 end
154
155 def #{protection}_class_watchful_method *args
156 @@#{protection}_class_watchful_method_args = args
157 yield *args if block_given?
158 end
159 def #{protection}_class_watchful_method_that_raises *args
160 @@#{protection}_class_watchful_method_that_raises_args = args
161 yield *args if block_given?
162 raise WatchfulError.new #("#{protection}_class_watchful_method_that_raises")
163 end
164 #{protection} :#{protection}_class_watchful_method, :#{protection}_class_watchful_method_that_raises
165 end
166 EOF
167 end
168 end
169
170 class WatchfulChild < Watchful; end
171
172 class ExcludeTestOne
173 def method11; end
174 def method12; end
175 def method13; end
176 end
177 class ExcludeTestTwo
178 def method21; end
179 def method22; end
180 def method23; end
181 end
182 class ExcludeTestThree
183 def method31; end
184 def method32; end
185 def method33; end
186 end
187
188 module TestableModule1
189 def module_method1; end
190 def module_method2; end
191 end
192
193 module TestableModule2
194 include TestableModule1
195 def module_method3; end
196 end
197
198 class TestableClassIncludingTestableModule1
199 include TestableModule1
200 def instance_method1; end
201 end
202
203 # Used to mock the expensive computation of descendents in some examples.
204 module Aquarium
205 module SpecExampleTypes
206 def descendents
207 {Watchful => [Watchful, WatchfulChild],
208 TestableModule2 => [TestableModule2, TestableModule1],
209 ExampleParentClass => [ExampleParentClass, ClassWithAttribs,
210 ClassWithPublicInstanceMethod, ClassWithPublicInstanceMethod2, ClassWithProtectedInstanceMethod,
211 ClassWithPrivateInstanceMethod, ClassWithPublicClassMethod, ClassWithPrivateClassMethod],
212 ModuleWithPublicInstanceMethod => [ModuleWithPublicInstanceMethod, ModuleIncludingModuleWithPublicInstanceMethod,
213 ClassIncludingModuleWithPublicInstanceMethod, ClassDerivedFromClassIncludingModuleWithPublicInstanceMethod],
214 ModuleWithProtectedInstanceMethod => [ModuleWithProtectedInstanceMethod, ClassIncludingModuleWithProtectedInstanceMethod],
215 ModuleWithPrivateInstanceMethod => [ModuleWithPrivateInstanceMethod, ClassIncludingModuleWithPrivateInstanceMethod],
216 ModuleWithPublicClassMethod => [ModuleWithPublicClassMethod, ClassIncludingModuleWithPublicClassMethod],
217 ModuleWithPrivateClassMethod => [ModuleWithPrivateClassMethod, ClassIncludingModuleWithPrivateClassMethod],
218 ClassIncludingModuleWithPublicInstanceMethod => [ClassIncludingModuleWithPublicInstanceMethod, ClassDerivedFromClassIncludingModuleWithPublicInstanceMethod],
219 ModuleIncludingModuleWithPublicInstanceMethod => [ModuleIncludingModuleWithPublicInstanceMethod, ClassDerivedFromClassIncludingModuleWithPublicInstanceMethod]
220 }
221 end
222 end
223
224 module TypeUtilsStub
225 include SpecExampleTypes
226
227 def stub_type_utils_descendents
228 @stubbed_type_utils_descendents = Aspect.new :around, :calls_to => :descendents, :on_type => Aquarium::Utils::TypeUtils,
229 :restricting_methods_to => :class_methods do |jp, object, *args|
230 descendents[args[0]]
231 end
232 end
233 def unstub_type_utils_descendents
234 @stubbed_type_utils_descendents.unadvise
235 end
236 end
237 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.