piko-max-mod 0.0.1
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 +7 -0
- data/piko-max-mod.gemspec +12 -0
- data/test-unit-3.7.8/BSDL +24 -0
- data/test-unit-3.7.8/COPYING +64 -0
- data/test-unit-3.7.8/PSFL +271 -0
- data/test-unit-3.7.8/README.md +108 -0
- data/test-unit-3.7.8/Rakefile +74 -0
- data/test-unit-3.7.8/bin/test-unit +5 -0
- data/test-unit-3.7.8/doc/text/getting-started.md +120 -0
- data/test-unit-3.7.8/doc/text/how-to.md +90 -0
- data/test-unit-3.7.8/doc/text/news.md +2070 -0
- data/test-unit-3.7.8/lib/test/unit/assertion-failed-error.rb +60 -0
- data/test-unit-3.7.8/lib/test/unit/assertions.rb +2536 -0
- data/test-unit-3.7.8/lib/test/unit/attribute-matcher.rb +26 -0
- data/test-unit-3.7.8/lib/test/unit/attribute.rb +228 -0
- data/test-unit-3.7.8/lib/test/unit/auto-runner-loader.rb +17 -0
- data/test-unit-3.7.8/lib/test/unit/autorunner.rb +654 -0
- data/test-unit-3.7.8/lib/test/unit/code-snippet-fetcher.rb +58 -0
- data/test-unit-3.7.8/lib/test/unit/collector/descendant.rb +20 -0
- data/test-unit-3.7.8/lib/test/unit/collector/dir.rb +110 -0
- data/test-unit-3.7.8/lib/test/unit/collector/load.rb +201 -0
- data/test-unit-3.7.8/lib/test/unit/collector/objectspace.rb +35 -0
- data/test-unit-3.7.8/lib/test/unit/collector/xml.rb +249 -0
- data/test-unit-3.7.8/lib/test/unit/collector.rb +104 -0
- data/test-unit-3.7.8/lib/test/unit/color-scheme.rb +225 -0
- data/test-unit-3.7.8/lib/test/unit/color.rb +134 -0
- data/test-unit-3.7.8/lib/test/unit/data-sets.rb +127 -0
- data/test-unit-3.7.8/lib/test/unit/data.rb +371 -0
- data/test-unit-3.7.8/lib/test/unit/diff.rb +745 -0
- data/test-unit-3.7.8/lib/test/unit/error.rb +158 -0
- data/test-unit-3.7.8/lib/test/unit/exception-handler.rb +82 -0
- data/test-unit-3.7.8/lib/test/unit/failure.rb +169 -0
- data/test-unit-3.7.8/lib/test/unit/fault-location-detector.rb +104 -0
- data/test-unit-3.7.8/lib/test/unit/fixture.rb +304 -0
- data/test-unit-3.7.8/lib/test/unit/notification.rb +138 -0
- data/test-unit-3.7.8/lib/test/unit/omission.rb +198 -0
- data/test-unit-3.7.8/lib/test/unit/pending.rb +155 -0
- data/test-unit-3.7.8/lib/test/unit/priority.rb +194 -0
- data/test-unit-3.7.8/lib/test/unit/process-test-result.rb +55 -0
- data/test-unit-3.7.8/lib/test/unit/process-worker.rb +87 -0
- data/test-unit-3.7.8/lib/test/unit/runner/console.rb +86 -0
- data/test-unit-3.7.8/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit-3.7.8/lib/test/unit/runner/xml.rb +15 -0
- data/test-unit-3.7.8/lib/test/unit/sub-test-result.rb +59 -0
- data/test-unit-3.7.8/lib/test/unit/test-process-run-context.rb +21 -0
- data/test-unit-3.7.8/lib/test/unit/test-run-context.rb +16 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-creator.rb +103 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-process-runner.rb +205 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-runner.rb +132 -0
- data/test-unit-3.7.8/lib/test/unit/test-suite-thread-runner.rb +96 -0
- data/test-unit-3.7.8/lib/test/unit/test-thread-run-context.rb +23 -0
- data/test-unit-3.7.8/lib/test/unit/testcase.rb +1058 -0
- data/test-unit-3.7.8/lib/test/unit/testresult.rb +132 -0
- data/test-unit-3.7.8/lib/test/unit/testsuite.rb +133 -0
- data/test-unit-3.7.8/lib/test/unit/ui/console/outputlevel.rb +15 -0
- data/test-unit-3.7.8/lib/test/unit/ui/console/testrunner.rb +891 -0
- data/test-unit-3.7.8/lib/test/unit/ui/emacs/testrunner.rb +49 -0
- data/test-unit-3.7.8/lib/test/unit/ui/testrunner.rb +53 -0
- data/test-unit-3.7.8/lib/test/unit/ui/testrunnermediator.rb +131 -0
- data/test-unit-3.7.8/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit-3.7.8/lib/test/unit/ui/xml/testrunner.rb +225 -0
- data/test-unit-3.7.8/lib/test/unit/util/backtracefilter.rb +65 -0
- data/test-unit-3.7.8/lib/test/unit/util/memory-usage.rb +47 -0
- data/test-unit-3.7.8/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit-3.7.8/lib/test/unit/util/observable.rb +86 -0
- data/test-unit-3.7.8/lib/test/unit/util/output.rb +32 -0
- data/test-unit-3.7.8/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit-3.7.8/lib/test/unit/version.rb +5 -0
- data/test-unit-3.7.8/lib/test/unit/warning.rb +3 -0
- data/test-unit-3.7.8/lib/test/unit/worker-context.rb +20 -0
- data/test-unit-3.7.8/lib/test/unit.rb +521 -0
- data/test-unit-3.7.8/lib/test-unit.rb +19 -0
- data/test-unit-3.7.8/sample/adder.rb +13 -0
- data/test-unit-3.7.8/sample/subtracter.rb +12 -0
- data/test-unit-3.7.8/sample/test_adder.rb +20 -0
- data/test-unit-3.7.8/sample/test_subtracter.rb +20 -0
- data/test-unit-3.7.8/sample/test_user.rb +23 -0
- metadata +117 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Test
|
|
2
|
+
module Unit
|
|
3
|
+
class AttributeMatcher
|
|
4
|
+
def initialize(test)
|
|
5
|
+
@test = test
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def match?(expression)
|
|
9
|
+
matched = instance_eval(expression)
|
|
10
|
+
if matched.nil?
|
|
11
|
+
false
|
|
12
|
+
else
|
|
13
|
+
matched
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def method_missing(name, *args)
|
|
18
|
+
if args.empty?
|
|
19
|
+
@test[name]
|
|
20
|
+
else
|
|
21
|
+
super
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
module Test
|
|
2
|
+
module Unit
|
|
3
|
+
module Attribute
|
|
4
|
+
class StringifyKeyHash < Hash
|
|
5
|
+
class << self
|
|
6
|
+
def stringify(object)
|
|
7
|
+
object.to_s
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def key?(key)
|
|
12
|
+
super(self.class.stringify(key))
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def [](key)
|
|
16
|
+
super(self.class.stringify(key))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def []=(key, value)
|
|
20
|
+
super(self.class.stringify(key), value)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class << self
|
|
25
|
+
def included(base)
|
|
26
|
+
base.extend(BaseClassMethods)
|
|
27
|
+
base.extend(ClassMethods)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module BaseClassMethods
|
|
32
|
+
def attributes_table
|
|
33
|
+
{}
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module ClassMethods
|
|
38
|
+
def method_added(name)
|
|
39
|
+
super
|
|
40
|
+
return unless defined?(@current_attributes)
|
|
41
|
+
|
|
42
|
+
attributes = {}
|
|
43
|
+
kept_attributes = StringifyKeyHash.new
|
|
44
|
+
@current_attributes.each do |attribute_name, attribute|
|
|
45
|
+
attributes[attribute_name] = attribute[:value]
|
|
46
|
+
if attribute[:keep]
|
|
47
|
+
keep_hook = attribute[:keep_hook]
|
|
48
|
+
attribute = keep_hook.call(attribute) if keep_hook
|
|
49
|
+
kept_attributes[attribute_name] = attribute
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
set_attributes(name, attributes)
|
|
53
|
+
@current_attributes = kept_attributes
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Set an attribute to test methods.
|
|
57
|
+
#
|
|
58
|
+
# @overload attribute(name, value)
|
|
59
|
+
# @example
|
|
60
|
+
# attribute :speed, :slow
|
|
61
|
+
# def test_my_slow_method
|
|
62
|
+
# self[:speed] # => :slow
|
|
63
|
+
# end
|
|
64
|
+
#
|
|
65
|
+
# @param [Object] name the attribute name
|
|
66
|
+
# @param [Object] value the attribute value
|
|
67
|
+
# @return [void]
|
|
68
|
+
#
|
|
69
|
+
# @overload attribute(name, value, *method_names)
|
|
70
|
+
# @example
|
|
71
|
+
# def test_my_slow_method1
|
|
72
|
+
# self[:speed] # => :slow
|
|
73
|
+
# end
|
|
74
|
+
#
|
|
75
|
+
# attribute :speed, :slow, :test_my_slow_method1, :test_my_slow_method2
|
|
76
|
+
#
|
|
77
|
+
# def test_my_slow_method2
|
|
78
|
+
# self[:speed] # => :slow
|
|
79
|
+
# end
|
|
80
|
+
#
|
|
81
|
+
# @param [Object] name the attribute name
|
|
82
|
+
# @param [Object] value the attribute value
|
|
83
|
+
# @param [Array<Symbol, String>] method_names the test method names set the attribute
|
|
84
|
+
# @return [void]
|
|
85
|
+
#
|
|
86
|
+
# @overload attribute(name, value, options)
|
|
87
|
+
# @example
|
|
88
|
+
# attribute :speed, :slow, keep: true
|
|
89
|
+
# def test_my_slow_method1
|
|
90
|
+
# self[:speed] # => :slow
|
|
91
|
+
# end
|
|
92
|
+
#
|
|
93
|
+
# def test_my_slow_method2
|
|
94
|
+
# self[:speed] # => :slow
|
|
95
|
+
# end
|
|
96
|
+
#
|
|
97
|
+
# @param [Object] name the attribute name
|
|
98
|
+
# @param [Object] value the attribute value
|
|
99
|
+
# @option options [Boolean] :keep whether or not to set attribute to following test methods
|
|
100
|
+
# @return [void]
|
|
101
|
+
#
|
|
102
|
+
# @overload attribute(name, value, options, *method_names)
|
|
103
|
+
# @example
|
|
104
|
+
# def test_my_slow_method1
|
|
105
|
+
# self[:speed] # => :slow
|
|
106
|
+
# end
|
|
107
|
+
#
|
|
108
|
+
# # There are no valid options for now.
|
|
109
|
+
# attribute :speed, :slow, {}, :test_my_slow_method1
|
|
110
|
+
#
|
|
111
|
+
# def test_my_slow_method2
|
|
112
|
+
# self[:speed] # => nil
|
|
113
|
+
# end
|
|
114
|
+
#
|
|
115
|
+
# @param [Object] name the attribute name
|
|
116
|
+
# @param [Object] value the attribute value
|
|
117
|
+
# @param [Hash] options ignored
|
|
118
|
+
# @param [Array<Symbol, String>] method_names the test method names set the attribute
|
|
119
|
+
# @return [void]
|
|
120
|
+
def attribute(name, value, options={}, *method_names)
|
|
121
|
+
unless options.is_a?(Hash)
|
|
122
|
+
method_names << options
|
|
123
|
+
options = {}
|
|
124
|
+
end
|
|
125
|
+
if method_names.empty?
|
|
126
|
+
current_attributes[name] = options.merge(:value => value)
|
|
127
|
+
else
|
|
128
|
+
method_names.each do |method_name|
|
|
129
|
+
set_attributes(method_name, {name => value})
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def current_attributes
|
|
135
|
+
@current_attributes ||= StringifyKeyHash.new
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def current_attribute(name)
|
|
139
|
+
current_attributes[name] || StringifyKeyHash.new
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def attributes_table
|
|
143
|
+
@attributes_table ||= StringifyKeyHash.new
|
|
144
|
+
super.merge(@attributes_table)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def set_attributes(method_name, new_attributes)
|
|
148
|
+
return if new_attributes.empty?
|
|
149
|
+
@attributes_table ||= StringifyKeyHash.new
|
|
150
|
+
@attributes_table[method_name] ||= StringifyKeyHash.new
|
|
151
|
+
current_attributes = @attributes_table[method_name]
|
|
152
|
+
new_attributes.each do |key, value|
|
|
153
|
+
observers = attribute_observers(key) || []
|
|
154
|
+
observers.each do |observer|
|
|
155
|
+
observer.call(self,
|
|
156
|
+
StringifyKeyHash.stringify(key),
|
|
157
|
+
(attributes(method_name) || {})[key],
|
|
158
|
+
value,
|
|
159
|
+
method_name)
|
|
160
|
+
end
|
|
161
|
+
current_attributes[key] = value
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def attributes(method_name)
|
|
166
|
+
attributes = attributes_table[method_name]
|
|
167
|
+
ancestors.each do |ancestor|
|
|
168
|
+
next if ancestor == self
|
|
169
|
+
if ancestor.is_a?(Class) and ancestor < Test::Unit::Attribute
|
|
170
|
+
parent_attributes = ancestor.attributes(method_name)
|
|
171
|
+
if attributes
|
|
172
|
+
attributes = (parent_attributes || {}).merge(attributes)
|
|
173
|
+
else
|
|
174
|
+
attributes = parent_attributes
|
|
175
|
+
end
|
|
176
|
+
break
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
attributes || StringifyKeyHash.new
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def find_attribute(method_name, name, options={})
|
|
183
|
+
recursive_p = options[:recursive]
|
|
184
|
+
recursive_p = true if recursive_p.nil?
|
|
185
|
+
|
|
186
|
+
@attributes_table ||= StringifyKeyHash.new
|
|
187
|
+
if @attributes_table.key?(method_name)
|
|
188
|
+
attributes = @attributes_table[method_name]
|
|
189
|
+
if attributes.key?(name)
|
|
190
|
+
return attributes[name]
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
return nil unless recursive_p
|
|
195
|
+
return nil if self == TestCase
|
|
196
|
+
|
|
197
|
+
@cached_parent_test_case ||= ancestors.find do |ancestor|
|
|
198
|
+
ancestor != self and
|
|
199
|
+
ancestor.is_a?(Class) and
|
|
200
|
+
ancestor < Test::Unit::Attribute
|
|
201
|
+
end
|
|
202
|
+
return nil if @cached_parent_test_case.nil?
|
|
203
|
+
|
|
204
|
+
@cached_parent_test_case.find_attribute(method_name, name, options)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
@@attribute_observers = StringifyKeyHash.new
|
|
208
|
+
def register_attribute_observer(attribute_name, observer=nil, &block)
|
|
209
|
+
observer ||= Proc.new(&block)
|
|
210
|
+
@@attribute_observers[attribute_name] ||= []
|
|
211
|
+
@@attribute_observers[attribute_name] << observer
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def attribute_observers(attribute_name)
|
|
215
|
+
@@attribute_observers[attribute_name]
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def attributes
|
|
220
|
+
self.class.attributes(@method_name) || StringifyKeyHash.new
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def [](name)
|
|
224
|
+
self.class.find_attribute(@method_name, name)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require_relative "test-suite-creator"
|
|
2
|
+
|
|
3
|
+
module Test
|
|
4
|
+
module Unit
|
|
5
|
+
module AutoRunnerLoader
|
|
6
|
+
@loaded = false
|
|
7
|
+
class << self
|
|
8
|
+
def check(test_case, method_name)
|
|
9
|
+
return if @loaded
|
|
10
|
+
return unless TestSuiteCreator.test_method?(test_case, method_name)
|
|
11
|
+
require_relative "../unit"
|
|
12
|
+
@loaded = true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|