test-unit 2.3.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -1
- data/Rakefile +8 -2
- data/lib/test/unit/assertions.rb +7 -0
- data/lib/test/unit/autorunner.rb +9 -0
- data/lib/test/unit/color-scheme.rb +75 -28
- data/lib/test/unit/color.rb +30 -3
- data/lib/test/unit/data.rb +1 -1
- data/lib/test/unit/error.rb +24 -4
- data/lib/test/unit/notification.rb +6 -2
- data/lib/test/unit/runner/console.rb +2 -2
- data/lib/test/unit/testcase.rb +5 -3
- data/lib/test/unit/ui/console/testrunner.rb +16 -8
- data/lib/test/unit/version.rb +1 -1
- data/test/fixtures/plus.csv +3 -0
- data/test/test-color-scheme.rb +39 -26
- data/test/test-data.rb +3 -5
- data/test/test-testcase.rb +19 -0
- metadata +73 -60
data/README.textile
CHANGED
@@ -78,7 +78,8 @@ h2. Thanks
|
|
78
78
|
* Andrew Grimm: A bug report.
|
79
79
|
* Champak Ch: A bug report.
|
80
80
|
* Florian Frank: A bug report.
|
81
|
-
* grafi-tt:
|
81
|
+
* grafi-tt: Bug fixes and reports.
|
82
82
|
* Jeremy Stephens: A bug report.
|
83
83
|
* Hans de Graaff: Bug reports.
|
84
84
|
* James Mead: A bug report.
|
85
|
+
* Marc Seeger (Acquia): A bug report.
|
data/Rakefile
CHANGED
@@ -10,6 +10,8 @@ require "yard"
|
|
10
10
|
require "jeweler"
|
11
11
|
require "./lib/test/unit/version.rb"
|
12
12
|
|
13
|
+
task :default => :test
|
14
|
+
|
13
15
|
def cleanup_white_space(entry)
|
14
16
|
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
|
15
17
|
end
|
@@ -32,13 +34,13 @@ Jeweler::Tasks.new do |_spec|
|
|
32
34
|
spec.files = FileList["lib/**/*.rb",
|
33
35
|
"bin/*",
|
34
36
|
"sample/*.rb",
|
37
|
+
"test/**/*",
|
35
38
|
"README.textile",
|
36
39
|
"TODO",
|
37
40
|
"Rakefile",
|
38
41
|
"COPYING",
|
39
42
|
"GPL",
|
40
43
|
"PSFL"]
|
41
|
-
spec.test_files = FileList["test/**/*.rb"]
|
42
44
|
end
|
43
45
|
|
44
46
|
Rake::Task["release"].prerequisites.clear
|
@@ -118,7 +120,7 @@ end
|
|
118
120
|
namespace :reference do
|
119
121
|
translate_languages = [:ja]
|
120
122
|
supported_languages = [:en, *translate_languages]
|
121
|
-
html_files = FileList[doc_en_dir + "**/*.html"].to_a
|
123
|
+
html_files = FileList[(doc_en_dir + "**/*.html").to_s].to_a
|
122
124
|
|
123
125
|
directory reference_base_dir.to_s
|
124
126
|
CLOBBER.include(reference_base_dir.to_s)
|
@@ -323,4 +325,8 @@ namespace :release do
|
|
323
325
|
task :rubyforge => "release:rubyforge:upload"
|
324
326
|
end
|
325
327
|
|
328
|
+
task :test do
|
329
|
+
ruby("test/run-test.rb")
|
330
|
+
end
|
331
|
+
|
326
332
|
# vim: syntax=Ruby
|
data/lib/test/unit/assertions.rb
CHANGED
@@ -1431,6 +1431,8 @@ EOT
|
|
1431
1431
|
|
1432
1432
|
MAX_DIFF_TARGET_STRING_SIZE = 1000
|
1433
1433
|
def max_diff_target_string_size
|
1434
|
+
return @@max_diff_target_string_size if @@max_diff_target_string_size
|
1435
|
+
|
1434
1436
|
size = ENV["TEST_UNIT_MAX_DIFF_TARGET_STRING_SIZE"]
|
1435
1437
|
if size
|
1436
1438
|
begin
|
@@ -1442,6 +1444,11 @@ EOT
|
|
1442
1444
|
size || MAX_DIFF_TARGET_STRING_SIZE
|
1443
1445
|
end
|
1444
1446
|
|
1447
|
+
@@max_diff_target_string_size = nil
|
1448
|
+
def max_diff_target_string_size=(size)
|
1449
|
+
@@max_diff_target_string_size = size
|
1450
|
+
end
|
1451
|
+
|
1445
1452
|
def diff_target_string?(string)
|
1446
1453
|
if string.respond_to?(:bytesize)
|
1447
1454
|
string.bytesize < max_diff_target_string_size
|
data/lib/test/unit/autorunner.rb
CHANGED
@@ -296,6 +296,15 @@ module Test
|
|
296
296
|
TestCase.test_order = order
|
297
297
|
end
|
298
298
|
|
299
|
+
assertion_message_class = Test::Unit::Assertions::AssertionMessage
|
300
|
+
o.on("--max-diff-target-string-size=SIZE", Integer,
|
301
|
+
"Shows diff if both expected result string size and " +
|
302
|
+
"actual result string size are " +
|
303
|
+
"less than or equal SIZE in bytes.",
|
304
|
+
"(#{assertion_message_class.max_diff_target_string_size})") do |size|
|
305
|
+
assertion_message_class.max_diff_target_string_size = size
|
306
|
+
end
|
307
|
+
|
299
308
|
ADDITIONAL_OPTIONS.each do |option_builder|
|
300
309
|
option_builder.call(self, o)
|
301
310
|
end
|
@@ -6,35 +6,68 @@ module Test
|
|
6
6
|
include Enumerable
|
7
7
|
|
8
8
|
class << self
|
9
|
-
@@default = nil
|
10
9
|
def default
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
10
|
+
if available_colors == 256
|
11
|
+
default_for_256_colors
|
12
|
+
else
|
13
|
+
default_for_8_colors
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
@@default_for_8_colors = nil
|
18
|
+
def default_for_8_colors
|
19
|
+
@@default_for_8_colors ||=
|
20
|
+
new("pass" => Color.new("green", :foreground => false) +
|
21
|
+
Color.new("white", :bold => true),
|
22
|
+
"failure" => Color.new("red", :foreground => false) +
|
23
|
+
Color.new("white", :bold => true),
|
24
|
+
"pending" => Color.new("magenta", :bold => true),
|
25
|
+
"omission" => Color.new("blue", :bold => true),
|
26
|
+
"notification" => Color.new("cyan", :bold => true),
|
27
|
+
"error" => Color.new("yellow", :bold => true) +
|
28
|
+
Color.new("black", :foreground => false),
|
29
|
+
"case" => Color.new("white", :bold => true) +
|
30
|
+
Color.new("blue", :foreground => false),
|
31
|
+
"suite" => Color.new("white", :bold => true) +
|
32
|
+
Color.new("green", :foreground => false),
|
33
|
+
"diff-inserted-tag" => Color.new("red", :bold => true),
|
34
|
+
"diff-deleted-tag" => Color.new("green", :bold => true),
|
35
|
+
"diff-difference-tag" => Color.new("cyan", :bold => true),
|
36
|
+
"diff-inserted" => Color.new("red", :foreground => false) +
|
37
|
+
Color.new("white", :bold => true),
|
38
|
+
"diff-deleted" => Color.new("green", :foreground => false) +
|
39
|
+
Color.new("white", :bold => true))
|
40
|
+
end
|
41
|
+
|
42
|
+
@@default_for_256_colors = nil
|
43
|
+
def default_for_256_colors
|
44
|
+
@@default_for_256_colors ||=
|
45
|
+
new("pass" => Color.new("030", :foreground => false) +
|
46
|
+
Color.new("555", :bold => true),
|
47
|
+
"failure" => Color.new("300", :foreground => false) +
|
48
|
+
Color.new("555", :bold => true),
|
49
|
+
"pending" => Color.new("303", :foreground => false) +
|
50
|
+
Color.new("555", :bold => true),
|
51
|
+
"omission" => Color.new("001", :foreground => false) +
|
52
|
+
Color.new("555", :bold => true),
|
53
|
+
"notification" => Color.new("011", :foreground => false) +
|
54
|
+
Color.new("555", :bold => true),
|
55
|
+
"error" => Color.new("550", :bold => true) +
|
56
|
+
Color.new("000", :foreground => false),
|
57
|
+
"case" => Color.new("220", :foreground => false) +
|
58
|
+
Color.new("555", :bold => true),
|
59
|
+
"suite" => Color.new("110", :foreground => false) +
|
60
|
+
Color.new("555", :bold => true),
|
61
|
+
"diff-inserted-tag" => Color.new("500", :foreground => false) +
|
62
|
+
Color.new("000", :bold => true),
|
63
|
+
"diff-deleted-tag" => Color.new("050", :foreground => false) +
|
64
|
+
Color.new("000", :bold => true),
|
65
|
+
"diff-difference-tag" => Color.new("005", :foreground => false) +
|
66
|
+
Color.new("555", :bold => true),
|
67
|
+
"diff-inserted" => Color.new("300", :foreground => false) +
|
68
|
+
Color.new("555", :bold => true),
|
69
|
+
"diff-deleted" => Color.new("030", :foreground => false) +
|
70
|
+
Color.new("555", :bold => true))
|
38
71
|
end
|
39
72
|
|
40
73
|
@@schemes = {}
|
@@ -54,6 +87,20 @@ module Test
|
|
54
87
|
end
|
55
88
|
@@schemes[id.to_s] = scheme
|
56
89
|
end
|
90
|
+
|
91
|
+
def available_colors
|
92
|
+
case ENV["COLORTERM"]
|
93
|
+
when "gnome-terminal"
|
94
|
+
256
|
95
|
+
else
|
96
|
+
case ENV["TERM"]
|
97
|
+
when "xterm-256color"
|
98
|
+
256
|
99
|
+
else
|
100
|
+
8
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
57
104
|
end
|
58
105
|
|
59
106
|
def initialize(scheme_spec)
|
data/lib/test/unit/color.rb
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
module Test
|
2
2
|
module Unit
|
3
3
|
class Color
|
4
|
+
class Error < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
class ParseError < Error
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def parse_256_color(string)
|
12
|
+
case string
|
13
|
+
when /\A([0-5])([0-5])([0-5])\z/
|
14
|
+
red, green, blue = $1, $2, $3
|
15
|
+
red.to_i * 36 + green.to_i * 6 + blue.to_i + 16
|
16
|
+
else
|
17
|
+
message = "must be 'RGB' format and R, G and B " +
|
18
|
+
"are in 0-5: #{string.inspect}"
|
19
|
+
raise ParseError, message
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
4
24
|
NAMES = ["black", "red", "green", "yellow",
|
5
25
|
"blue", "magenta", "cyan", "white"]
|
6
26
|
|
@@ -49,9 +69,16 @@ module Test
|
|
49
69
|
elsif @name == "reset"
|
50
70
|
sequence << "0"
|
51
71
|
else
|
52
|
-
|
53
|
-
|
54
|
-
|
72
|
+
if NAMES.include?(@name)
|
73
|
+
foreground_parameter = foreground? ? 3 : 4
|
74
|
+
foreground_parameter += 6 if intensity?
|
75
|
+
color = NAMES.index(@name)
|
76
|
+
sequence << "#{foreground_parameter}#{color}"
|
77
|
+
else
|
78
|
+
sequence << (foreground? ? "38" : "48")
|
79
|
+
sequence << "5"
|
80
|
+
sequence << self.class.parse_256_color(@name).to_s
|
81
|
+
end
|
55
82
|
end
|
56
83
|
sequence << "1" if bold?
|
57
84
|
sequence << "3" if italic?
|
data/lib/test/unit/data.rb
CHANGED
@@ -19,7 +19,7 @@ module Test
|
|
19
19
|
when 2
|
20
20
|
data_set = {arguments[0] => arguments[1]}
|
21
21
|
else
|
22
|
-
message= "wrong number arguments(#{n_arguments} for 1..2)"
|
22
|
+
message = "wrong number arguments(#{n_arguments} for 1..2)"
|
23
23
|
raise ArgumentError, message
|
24
24
|
end
|
25
25
|
current_data = current_attribute(:data)[:value] || []
|
data/lib/test/unit/error.rb
CHANGED
@@ -75,19 +75,39 @@ module Test
|
|
75
75
|
end
|
76
76
|
|
77
77
|
NOT_PASS_THROUGH_EXCEPTIONS = []
|
78
|
+
NOT_PASS_THROUGH_EXCEPTION_NAMES = ["Timeout::Error"]
|
78
79
|
PASS_THROUGH_EXCEPTIONS = [NoMemoryError, SignalException, Interrupt,
|
79
80
|
SystemExit]
|
81
|
+
PASS_THROUGH_EXCEPTION_NAMES = []
|
80
82
|
private
|
81
83
|
def handle_all_exception(exception)
|
84
|
+
return false if pass_through_exception?(exception)
|
85
|
+
|
86
|
+
problem_occurred
|
87
|
+
add_error(exception)
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
def pass_through_exception?(exception)
|
82
92
|
case exception
|
83
93
|
when *NOT_PASS_THROUGH_EXCEPTIONS
|
84
|
-
|
94
|
+
return false
|
95
|
+
end
|
96
|
+
case exception.class.name
|
97
|
+
when *NOT_PASS_THROUGH_EXCEPTION_NAMES
|
85
98
|
return false
|
86
99
|
end
|
87
100
|
|
88
|
-
|
89
|
-
|
90
|
-
|
101
|
+
case exception
|
102
|
+
when *PASS_THROUGH_EXCEPTIONS
|
103
|
+
return true
|
104
|
+
end
|
105
|
+
case exception.class.name
|
106
|
+
when *PASS_THROUGH_EXCEPTION_NAMES
|
107
|
+
return true
|
108
|
+
end
|
109
|
+
|
110
|
+
false
|
91
111
|
end
|
92
112
|
|
93
113
|
def add_error(exception)
|
@@ -69,8 +69,12 @@ module Test
|
|
69
69
|
# notify("Special!") if special_case?
|
70
70
|
# # Reached here too
|
71
71
|
# end
|
72
|
-
|
73
|
-
|
72
|
+
#
|
73
|
+
# options:
|
74
|
+
# :backtrace override backtrace.
|
75
|
+
def notify(message, options={}, &block)
|
76
|
+
backtrace = filter_backtrace(options[:backtrace] || caller)
|
77
|
+
notification = Notification.new(name, backtrace, message)
|
74
78
|
add_notification(notification)
|
75
79
|
end
|
76
80
|
|
@@ -49,9 +49,9 @@ module Test
|
|
49
49
|
auto_runner.runner_options[:progress_row_max] = max
|
50
50
|
end
|
51
51
|
|
52
|
-
opts.on("--
|
52
|
+
opts.on("--no-show-detail-immediately",
|
53
53
|
"Shows not passed test details immediately.",
|
54
|
-
"(default is
|
54
|
+
"(default is yes)") do |boolean|
|
55
55
|
auto_runner.runner_options[:show_detail_immediately] = boolean
|
56
56
|
end
|
57
57
|
end
|
data/lib/test/unit/testcase.rb
CHANGED
@@ -113,7 +113,7 @@ module Test
|
|
113
113
|
_added_methods = added_methods
|
114
114
|
stringified_name = name.to_s
|
115
115
|
if _added_methods.include?(stringified_name)
|
116
|
-
attribute(:redefined,
|
116
|
+
attribute(:redefined, {:backtrace => caller}, {}, stringified_name)
|
117
117
|
end
|
118
118
|
_added_methods << stringified_name
|
119
119
|
end
|
@@ -520,8 +520,10 @@ module Test
|
|
520
520
|
end
|
521
521
|
|
522
522
|
def run_test
|
523
|
-
|
524
|
-
|
523
|
+
redefined_info = self[:redefined]
|
524
|
+
if redefined_info
|
525
|
+
notify("#{self.class}\##{@method_name} was redefined",
|
526
|
+
:backtrace => redefined_info[:backtrace])
|
525
527
|
end
|
526
528
|
if @internal_data.have_test_data?
|
527
529
|
__send__(@method_name, @internal_data.test_data)
|
@@ -38,6 +38,7 @@ module Test
|
|
38
38
|
@progress_row_max = @options[:progress_row_max]
|
39
39
|
@progress_row_max ||= guess_progress_row_max
|
40
40
|
@show_detail_immediately = @options[:show_detail_immediately]
|
41
|
+
@show_detail_immediately = true if @show_detail_immediately.nil?
|
41
42
|
@already_outputted = false
|
42
43
|
@indent = 0
|
43
44
|
@top_level = true
|
@@ -100,7 +101,7 @@ module Test
|
|
100
101
|
def finished(elapsed_time)
|
101
102
|
nl if output?(NORMAL) and !output?(VERBOSE)
|
102
103
|
output_faults unless @show_detail_immediately
|
103
|
-
nl(
|
104
|
+
nl(PROGRESS_ONLY)
|
104
105
|
change_output_level(IMPORTANT_FAULTS_ONLY) do
|
105
106
|
output_statistics(elapsed_time)
|
106
107
|
end
|
@@ -127,7 +128,7 @@ module Test
|
|
127
128
|
faults.each_with_index do |fault, index|
|
128
129
|
nl
|
129
130
|
output_single("%#{digit}d) " % (index + 1))
|
130
|
-
|
131
|
+
output_fault_in_detail(fault)
|
131
132
|
end
|
132
133
|
end
|
133
134
|
|
@@ -139,9 +140,7 @@ module Test
|
|
139
140
|
output(":")
|
140
141
|
faults.each_with_index do |fault, index|
|
141
142
|
output_single("%#{digit}d) " % (index + 1))
|
142
|
-
|
143
|
-
output(" [#{fault.test_name}]")
|
144
|
-
output(fault.location.first)
|
143
|
+
output_fault_in_short(fault)
|
145
144
|
end
|
146
145
|
end
|
147
146
|
|
@@ -166,7 +165,7 @@ module Test
|
|
166
165
|
end
|
167
166
|
end
|
168
167
|
|
169
|
-
def
|
168
|
+
def output_fault_in_detail(fault)
|
170
169
|
if @use_color and fault.is_a?(Failure) and
|
171
170
|
fault.inspected_expected and fault.inspected_actual
|
172
171
|
output_single(fault.label, fault_color(fault))
|
@@ -250,6 +249,12 @@ module Test
|
|
250
249
|
end
|
251
250
|
end
|
252
251
|
|
252
|
+
def output_fault_in_short(fault)
|
253
|
+
output_single(fault.message, fault_color(fault))
|
254
|
+
output(" [#{fault.test_name}]")
|
255
|
+
output(fault.location.first)
|
256
|
+
end
|
257
|
+
|
253
258
|
def format_fault(fault)
|
254
259
|
fault.long_display
|
255
260
|
end
|
@@ -358,10 +363,13 @@ module Test
|
|
358
363
|
|
359
364
|
def output_progress_in_detail(fault)
|
360
365
|
return if @output_level == SILENT
|
361
|
-
return unless categorize_fault(fault) == :need_detail_faults
|
362
366
|
nl
|
363
367
|
nl
|
364
|
-
|
368
|
+
if categorize_fault(fault) == :need_detail_faults
|
369
|
+
output_fault_in_detail(fault)
|
370
|
+
else
|
371
|
+
output_fault_in_short(fault)
|
372
|
+
end
|
365
373
|
nl
|
366
374
|
end
|
367
375
|
|
data/lib/test/unit/version.rb
CHANGED
data/test/test-color-scheme.rb
CHANGED
@@ -1,30 +1,4 @@
|
|
1
1
|
class TestUnitColorScheme < Test::Unit::TestCase
|
2
|
-
def test_default
|
3
|
-
assert_equal({
|
4
|
-
"pass" => color("green", :foreground => false) +
|
5
|
-
color("white", :bold => true),
|
6
|
-
"failure" => color("red", :foreground => false) +
|
7
|
-
color("white", :bold => true),
|
8
|
-
"pending" => color("magenta", :bold => true),
|
9
|
-
"omission" => color("blue", :bold => true),
|
10
|
-
"notification" => color("cyan", :bold => true),
|
11
|
-
"error" => color("yellow", :bold => true) +
|
12
|
-
color("black", :foreground => false),
|
13
|
-
"case" => color("white", :bold => true) +
|
14
|
-
color("blue", :foreground => false),
|
15
|
-
"suite" => color("white", :bold => true) +
|
16
|
-
color("green", :foreground => false),
|
17
|
-
"diff-inserted-tag" => color("red", :bold => true),
|
18
|
-
"diff-deleted-tag" => color("green", :bold => true),
|
19
|
-
"diff-difference-tag" => color("cyan", :bold => true),
|
20
|
-
"diff-inserted" => color("red", :foreground => false) +
|
21
|
-
color("white", :bold => true),
|
22
|
-
"diff-deleted" => color("green", :foreground => false) +
|
23
|
-
color("white", :bold => true),
|
24
|
-
},
|
25
|
-
Test::Unit::ColorScheme.default.to_hash)
|
26
|
-
end
|
27
|
-
|
28
2
|
def test_register
|
29
3
|
inverted_scheme_spec = {
|
30
4
|
"success" => {:name => "red"},
|
@@ -66,4 +40,43 @@ class TestUnitColorScheme < Test::Unit::TestCase
|
|
66
40
|
def color(name, options={})
|
67
41
|
Test::Unit::Color.new(name, options)
|
68
42
|
end
|
43
|
+
|
44
|
+
class TestFor8Colors < self
|
45
|
+
def setup
|
46
|
+
@original_term, ENV["TERM"] = ENV["TERM"], nil
|
47
|
+
@original_color_term, ENV["COLORTERM"] = ENV["COLORTERM"], nil
|
48
|
+
ENV["TERM"] = "xterm"
|
49
|
+
end
|
50
|
+
|
51
|
+
def teardown
|
52
|
+
ENV["TERM"] = @original_term
|
53
|
+
ENV["COLORTERM"] = @original_color_term
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_default
|
57
|
+
assert_equal({
|
58
|
+
"pass" => color("green", :foreground => false) +
|
59
|
+
color("white", :bold => true),
|
60
|
+
"failure" => color("red", :foreground => false) +
|
61
|
+
color("white", :bold => true),
|
62
|
+
"pending" => color("magenta", :bold => true),
|
63
|
+
"omission" => color("blue", :bold => true),
|
64
|
+
"notification" => color("cyan", :bold => true),
|
65
|
+
"error" => color("yellow", :bold => true) +
|
66
|
+
color("black", :foreground => false),
|
67
|
+
"case" => color("white", :bold => true) +
|
68
|
+
color("blue", :foreground => false),
|
69
|
+
"suite" => color("white", :bold => true) +
|
70
|
+
color("green", :foreground => false),
|
71
|
+
"diff-inserted-tag" => color("red", :bold => true),
|
72
|
+
"diff-deleted-tag" => color("green", :bold => true),
|
73
|
+
"diff-difference-tag" => color("cyan", :bold => true),
|
74
|
+
"diff-inserted" => color("red", :foreground => false) +
|
75
|
+
color("white", :bold => true),
|
76
|
+
"diff-deleted" => color("green", :foreground => false) +
|
77
|
+
color("white", :bold => true),
|
78
|
+
},
|
79
|
+
Test::Unit::ColorScheme.default.to_hash)
|
80
|
+
end
|
81
|
+
end
|
69
82
|
end
|
data/test/test-data.rb
CHANGED
@@ -150,19 +150,17 @@ class TestData < Test::Unit::TestCase
|
|
150
150
|
"n-data" => TestCalc::TestNData,
|
151
151
|
"dynamic-data-set" => TestCalc::TestDynamicDataSet,
|
152
152
|
"load-data-set" => TestCalc::TestLoadDataSet)
|
153
|
-
|
154
153
|
def test_suite(test_case)
|
155
154
|
suite = test_case.suite
|
156
|
-
assert_equal(["test_plus[positive
|
157
|
-
"test_plus[positive
|
158
|
-
suite.tests.collect {|test| test.name})
|
155
|
+
assert_equal(["test_plus[positive negative](#{test_case.name})",
|
156
|
+
"test_plus[positive positive](#{test_case.name})"],
|
157
|
+
suite.tests.collect {|test| test.name}.sort)
|
159
158
|
end
|
160
159
|
|
161
160
|
data("data set" => TestCalc::TestDataSet,
|
162
161
|
"n-data" => TestCalc::TestNData,
|
163
162
|
"dynamic-data-set" => TestCalc::TestDynamicDataSet,
|
164
163
|
"load-data-set" => TestCalc::TestLoadDataSet)
|
165
|
-
|
166
164
|
def test_run(test_case)
|
167
165
|
result = _run_test(test_case)
|
168
166
|
assert_equal("2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, " \
|
data/test/test-testcase.rb
CHANGED
@@ -279,6 +279,25 @@ module Test
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
+
def test_timeout_error
|
283
|
+
test_case = Class.new(TestCase) do
|
284
|
+
def test_raise_timeout_error
|
285
|
+
require "timeout"
|
286
|
+
raise Timeout::Error
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
test_suite = test_case.suite
|
291
|
+
result = TestResult.new
|
292
|
+
begin
|
293
|
+
test_suite.run(result) {}
|
294
|
+
check("Timeout::Error should be handled as error",
|
295
|
+
result.error_count == 1)
|
296
|
+
rescue Exception
|
297
|
+
check("Timeout::Error should not be passed through: #{$!}", false)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
282
301
|
def test_startup_shutdown
|
283
302
|
called = []
|
284
303
|
test_case = Class.new(TestCase) do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 2.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kouhei Sutou
|
@@ -16,9 +16,50 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
20
|
-
dependencies:
|
21
|
-
|
19
|
+
date: 2011-09-18 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
name: rake
|
32
|
+
prerelease: false
|
33
|
+
type: :development
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
name: yard
|
46
|
+
prerelease: false
|
47
|
+
type: :development
|
48
|
+
requirement: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
name: jeweler
|
60
|
+
prerelease: false
|
61
|
+
type: :development
|
62
|
+
requirement: *id003
|
22
63
|
description: |
|
23
64
|
Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit
|
24
65
|
bundled in Ruby 1.8.x had not been improved but unbundled
|
@@ -92,36 +133,37 @@ files:
|
|
92
133
|
- sample/test_adder.rb
|
93
134
|
- sample/test_subtracter.rb
|
94
135
|
- sample/test_user.rb
|
95
|
-
- test/testunit-test-util.rb
|
96
|
-
- test/test-testcase.rb
|
97
|
-
- test/ui/test_testrunmediator.rb
|
98
|
-
- test/ui/test_tap.rb
|
99
|
-
- test/test_testresult.rb
|
100
|
-
- test/test-pending.rb
|
101
|
-
- test/test-emacs-runner.rb
|
102
|
-
- test/test-fixture.rb
|
103
|
-
- test/test-attribute.rb
|
104
|
-
- test/test_failure.rb
|
105
|
-
- test/test-data.rb
|
106
|
-
- test/test_testsuite.rb
|
107
|
-
- test/collector/test_objectspace.rb
|
108
136
|
- test/collector/test-descendant.rb
|
109
|
-
- test/collector/test_dir.rb
|
110
137
|
- test/collector/test-load.rb
|
138
|
+
- test/collector/test_dir.rb
|
139
|
+
- test/collector/test_objectspace.rb
|
140
|
+
- test/fixtures/plus.csv
|
111
141
|
- test/run-test.rb
|
112
142
|
- test/test-assertions.rb
|
143
|
+
- test/test-attribute.rb
|
144
|
+
- test/test-color-scheme.rb
|
145
|
+
- test/test-color.rb
|
146
|
+
- test/test-data.rb
|
147
|
+
- test/test-diff.rb
|
148
|
+
- test/test-emacs-runner.rb
|
149
|
+
- test/test-fixture.rb
|
150
|
+
- test/test-notification.rb
|
151
|
+
- test/test-omission.rb
|
152
|
+
- test/test-pending.rb
|
113
153
|
- test/test-priority.rb
|
154
|
+
- test/test-testcase.rb
|
155
|
+
- test/test_error.rb
|
156
|
+
- test/test_failure.rb
|
157
|
+
- test/test_testresult.rb
|
158
|
+
- test/test_testsuite.rb
|
159
|
+
- test/testunit-test-util.rb
|
160
|
+
- test/ui/test_tap.rb
|
161
|
+
- test/ui/test_testrunmediator.rb
|
162
|
+
- test/util/test-method-owner-finder.rb
|
163
|
+
- test/util/test-output.rb
|
114
164
|
- test/util/test_backtracefilter.rb
|
115
165
|
- test/util/test_observable.rb
|
116
166
|
- test/util/test_procwrapper.rb
|
117
|
-
- test/util/test-method-owner-finder.rb
|
118
|
-
- test/util/test-output.rb
|
119
|
-
- test/test_error.rb
|
120
|
-
- test/test-diff.rb
|
121
|
-
- test/test-notification.rb
|
122
|
-
- test/test-color-scheme.rb
|
123
|
-
- test/test-omission.rb
|
124
|
-
- test/test-color.rb
|
125
167
|
homepage: http://test-unit.rubyforge.org/
|
126
168
|
licenses:
|
127
169
|
- Ruby's and PSFL (lib/test/unit/diff.rb)
|
@@ -155,34 +197,5 @@ rubygems_version: 1.7.2
|
|
155
197
|
signing_key:
|
156
198
|
specification_version: 3
|
157
199
|
summary: test-unit 2 - Improved version of Test::Unit bundled in Ruby 1.8.x.
|
158
|
-
test_files:
|
159
|
-
|
160
|
-
- test/test-testcase.rb
|
161
|
-
- test/ui/test_testrunmediator.rb
|
162
|
-
- test/ui/test_tap.rb
|
163
|
-
- test/test_testresult.rb
|
164
|
-
- test/test-pending.rb
|
165
|
-
- test/test-emacs-runner.rb
|
166
|
-
- test/test-fixture.rb
|
167
|
-
- test/test-attribute.rb
|
168
|
-
- test/test_failure.rb
|
169
|
-
- test/test-data.rb
|
170
|
-
- test/test_testsuite.rb
|
171
|
-
- test/collector/test_objectspace.rb
|
172
|
-
- test/collector/test-descendant.rb
|
173
|
-
- test/collector/test_dir.rb
|
174
|
-
- test/collector/test-load.rb
|
175
|
-
- test/run-test.rb
|
176
|
-
- test/test-assertions.rb
|
177
|
-
- test/test-priority.rb
|
178
|
-
- test/util/test_backtracefilter.rb
|
179
|
-
- test/util/test_observable.rb
|
180
|
-
- test/util/test_procwrapper.rb
|
181
|
-
- test/util/test-method-owner-finder.rb
|
182
|
-
- test/util/test-output.rb
|
183
|
-
- test/test_error.rb
|
184
|
-
- test/test-diff.rb
|
185
|
-
- test/test-notification.rb
|
186
|
-
- test/test-color-scheme.rb
|
187
|
-
- test/test-omission.rb
|
188
|
-
- test/test-color.rb
|
200
|
+
test_files: []
|
201
|
+
|