test-unit 3.0.2 → 3.0.3
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 +4 -4
- data/README.md +1 -1
- data/doc/text/news.md +21 -0
- data/lib/test/unit/assertions.rb +3 -1
- data/lib/test/unit/attribute.rb +25 -1
- data/lib/test/unit/diff.rb +2 -2
- data/lib/test/unit/fixture.rb +116 -121
- data/lib/test/unit/priority.rb +2 -2
- data/lib/test/unit/test-suite-creator.rb +7 -6
- data/lib/test/unit/testcase.rb +9 -10
- data/lib/test/unit/testresult.rb +2 -2
- data/lib/test/unit/ui/console/testrunner.rb +3 -3
- data/lib/test/unit/ui/emacs/testrunner.rb +1 -1
- data/lib/test/unit/version.rb +1 -1
- data/test/test-assertions.rb +17 -0
- metadata +31 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a84889d7e64ada72e39b5d39465d56fca7041b25
|
4
|
+
data.tar.gz: 723b397f2691190b10b17e0ba71dafa3d5d3247e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cccaddea4b0ddc35b4984a82b0b6fbc637f76f427671efa6c4aeba33e6f7246ac191cc62db8ced399db8128f478557e84e1e27ad0c8fbe35c4a27b966807083
|
7
|
+
data.tar.gz: 64f04e97bd245dbcb02fece0633cd3cfc5cdf14877a5d75cadb817d7743d97db9f2fcab4ea1a918c4aa88a27ed7531116bd68b1085ef00ffd9826272e2dab3b0
|
data/README.md
CHANGED
data/doc/text/news.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.0.3 - 2014-10-29 {#version-3-0-3}
|
4
|
+
|
5
|
+
It's a minor update release.
|
6
|
+
|
7
|
+
### Improvements
|
8
|
+
|
9
|
+
* Improved `Test::Unit::TestCase.test` performance.
|
10
|
+
100 times faster.
|
11
|
+
* Supported `Proc` for user message.
|
12
|
+
[Sugested by Nobuyoshi Nakada]
|
13
|
+
|
14
|
+
### Fixes
|
15
|
+
|
16
|
+
* Fixed markup in document.
|
17
|
+
[GitHub#81][Patch by Masafumi Yokoyama]
|
18
|
+
|
19
|
+
### Thanks
|
20
|
+
|
21
|
+
* Masafumi Yokoyama
|
22
|
+
* Nobuyoshi Nakada
|
23
|
+
|
3
24
|
## 3.0.2 - 2014-10-15 {#version-3-0-2}
|
4
25
|
|
5
26
|
It's a minor update release.
|
data/lib/test/unit/assertions.rb
CHANGED
@@ -2062,7 +2062,9 @@ EOT
|
|
2062
2062
|
def to_s
|
2063
2063
|
message_parts = []
|
2064
2064
|
if (@head)
|
2065
|
-
head = @head
|
2065
|
+
head = @head
|
2066
|
+
head = head.call if head.respond_to?(:call)
|
2067
|
+
head = head.to_s
|
2066
2068
|
unless(head.empty?)
|
2067
2069
|
message_parts << add_period(head)
|
2068
2070
|
end
|
data/lib/test/unit/attribute.rb
CHANGED
@@ -8,6 +8,10 @@ module Test
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
def key?(key)
|
12
|
+
super(self.class.stringify(key))
|
13
|
+
end
|
14
|
+
|
11
15
|
def [](key)
|
12
16
|
super(self.class.stringify(key))
|
13
17
|
end
|
@@ -107,6 +111,26 @@ module Test
|
|
107
111
|
attributes || StringifyKeyHash.new
|
108
112
|
end
|
109
113
|
|
114
|
+
def find_attribute(method_name, name)
|
115
|
+
@attributes_table ||= StringifyKeyHash.new
|
116
|
+
if @attributes_table.key?(method_name)
|
117
|
+
attributes = @attributes_table[method_name]
|
118
|
+
if attributes.key?(name)
|
119
|
+
return attributes[name]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
return nil if self == TestCase
|
124
|
+
|
125
|
+
@cached_parent_test_case ||= ancestors.find do |ancestor|
|
126
|
+
ancestor != self and
|
127
|
+
ancestor.is_a?(Class) and
|
128
|
+
ancestor < Test::Unit::Attribute
|
129
|
+
end
|
130
|
+
|
131
|
+
@cached_parent_test_case.find_attribute(method_name, name)
|
132
|
+
end
|
133
|
+
|
110
134
|
@@attribute_observers = StringifyKeyHash.new
|
111
135
|
def register_attribute_observer(attribute_name, observer=Proc.new)
|
112
136
|
@@attribute_observers[attribute_name] ||= []
|
@@ -123,7 +147,7 @@ module Test
|
|
123
147
|
end
|
124
148
|
|
125
149
|
def [](name)
|
126
|
-
|
150
|
+
self.class.find_attribute(@method_name, name)
|
127
151
|
end
|
128
152
|
end
|
129
153
|
end
|
data/lib/test/unit/diff.rb
CHANGED
@@ -81,7 +81,7 @@ module Test
|
|
81
81
|
each = :each
|
82
82
|
end
|
83
83
|
i = 0
|
84
|
-
@to.
|
84
|
+
@to.__send__(each) do |item|
|
85
85
|
@to_indexes[item] ||= []
|
86
86
|
@to_indexes[item] << i
|
87
87
|
i += 1
|
@@ -685,7 +685,7 @@ module Test
|
|
685
685
|
to_index = to_start
|
686
686
|
while from_index >= 0 or to_index >= 0
|
687
687
|
[@from[from_index], @to[to_index]].each do |line|
|
688
|
-
return line if line and
|
688
|
+
return line if line and __send__(predicate, line)
|
689
689
|
end
|
690
690
|
|
691
691
|
from_index -= 1
|
data/lib/test/unit/fixture.rb
CHANGED
@@ -5,93 +5,160 @@ module Test
|
|
5
5
|
def included(base)
|
6
6
|
base.extend(ClassMethods)
|
7
7
|
|
8
|
-
[:setup, :cleanup, :teardown].each do |
|
8
|
+
[:setup, :cleanup, :teardown].each do |type|
|
9
9
|
observer = lambda do |test_case, _, _, value, callback|
|
10
10
|
if value.nil?
|
11
|
-
test_case.
|
11
|
+
test_case.fixture[type].unregister(callback)
|
12
12
|
else
|
13
|
-
test_case.
|
13
|
+
test_case.fixture[type].register(callback, value)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
base.register_attribute_observer(
|
16
|
+
base.register_attribute_observer(type, &observer)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
class Fixture
|
22
|
+
attr_reader :setup
|
23
|
+
attr_reader :cleanup
|
24
|
+
attr_reader :teardown
|
25
|
+
def initialize(test_case)
|
26
|
+
@test_case = test_case
|
27
|
+
@setup = HookPoint.new(:after => :append)
|
28
|
+
@cleanup = HookPoint.new(:before => :prepend)
|
29
|
+
@teardown = HookPoint.new(:before => :prepend)
|
30
|
+
end
|
31
|
+
|
32
|
+
def [](type)
|
33
|
+
case type
|
34
|
+
when :setup
|
35
|
+
@setup
|
36
|
+
when :cleanup
|
37
|
+
@cleanup
|
38
|
+
when :teardown
|
39
|
+
@teardown
|
40
|
+
end
|
24
41
|
end
|
25
42
|
|
26
|
-
def
|
27
|
-
|
43
|
+
def before_callbacks(type)
|
44
|
+
target_test_cases.inject([]) do |callbacks, ancestor|
|
45
|
+
callbacks | ancestor.fixture[type].before_callbacks
|
46
|
+
end
|
28
47
|
end
|
29
48
|
|
30
|
-
def
|
31
|
-
|
49
|
+
def after_callbacks(type)
|
50
|
+
target_test_cases.inject([]) do |callbacks, ancestor|
|
51
|
+
callbacks | ancestor.fixture[type].after_callbacks
|
52
|
+
end
|
32
53
|
end
|
33
54
|
|
34
|
-
|
35
|
-
|
55
|
+
private
|
56
|
+
def target_test_cases
|
57
|
+
@cached_target_test_cases ||= collect_target_test_cases
|
36
58
|
end
|
37
59
|
|
38
|
-
def
|
39
|
-
|
60
|
+
def collect_target_test_cases
|
61
|
+
ancestors = @test_case.ancestors
|
62
|
+
base_index = ancestors.index(::Test::Unit::Fixture)
|
63
|
+
interested_ancestors = ancestors[0, base_index].find_all do |ancestor|
|
64
|
+
ancestor.is_a?(Class)
|
65
|
+
end
|
66
|
+
interested_ancestors.reverse
|
40
67
|
end
|
68
|
+
end
|
41
69
|
|
42
|
-
|
43
|
-
|
70
|
+
class HookPoint
|
71
|
+
def initialize(default_options)
|
72
|
+
@default_options = default_options
|
73
|
+
@before_callbacks = []
|
74
|
+
@after_callbacks = []
|
75
|
+
@unregistered_callbacks = []
|
44
76
|
end
|
45
77
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
78
|
+
def register(method_name_or_callback, options=nil)
|
79
|
+
options ||= {}
|
80
|
+
unless valid_register_options?(options)
|
81
|
+
message = "must be {:before => :prepend}, " +
|
82
|
+
"{:before => :append}, {:after => :prepend} or " +
|
83
|
+
"{:after => :append}: #{options.inspect}"
|
84
|
+
raise ArgumentError, message
|
85
|
+
end
|
86
|
+
|
87
|
+
if options.empty?
|
88
|
+
options = @default_options
|
89
|
+
end
|
90
|
+
before_how = options[:before]
|
91
|
+
after_how = options[:after]
|
92
|
+
if before_how
|
93
|
+
@before_callbacks = add_callback(@before_callbacks,
|
94
|
+
method_name_or_callback,
|
95
|
+
before_how)
|
96
|
+
else
|
97
|
+
@after_callbacks = add_callback(@after_callbacks,
|
98
|
+
method_name_or_callback,
|
99
|
+
after_how)
|
100
|
+
end
|
49
101
|
end
|
50
102
|
|
51
|
-
def
|
52
|
-
|
103
|
+
def unregister(method_name_or_callback)
|
104
|
+
@unregistered_callbacks << method_name_or_callback
|
53
105
|
end
|
54
106
|
|
55
|
-
def
|
56
|
-
|
57
|
-
options, :before, :prepend)
|
107
|
+
def before_callbacks
|
108
|
+
@before_callbacks - @unregistered_callbacks
|
58
109
|
end
|
59
110
|
|
60
|
-
def
|
61
|
-
|
111
|
+
def after_callbacks
|
112
|
+
@after_callbacks - @unregistered_callbacks
|
62
113
|
end
|
63
114
|
|
64
|
-
|
65
|
-
|
66
|
-
|
115
|
+
private
|
116
|
+
def valid_register_options?(options)
|
117
|
+
return true if options.empty?
|
118
|
+
return false if options.size > 1
|
119
|
+
|
120
|
+
key = options.keys.first
|
121
|
+
[:before, :after].include?(key) and
|
122
|
+
[:prepend, :append].include?(options[key])
|
67
123
|
end
|
68
124
|
|
69
|
-
def
|
70
|
-
|
125
|
+
def add_callback(callbacks, method_name_or_callback, how)
|
126
|
+
case how
|
127
|
+
when :prepend
|
128
|
+
[method_name_or_callback] | callbacks
|
129
|
+
when :append
|
130
|
+
callbacks | [method_name_or_callback]
|
131
|
+
end
|
71
132
|
end
|
133
|
+
end
|
72
134
|
|
73
|
-
|
74
|
-
|
135
|
+
module ClassMethods
|
136
|
+
def fixture
|
137
|
+
@fixture ||= Fixture.new(self)
|
75
138
|
end
|
76
139
|
|
77
|
-
def
|
78
|
-
|
140
|
+
def setup(*method_names, &callback)
|
141
|
+
register_fixture(:setup, *method_names, &callback)
|
79
142
|
end
|
80
143
|
|
81
|
-
def
|
82
|
-
|
144
|
+
def unregister_setup(*method_names_or_callbacks)
|
145
|
+
unregister_fixture(:setup, *method_names_or_callbacks)
|
83
146
|
end
|
84
147
|
|
85
|
-
def
|
86
|
-
|
148
|
+
def cleanup(*method_names, &callback)
|
149
|
+
register_fixture(:cleanup, *method_names, &callback)
|
87
150
|
end
|
88
151
|
|
89
|
-
def
|
90
|
-
|
152
|
+
def unregister_cleanup(*method_names_or_callbacks)
|
153
|
+
unregister_fixture(:cleanup, *method_names_or_callbacks)
|
91
154
|
end
|
92
155
|
|
93
|
-
def
|
94
|
-
|
156
|
+
def teardown(*method_names, &callback)
|
157
|
+
register_fixture(:teardown, *method_names, &callback)
|
158
|
+
end
|
159
|
+
|
160
|
+
def unregister_teardown(*method_names_or_callbacks)
|
161
|
+
unregister_fixture(:teardown, *method_names_or_callbacks)
|
95
162
|
end
|
96
163
|
|
97
164
|
private
|
@@ -106,86 +173,14 @@ module Test
|
|
106
173
|
def unregister_fixture(fixture, *method_names_or_callbacks)
|
107
174
|
attribute(fixture, nil, *method_names_or_callbacks)
|
108
175
|
end
|
109
|
-
|
110
|
-
def valid_register_fixture_options?(options)
|
111
|
-
return true if options.empty?
|
112
|
-
return false if options.size > 1
|
113
|
-
|
114
|
-
key = options.keys.first
|
115
|
-
[:before, :after].include?(key) and
|
116
|
-
[:prepend, :append].include?(options[key])
|
117
|
-
end
|
118
|
-
|
119
|
-
def add_fixture_callback(how, variable_name, method_name_or_callback)
|
120
|
-
callbacks = instance_eval("#{variable_name} ||= []")
|
121
|
-
|
122
|
-
if how == :prepend
|
123
|
-
callbacks = [method_name_or_callback] | callbacks
|
124
|
-
else
|
125
|
-
callbacks = callbacks | [method_name_or_callback]
|
126
|
-
end
|
127
|
-
instance_variable_set(variable_name, callbacks)
|
128
|
-
end
|
129
|
-
|
130
|
-
def registered_callbacks_variable_name(fixture, order)
|
131
|
-
"@#{order}_#{fixture}_callbacks"
|
132
|
-
end
|
133
|
-
|
134
|
-
def unregistered_callbacks_variable_name(fixture)
|
135
|
-
"@unregistered_#{fixture}_callbacks"
|
136
|
-
end
|
137
|
-
|
138
|
-
def register_fixture_callback(fixture, method_name_or_callback, options,
|
139
|
-
default_order, default_how)
|
140
|
-
unless valid_register_fixture_options?(options)
|
141
|
-
message = "must be {:before => :prepend}, " +
|
142
|
-
"{:before => :append}, {:after => :prepend} or " +
|
143
|
-
"{:after => :append}: #{options.inspect}"
|
144
|
-
raise ArgumentError, message
|
145
|
-
end
|
146
|
-
|
147
|
-
if options.empty?
|
148
|
-
order, how = default_order, default_how
|
149
|
-
else
|
150
|
-
order, how = options.to_a.first
|
151
|
-
end
|
152
|
-
variable_name = registered_callbacks_variable_name(fixture, order)
|
153
|
-
add_fixture_callback(how, variable_name, method_name_or_callback)
|
154
|
-
end
|
155
|
-
|
156
|
-
def unregister_fixture_callback(fixture, method_name_or_callback)
|
157
|
-
variable_name = unregistered_callbacks_variable_name(fixture)
|
158
|
-
add_fixture_callback(:append, variable_name, method_name_or_callback)
|
159
|
-
end
|
160
|
-
|
161
|
-
def collect_fixture_callbacks(fixture, order)
|
162
|
-
callbacks_variable = registered_callbacks_variable_name(fixture, order)
|
163
|
-
unregistered_callbacks_variable =
|
164
|
-
unregistered_callbacks_variable_name(fixture)
|
165
|
-
|
166
|
-
base_index = ancestors.index(Fixture)
|
167
|
-
interested_ancestors = ancestors[0, base_index].reverse
|
168
|
-
interested_ancestors.inject([]) do |result, ancestor|
|
169
|
-
if ancestor.is_a?(Class)
|
170
|
-
ancestor.class_eval do
|
171
|
-
callbacks = instance_eval("#{callbacks_variable} ||= []")
|
172
|
-
unregistered_callbacks =
|
173
|
-
instance_eval("#{unregistered_callbacks_variable} ||= []")
|
174
|
-
(result | callbacks) - unregistered_callbacks
|
175
|
-
end
|
176
|
-
else
|
177
|
-
result
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
176
|
end
|
182
177
|
|
183
178
|
private
|
184
|
-
def run_fixture(
|
179
|
+
def run_fixture(type, options={})
|
185
180
|
[
|
186
|
-
|
187
|
-
|
188
|
-
|
181
|
+
self.class.fixture.before_callbacks(type),
|
182
|
+
type,
|
183
|
+
self.class.fixture.after_callbacks(type),
|
189
184
|
].flatten.each do |method_name_or_callback|
|
190
185
|
run_fixture_callback(method_name_or_callback, options)
|
191
186
|
end
|
@@ -199,7 +194,7 @@ module Test
|
|
199
194
|
else
|
200
195
|
return unless respond_to?(method_name_or_callback, true)
|
201
196
|
callback = lambda do
|
202
|
-
|
197
|
+
__send__(method_name_or_callback)
|
203
198
|
end
|
204
199
|
end
|
205
200
|
|
data/lib/test/unit/priority.rb
CHANGED
@@ -52,7 +52,7 @@ module Test
|
|
52
52
|
def need_to_run?(test)
|
53
53
|
priority = test[:priority] || Priority.default
|
54
54
|
if have_priority?(priority)
|
55
|
-
|
55
|
+
__send__(priority_check_method_name(priority), test)
|
56
56
|
else
|
57
57
|
true
|
58
58
|
end
|
@@ -105,7 +105,7 @@ module Test
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def teardown
|
108
|
-
if @test.
|
108
|
+
if @test.__send__(:passed?)
|
109
109
|
FileUtils.touch(passed_file)
|
110
110
|
else
|
111
111
|
FileUtils.rm_f(passed_file)
|
@@ -15,7 +15,7 @@ module Test
|
|
15
15
|
def create
|
16
16
|
suite = TestSuite.new(@test_case.name, @test_case)
|
17
17
|
collect_test_names.each do |test_name|
|
18
|
-
data_sets = @test_case.
|
18
|
+
data_sets = @test_case.find_attribute(test_name, :data)
|
19
19
|
if data_sets
|
20
20
|
data_sets.each do |data_set|
|
21
21
|
data_set = data_set.call if data_set.respond_to?(:call)
|
@@ -46,9 +46,10 @@ module Test
|
|
46
46
|
methods -= super_test_case.public_instance_methods(true)
|
47
47
|
method_names = methods.collect(&:to_s)
|
48
48
|
test_names = method_names.find_all do |method_name|
|
49
|
-
method_name =~ /^test./ or
|
49
|
+
method_name =~ /^test./ or
|
50
|
+
@test_case.find_attribute(method_name, :test)
|
50
51
|
end
|
51
|
-
|
52
|
+
__send__("sort_test_names_in_#{@test_case.test_order}_order", test_names)
|
52
53
|
end
|
53
54
|
|
54
55
|
def sort_test_names_in_alphabetic_order(test_names)
|
@@ -60,10 +61,10 @@ module Test
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def sort_test_names_in_defined_order(test_names)
|
63
|
-
|
64
|
+
added_method_names = @test_case.added_method_names
|
64
65
|
test_names.sort do |test1, test2|
|
65
|
-
test1_defined_order =
|
66
|
-
test2_defined_order =
|
66
|
+
test1_defined_order = added_method_names.index(test1)
|
67
|
+
test2_defined_order = added_method_names.index(test2)
|
67
68
|
if test1_defined_order and test2_defined_order
|
68
69
|
test1_defined_order <=> test2_defined_order
|
69
70
|
elsif test1_defined_order
|
data/lib/test/unit/testcase.rb
CHANGED
@@ -109,16 +109,15 @@ module Test
|
|
109
109
|
super
|
110
110
|
end
|
111
111
|
|
112
|
-
@@
|
112
|
+
@@added_method_names = {}
|
113
113
|
def method_added(name) # :nodoc:
|
114
114
|
super
|
115
|
-
|
115
|
+
added_method_names = (@@added_method_names[self] ||= {})
|
116
116
|
stringified_name = name.to_s
|
117
|
-
if
|
117
|
+
if added_method_names.key?(stringified_name)
|
118
118
|
attribute(:redefined, {:backtrace => caller}, {}, stringified_name)
|
119
119
|
end
|
120
|
-
|
121
|
-
source_location = _attributes[:source_location]
|
120
|
+
source_location = find_attribute(stringified_name, :source_location)
|
122
121
|
if source_location
|
123
122
|
path, line = source_location
|
124
123
|
else
|
@@ -130,11 +129,11 @@ module Test
|
|
130
129
|
:path => path,
|
131
130
|
:line => line,
|
132
131
|
}
|
133
|
-
|
132
|
+
added_method_names[stringified_name] = true
|
134
133
|
end
|
135
134
|
|
136
|
-
def
|
137
|
-
@@
|
135
|
+
def added_method_names # :nodoc:
|
136
|
+
(@@added_method_names[self] ||= {}).keys
|
138
137
|
end
|
139
138
|
|
140
139
|
# Rolls up all of the test* methods in the fixture into
|
@@ -339,7 +338,7 @@ module Test
|
|
339
338
|
parent_test_case = self
|
340
339
|
sub_test_case = Class.new(self) do
|
341
340
|
singleton_class = class << self; self; end
|
342
|
-
singleton_class.
|
341
|
+
singleton_class.__send__(:define_method, :name) do
|
343
342
|
[parent_test_case.name, name].compact.join("::")
|
344
343
|
end
|
345
344
|
end
|
@@ -704,7 +703,7 @@ module Test
|
|
704
703
|
if handler.respond_to?(:call)
|
705
704
|
handled = handler.call(self, exception)
|
706
705
|
else
|
707
|
-
handled =
|
706
|
+
handled = __send__(handler, exception)
|
708
707
|
end
|
709
708
|
return true if handled
|
710
709
|
end
|
data/lib/test/unit/testresult.rb
CHANGED
@@ -70,7 +70,7 @@ module Test
|
|
70
70
|
def summary
|
71
71
|
["#{run_count} tests",
|
72
72
|
"#{assertion_count} assertions",
|
73
|
-
*@summary_generators.collect {|generator|
|
73
|
+
*@summary_generators.collect {|generator| __send__(generator)}].join(", ")
|
74
74
|
end
|
75
75
|
|
76
76
|
# Returnes a string that shows result status.
|
@@ -99,7 +99,7 @@ module Test
|
|
99
99
|
# Returns whether or not this TestResult represents
|
100
100
|
# successful completion.
|
101
101
|
def passed?
|
102
|
-
@problem_checkers.all? {|checker| not
|
102
|
+
@problem_checkers.all? {|checker| not __send__(checker)}
|
103
103
|
end
|
104
104
|
|
105
105
|
def pass_percentage
|
@@ -511,15 +511,15 @@ module Test
|
|
511
511
|
|
512
512
|
private
|
513
513
|
def output_single(something, color=nil)
|
514
|
-
@runner.
|
514
|
+
@runner.__send__(:output_single, something, color)
|
515
515
|
end
|
516
516
|
|
517
517
|
def output(something, color=nil)
|
518
|
-
@runner.
|
518
|
+
@runner.__send__(:output, something, color)
|
519
519
|
end
|
520
520
|
|
521
521
|
def color(name)
|
522
|
-
@runner.
|
522
|
+
@runner.__send__(:color, name)
|
523
523
|
end
|
524
524
|
|
525
525
|
def cut_off_ratio
|
@@ -16,7 +16,7 @@ module Test
|
|
16
16
|
return super unless fault.respond_to?(:label)
|
17
17
|
format_method_name = "format_fault_#{fault.label.downcase}"
|
18
18
|
if respond_to?(format_method_name, true)
|
19
|
-
|
19
|
+
__send__(format_method_name, fault)
|
20
20
|
else
|
21
21
|
super
|
22
22
|
end
|
data/lib/test/unit/version.rb
CHANGED
data/test/test-assertions.rb
CHANGED
@@ -190,6 +190,23 @@ EOM
|
|
190
190
|
assert_equal("string1", "string2", "failed assert_equal")
|
191
191
|
}
|
192
192
|
end
|
193
|
+
|
194
|
+
def test_with_message_proc
|
195
|
+
message = <<-EOM.chomp
|
196
|
+
failed assert_equal.
|
197
|
+
<"string1"> expected but was
|
198
|
+
<"string2">.
|
199
|
+
|
200
|
+
diff:
|
201
|
+
- string1
|
202
|
+
? ^
|
203
|
+
+ string2
|
204
|
+
? ^
|
205
|
+
EOM
|
206
|
+
check_fail(message) do
|
207
|
+
assert_equal("string1", "string2", lambda {"failed assert_equal"})
|
208
|
+
end
|
209
|
+
end
|
193
210
|
end
|
194
211
|
|
195
212
|
class TestSystemMessage < self
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: power_assert
|
@@ -234,44 +234,44 @@ signing_key:
|
|
234
234
|
specification_version: 4
|
235
235
|
summary: An xUnit family unit testing framework for Ruby.
|
236
236
|
test_files:
|
237
|
-
- test/test-failure.rb
|
238
|
-
- test/test-emacs-runner.rb
|
239
237
|
- test/test-assertions.rb
|
240
|
-
- test/test-
|
241
|
-
- test/test-test-suite.rb
|
238
|
+
- test/test-color.rb
|
242
239
|
- test/test-code-snippet.rb
|
243
|
-
- test/test-
|
244
|
-
- test/test-
|
240
|
+
- test/test-test-suite-creator.rb
|
241
|
+
- test/test-test-result.rb
|
245
242
|
- test/test-error.rb
|
246
|
-
- test/test-
|
247
|
-
- test/
|
248
|
-
- test/
|
249
|
-
- test/
|
250
|
-
- test/
|
251
|
-
- test/util
|
243
|
+
- test/test-failure.rb
|
244
|
+
- test/run-test.rb
|
245
|
+
- test/test-pending.rb
|
246
|
+
- test/test-color-scheme.rb
|
247
|
+
- test/test-attribute-matcher.rb
|
248
|
+
- test/testunit-test-util.rb
|
249
|
+
- test/test-data.rb
|
250
|
+
- test/ui/test_testrunmediator.rb
|
252
251
|
- test/util/test-method-owner-finder.rb
|
253
252
|
- test/util/test-output.rb
|
254
|
-
- test/util/test_procwrapper.rb
|
255
253
|
- test/util/test_observable.rb
|
256
|
-
- test/
|
257
|
-
- test/
|
258
|
-
- test/test-
|
259
|
-
- test/
|
254
|
+
- test/util/test_backtracefilter.rb
|
255
|
+
- test/util/test_procwrapper.rb
|
256
|
+
- test/test-omission.rb
|
257
|
+
- test/test-test-case.rb
|
258
|
+
- test/test-fixture.rb
|
259
|
+
- test/fixtures/no-header.csv
|
260
260
|
- test/fixtures/header-label.tsv
|
261
|
+
- test/fixtures/plus.csv
|
261
262
|
- test/fixtures/no-header.tsv
|
262
263
|
- test/fixtures/header-label.csv
|
263
|
-
- test/fixtures/plus.csv
|
264
264
|
- test/fixtures/header.csv
|
265
|
-
- test/fixtures/
|
266
|
-
- test/test-
|
267
|
-
- test/
|
268
|
-
- test/
|
269
|
-
- test/
|
270
|
-
- test/test-
|
271
|
-
- test/test-test-
|
272
|
-
- test/test-
|
265
|
+
- test/fixtures/header.tsv
|
266
|
+
- test/collector/test-descendant.rb
|
267
|
+
- test/collector/test_objectspace.rb
|
268
|
+
- test/collector/test-load.rb
|
269
|
+
- test/collector/test_dir.rb
|
270
|
+
- test/test-priority.rb
|
271
|
+
- test/test-test-suite.rb
|
272
|
+
- test/test-diff.rb
|
273
|
+
- test/test-emacs-runner.rb
|
274
|
+
- test/test-attribute.rb
|
275
|
+
- test/test-fault-location-detector.rb
|
273
276
|
- test/test-notification.rb
|
274
|
-
- test/test-fixture.rb
|
275
|
-
- test/test-data.rb
|
276
|
-
- test/test-color.rb
|
277
277
|
has_rdoc:
|