test-unit 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +9 -1
- data/{README.txt → README.textile} +24 -17
- data/Rakefile +301 -27
- data/lib/test/unit/assertions.rb +49 -23
- data/lib/test/unit/attribute.rb +1 -1
- data/lib/test/unit/collector/load.rb +3 -3
- data/lib/test/unit/runner/console.rb +11 -4
- data/lib/test/unit/testcase.rb +1 -1
- data/lib/test/unit/ui/console/outputlevel.rb +3 -2
- data/lib/test/unit/ui/console/testrunner.rb +101 -22
- data/lib/test/unit/version.rb +1 -1
- data/test/test-assertions.rb +20 -0
- data/test/test-data.rb +1 -1
- data/test/test-priority.rb +17 -2
- data/test/test-testcase.rb +3 -3
- metadata +62 -111
- data/History.txt +0 -302
- data/Manifest.txt +0 -118
- data/html/bar.png +0 -0
- data/html/bar.svg +0 -153
- data/html/developer.png +0 -0
- data/html/developer.svg +0 -469
- data/html/famfamfam-logo.png +0 -0
- data/html/favicon.ico +0 -0
- data/html/favicon.png +0 -0
- data/html/favicon.svg +0 -82
- data/html/github-logo.png +0 -0
- data/html/heading-mark.png +0 -0
- data/html/heading-mark.svg +0 -393
- data/html/index.html +0 -291
- data/html/index.html.ja +0 -306
- data/html/install.png +0 -0
- data/html/install.svg +0 -636
- data/html/jp.png +0 -0
- data/html/kinotan-failure.png +0 -0
- data/html/kinotan-pass.png +0 -0
- data/html/logo.png +0 -0
- data/html/logo.svg +0 -483
- data/html/reference.png +0 -0
- data/html/rubyforge.png +0 -0
- data/html/tango-logo.png +0 -0
- data/html/test-unit.css +0 -346
- data/html/tutorial.png +0 -0
- data/html/tutorial.svg +0 -559
- data/html/us.png +0 -0
- data/images/color-diff.png +0 -0
- data/test/fixtures/plus.csv +0 -3
data/COPYING
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
test-unit is copyrighted free software by Kouhei Sutou
|
2
|
+
<kou@cozmixng.org>, Ryan Davis <ryand-ruby@zenspider.com>
|
3
|
+
and Nathaniel Talbott <nathaniel@talbott.ws>.
|
4
|
+
|
2
5
|
You can redistribute it and/or modify it under either the terms of the GPL
|
3
6
|
version 2 (see the file GPL), or the conditions below:
|
4
7
|
|
@@ -54,3 +57,8 @@ version 2 (see the file GPL), or the conditions below:
|
|
54
57
|
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
58
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
59
|
PURPOSE.
|
60
|
+
|
61
|
+
Exceptions
|
62
|
+
----------
|
63
|
+
|
64
|
+
* lib/test/unit/diff.rb: PSFL
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
1
|
+
h1. test-unit 2
|
2
2
|
|
3
|
-
|
3
|
+
http://rubyforge.org/projects/test-unit/
|
4
4
|
|
5
|
-
|
5
|
+
h2. Description
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
test-unit 2 - Improved version of Test::Unit bundled in Ruby
|
8
|
+
1.8.x.
|
9
9
|
|
10
10
|
Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit
|
11
11
|
bundled in Ruby 1.8.x had not been improved but unbundled
|
12
|
-
Test::Unit (
|
12
|
+
Test::Unit (test-unit 2) will be improved actively.
|
13
13
|
|
14
|
-
|
14
|
+
h2. Features
|
15
15
|
|
16
16
|
* Test::Unit 1.2.3 is the original Test::Unit, taken
|
17
17
|
straight from the ruby distribution. It is being
|
@@ -19,7 +19,7 @@ Test::Unit (Test::Unit 2.x) will be improved actively.
|
|
19
19
|
stand-alone package. (The test framework in ruby is going
|
20
20
|
to radically change very soon).
|
21
21
|
|
22
|
-
*
|
22
|
+
* test-unit 2 will be improved actively and may break
|
23
23
|
compatiblity with Test::Unit 1.2.3. (We will not hope it
|
24
24
|
if it isn't needed.)
|
25
25
|
|
@@ -28,15 +28,19 @@ Test::Unit (Test::Unit 2.x) will be improved actively.
|
|
28
28
|
provides for installing all Test::Unit related gems
|
29
29
|
easily.
|
30
30
|
|
31
|
-
|
31
|
+
h2. Install
|
32
32
|
|
33
|
-
|
33
|
+
<pre>
|
34
|
+
% sudo gem install test-unit
|
35
|
+
</pre>
|
34
36
|
|
35
37
|
If you want to use full Test::Unit features:
|
36
38
|
|
37
|
-
|
39
|
+
<pre>
|
40
|
+
% sudo gem install test-unit-full
|
41
|
+
</pre>
|
38
42
|
|
39
|
-
|
43
|
+
h2. License
|
40
44
|
|
41
45
|
(The Ruby License)
|
42
46
|
|
@@ -45,23 +49,23 @@ This software is distributed under the same terms as ruby.
|
|
45
49
|
Exception: lib/test/unit/diff.rb is a dual license of the
|
46
50
|
Ruby license and PSF license.
|
47
51
|
|
48
|
-
|
52
|
+
h2. Authors
|
49
53
|
|
50
|
-
|
54
|
+
h3. Active
|
51
55
|
|
52
56
|
* Kouhei Sutou: The current maintainer
|
53
57
|
* Haruka Yoshihara: Data driven test supports.
|
54
58
|
|
55
|
-
|
59
|
+
h3. Inactive
|
56
60
|
|
57
61
|
* Nathaniel Talbott: The original author
|
58
62
|
* Ryan Davis: The second maintainer
|
59
63
|
|
60
|
-
|
64
|
+
h3. Images
|
61
65
|
|
62
66
|
* Mayu & Co.: kinotan icons: http://cocooooooon.com/kinotan/
|
63
67
|
|
64
|
-
|
68
|
+
h2. Thanks
|
65
69
|
|
66
70
|
* Daniel Berger: Suggestions and bug reports.
|
67
71
|
* Designing Patterns: Suggestions.
|
@@ -74,3 +78,6 @@ Ruby license and PSF license.
|
|
74
78
|
* Andrew Grimm: A bug report.
|
75
79
|
* Champak Ch: A bug report.
|
76
80
|
* Florian Frank: A bug report.
|
81
|
+
* grafi-tt: A bug fix.
|
82
|
+
* Jeremy Stephens: A bug report.
|
83
|
+
* Hans de Graaff: Bug reports.
|
data/Rakefile
CHANGED
@@ -2,51 +2,325 @@
|
|
2
2
|
|
3
3
|
Encoding.default_internal = "UTF-8" if defined?(Encoding.default_internal)
|
4
4
|
|
5
|
-
require
|
6
|
-
|
7
|
-
require
|
8
|
-
require
|
5
|
+
require "erb"
|
6
|
+
require "yaml"
|
7
|
+
require "rubygems"
|
8
|
+
require "rake/clean"
|
9
|
+
require "yard"
|
10
|
+
require "jeweler"
|
11
|
+
require "./lib/test/unit/version.rb"
|
9
12
|
|
10
|
-
|
13
|
+
def cleanup_white_space(entry)
|
14
|
+
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
|
15
|
+
end
|
11
16
|
|
12
|
-
version = Test::Unit::VERSION
|
17
|
+
version = Test::Unit::VERSION.dup
|
13
18
|
ENV["VERSION"] = version
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
spec = nil
|
20
|
+
Jeweler::Tasks.new do |_spec|
|
21
|
+
spec = _spec
|
22
|
+
spec.name = "test-unit"
|
23
|
+
spec.version = version
|
24
|
+
spec.rubyforge_project = "test-unit"
|
25
|
+
spec.homepage = "http://test-unit.rubyforge.org/"
|
26
|
+
spec.authors = ["Kouhei Sutou", "Haruka Yoshihara"]
|
27
|
+
spec.email = ["kou@cozmixng.org", "yoshihara@clear-code.com"]
|
28
|
+
entries = File.read("README.textile").split(/^h2\.\s(.*)$/)
|
29
|
+
description = cleanup_white_space(entries[entries.index("Description") + 1])
|
30
|
+
spec.summary, spec.description, = description.split(/\n\n+/, 3)
|
31
|
+
spec.license = "Ruby's and PSFL (lib/test/unit/diff.rb)"
|
32
|
+
spec.files = FileList["lib/**/*.rb",
|
33
|
+
"bin/*",
|
34
|
+
"sample/*.rb",
|
35
|
+
"README.textile",
|
36
|
+
"TODO",
|
37
|
+
"Rakefile",
|
38
|
+
"COPYING",
|
39
|
+
"GPL",
|
40
|
+
"PSFL"]
|
41
|
+
spec.test_files = FileList["test/**/*.rb"]
|
42
|
+
end
|
43
|
+
|
44
|
+
Rake::Task["release"].prerequisites.clear
|
45
|
+
Jeweler::RubygemsDotOrgTasks.new do
|
46
|
+
end
|
47
|
+
|
48
|
+
reference_base_dir = Pathname.new("doc/reference")
|
49
|
+
doc_en_dir = reference_base_dir + "en"
|
50
|
+
html_base_dir = Pathname.new("doc/html")
|
51
|
+
html_reference_dir = html_base_dir + spec.name
|
52
|
+
YARD::Rake::YardocTask.new do |task|
|
53
|
+
task.options += ["--title", spec.name]
|
54
|
+
# task.options += ["--charset", "UTF-8"]
|
55
|
+
task.options += ["--readme", "README.textile"]
|
56
|
+
task.options += ["--files", "doc/text/**/*"]
|
57
|
+
task.options += ["--output-dir", doc_en_dir.to_s]
|
58
|
+
task.options += ["--charset", "utf-8"]
|
59
|
+
task.files += FileList["lib/**/*.rb"]
|
60
|
+
end
|
19
61
|
|
20
|
-
|
21
|
-
|
62
|
+
task :yard do
|
63
|
+
doc_en_dir.find do |path|
|
64
|
+
next if path.extname != ".html"
|
65
|
+
html = path.read
|
66
|
+
html = html.gsub(/<div id="footer">.+<\/div>/m,
|
67
|
+
"<div id=\"footer\"></div>")
|
68
|
+
path.open("w") do |html_file|
|
69
|
+
html_file.print(html)
|
70
|
+
end
|
71
|
+
end
|
22
72
|
end
|
23
73
|
|
24
|
-
|
25
|
-
|
74
|
+
include ERB::Util
|
75
|
+
|
76
|
+
def apply_template(content, paths, templates, language)
|
77
|
+
content = content.sub(/lang="en"/, "lang=\"#{language}\"")
|
78
|
+
|
79
|
+
title = nil
|
80
|
+
content = content.sub(/<title>(.+?)<\/title>/m) do
|
81
|
+
title = $1
|
82
|
+
templates[:head].result(binding)
|
83
|
+
end
|
84
|
+
|
85
|
+
content = content.sub(/<body(?:.*?)>/) do |body_start|
|
86
|
+
"#{body_start}\n#{templates[:header].result(binding)}\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
content = content.sub(/<\/body/) do |body_end|
|
90
|
+
"\n#{templates[:footer].result(binding)}\n#{body_end}"
|
91
|
+
end
|
26
92
|
|
27
|
-
|
28
|
-
test_results = Dir.glob("**/.test-result")
|
29
|
-
sh("rm", "-rf", *test_results) unless test_results.empty?
|
93
|
+
content
|
30
94
|
end
|
31
95
|
|
32
|
-
|
33
|
-
|
96
|
+
def erb_template(name)
|
97
|
+
file = File.join("doc/templates", "#{name}.html.erb")
|
98
|
+
template = File.read(file)
|
99
|
+
erb = ERB.new(template, nil, "-")
|
100
|
+
erb.filename = file
|
101
|
+
erb
|
34
102
|
end
|
35
103
|
|
36
|
-
|
37
|
-
task :publish_html do
|
104
|
+
def rsync_to_rubyforge(spec, source, destination, options={})
|
38
105
|
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
39
106
|
host = "#{config["username"]}@rubyforge.org"
|
40
107
|
|
41
|
-
rsync_args = "-av --exclude '*.erb' --
|
42
|
-
|
43
|
-
|
108
|
+
rsync_args = "-av --exclude '*.erb' --chmod=ug+w"
|
109
|
+
rsync_args << " --delete" if options[:delete]
|
110
|
+
remote_dir = "/var/www/gforge-projects/#{spec.rubyforge_project}/"
|
111
|
+
sh("rsync #{rsync_args} #{source} #{host}:#{remote_dir}#{destination}")
|
44
112
|
end
|
45
113
|
|
114
|
+
def rake(*arguments)
|
115
|
+
ruby($0, *arguments)
|
116
|
+
end
|
117
|
+
|
118
|
+
namespace :reference do
|
119
|
+
translate_languages = [:ja]
|
120
|
+
supported_languages = [:en, *translate_languages]
|
121
|
+
html_files = FileList[doc_en_dir + "**/*.html"].to_a
|
122
|
+
|
123
|
+
directory reference_base_dir.to_s
|
124
|
+
CLOBBER.include(reference_base_dir.to_s)
|
125
|
+
|
126
|
+
po_dir = "doc/po"
|
127
|
+
pot_file = "#{po_dir}/#{spec.name}.pot"
|
128
|
+
namespace :pot do
|
129
|
+
directory po_dir
|
130
|
+
file pot_file => [po_dir, *html_files] do |t|
|
131
|
+
sh("xml2po", "--keep-entities", "--output", t.name, *html_files)
|
132
|
+
end
|
133
|
+
|
134
|
+
desc "Generates pot file."
|
135
|
+
task :generate => pot_file
|
136
|
+
end
|
137
|
+
|
138
|
+
namespace :po do
|
139
|
+
translate_languages.each do |language|
|
140
|
+
namespace language do
|
141
|
+
po_file = "#{po_dir}/#{language}.po"
|
142
|
+
|
143
|
+
if File.exist?(po_file)
|
144
|
+
file po_file => html_files do |t|
|
145
|
+
sh("xml2po", "--keep-entities", "--update", t.name, *html_files)
|
146
|
+
end
|
147
|
+
else
|
148
|
+
file po_file => pot_file do |t|
|
149
|
+
sh("msginit",
|
150
|
+
"--input=#{pot_file}",
|
151
|
+
"--output=#{t.name}",
|
152
|
+
"--locale=#{language}")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
desc "Updates po file for #{language}."
|
157
|
+
task :update => po_file
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
desc "Updates po files."
|
162
|
+
task :update do
|
163
|
+
ruby($0, "clobber")
|
164
|
+
ruby($0, "yard")
|
165
|
+
translate_languages.each do |language|
|
166
|
+
ruby($0, "reference:po:#{language}:update")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
namespace :translate do
|
172
|
+
translate_languages.each do |language|
|
173
|
+
po_file = "#{po_dir}/#{language}.po"
|
174
|
+
translate_doc_dir = "#{reference_base_dir}/#{language}"
|
175
|
+
|
176
|
+
desc "Translates documents to #{language}."
|
177
|
+
task language => [po_file, reference_base_dir, *html_files] do
|
178
|
+
doc_en_dir.find do |path|
|
179
|
+
base_path = path.relative_path_from(doc_en_dir)
|
180
|
+
translated_path = "#{translate_doc_dir}/#{base_path}"
|
181
|
+
if path.directory?
|
182
|
+
mkdir_p(translated_path)
|
183
|
+
next
|
184
|
+
end
|
185
|
+
case path.extname
|
186
|
+
when ".html"
|
187
|
+
sh("xml2po --keep-entities " +
|
188
|
+
"--po-file #{po_file} --language #{language} " +
|
189
|
+
"#{path} > #{translated_path}")
|
190
|
+
else
|
191
|
+
cp(path.to_s, translated_path, :preserve => true)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
translate_task_names = translate_languages.collect do |language|
|
199
|
+
"reference:translate:#{language}"
|
200
|
+
end
|
201
|
+
desc "Translates references."
|
202
|
+
task :translate => translate_task_names
|
203
|
+
|
204
|
+
desc "Generates references."
|
205
|
+
task :generate => [:yard, :translate]
|
206
|
+
|
207
|
+
namespace :publication do
|
208
|
+
task :prepare do
|
209
|
+
supported_languages.each do |language|
|
210
|
+
raw_reference_dir = reference_base_dir + language.to_s
|
211
|
+
prepared_reference_dir = html_reference_dir + language.to_s
|
212
|
+
rm_rf(prepared_reference_dir.to_s)
|
213
|
+
head = erb_template("head.#{language}")
|
214
|
+
header = erb_template("header.#{language}")
|
215
|
+
footer = erb_template("footer.#{language}")
|
216
|
+
raw_reference_dir.find do |path|
|
217
|
+
relative_path = path.relative_path_from(raw_reference_dir)
|
218
|
+
prepared_path = prepared_reference_dir + relative_path
|
219
|
+
if path.directory?
|
220
|
+
mkdir_p(prepared_path.to_s)
|
221
|
+
else
|
222
|
+
case path.basename.to_s
|
223
|
+
when /(?:file|method|class)_list\.html\z/
|
224
|
+
cp(path.to_s, prepared_path.to_s)
|
225
|
+
when /\.html\z/
|
226
|
+
relative_dir_path = relative_path.dirname
|
227
|
+
current_path = relative_dir_path + path.basename
|
228
|
+
if current_path.basename.to_s == "index.html"
|
229
|
+
current_path = current_path.dirname
|
230
|
+
end
|
231
|
+
top_path = html_base_dir.relative_path_from(prepared_path.dirname)
|
232
|
+
paths = {
|
233
|
+
:top => top_path,
|
234
|
+
:current => current_path,
|
235
|
+
}
|
236
|
+
templates = {
|
237
|
+
:head => head,
|
238
|
+
:header => header,
|
239
|
+
:footer => footer
|
240
|
+
}
|
241
|
+
content = apply_template(File.read(path.to_s),
|
242
|
+
paths,
|
243
|
+
templates,
|
244
|
+
language)
|
245
|
+
File.open(prepared_path.to_s, "w") do |file|
|
246
|
+
file.print(content)
|
247
|
+
end
|
248
|
+
else
|
249
|
+
cp(path.to_s, prepared_path.to_s)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
File.open("#{html_reference_dir}/.htaccess", "w") do |file|
|
255
|
+
file.puts("RedirectMatch permanent ^/#{spec.name}/$ " +
|
256
|
+
"#{spec.homepage}#{spec.name}/en/")
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
desc "Upload document to rubyforge."
|
262
|
+
task :publish => [:generate, "reference:publication:prepare"] do
|
263
|
+
rsync_to_rubyforge(spec, "#{html_reference_dir}/", spec.name)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
namespace :html do
|
268
|
+
desc "Publish HTML to Web site."
|
269
|
+
task :publish do
|
270
|
+
rsync_to_rubyforge(spec, "#{html_base_dir}/", "")
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
desc "Upload document and HTML to rubyforge."
|
275
|
+
task :publish => ["html:publish", "reference:publish"]
|
276
|
+
|
46
277
|
desc "Tag the current revision."
|
47
278
|
task :tag do
|
48
|
-
|
49
|
-
|
279
|
+
sh("git tag -a #{version} -m 'release #{version}!!!'")
|
280
|
+
end
|
281
|
+
|
282
|
+
namespace :release do
|
283
|
+
namespace :info do
|
284
|
+
desc "update version in index HTML."
|
285
|
+
task :update do
|
286
|
+
old_version = ENV["OLD_VERSION"]
|
287
|
+
old_release_date = ENV["OLD_RELEASE_DATE"]
|
288
|
+
new_release_date = ENV["RELEASE_DATE"] || Time.now.strftime("%Y-%m-%d")
|
289
|
+
new_version = ENV["VERSION"]
|
290
|
+
|
291
|
+
empty_options = []
|
292
|
+
empty_options << "OLD_VERSION" if old_version.nil?
|
293
|
+
empty_options << "OLD_RELEASE_DATE" if old_release_date.nil?
|
294
|
+
|
295
|
+
unless empty_options.empty?
|
296
|
+
raise ArgumentError, "Specify option(s) of #{empty_options.join(", ")}."
|
297
|
+
end
|
298
|
+
|
299
|
+
indexes = ["doc/html/index.html", "doc/html/index.html.ja"]
|
300
|
+
indexes.each do |index|
|
301
|
+
content = replaced_content = File.read(index)
|
302
|
+
[[old_version, new_version],
|
303
|
+
[old_release_date, new_release_date]].each do |old, new|
|
304
|
+
replaced_content = replaced_content.gsub(/#{Regexp.escape(old)}/, new)
|
305
|
+
if /\./ =~ old
|
306
|
+
old_underscore = old.gsub(/\./, '-')
|
307
|
+
new_underscore = new.gsub(/\./, '-')
|
308
|
+
replaced_content =
|
309
|
+
replaced_content.gsub(/#{Regexp.escape(old_underscore)}/,
|
310
|
+
new_underscore)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
next if replaced_content == content
|
315
|
+
File.open(index, "w") do |output|
|
316
|
+
output.print(replaced_content)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
desc "Release to RubyForge."
|
323
|
+
task :rubyforge => "release:rubyforge:upload"
|
50
324
|
end
|
51
325
|
|
52
326
|
# vim: syntax=Ruby
|