test-unit 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +22 -0
- data/Manifest.txt +5 -3
- data/README.txt +2 -1
- data/images/color-diff.png +0 -0
- data/lib/test/unit.rb +20 -40
- data/lib/test/unit/assertionfailederror.rb +11 -0
- data/lib/test/unit/assertions.rb +30 -9
- data/lib/test/unit/autorunner.rb +32 -6
- data/lib/test/unit/collector/load.rb +3 -1
- data/lib/test/unit/color-scheme.rb +17 -1
- data/lib/test/unit/diff.rb +221 -37
- data/lib/test/unit/error.rb +7 -5
- data/lib/test/unit/failure.rb +27 -5
- data/lib/test/unit/runner/tap.rb +8 -0
- data/lib/test/unit/ui/console/testrunner.rb +251 -10
- data/lib/test/unit/ui/emacs/testrunner.rb +14 -0
- data/lib/test/unit/ui/tap/testrunner.rb +92 -0
- data/lib/test/unit/ui/testrunner.rb +8 -0
- data/lib/test/unit/version.rb +1 -1
- data/sample/{tc_adder.rb → test_adder.rb} +3 -1
- data/sample/{tc_subtracter.rb → test_subtracter.rb} +3 -1
- data/sample/test_user.rb +1 -0
- data/test/collector/test-load.rb +1 -5
- data/test/run-test.rb +2 -0
- data/test/test-color-scheme.rb +11 -0
- data/test/test-diff.rb +33 -7
- data/test/test_assertions.rb +8 -10
- metadata +15 -13
- data/sample/ts_examples.rb +0 -7
@@ -14,6 +14,14 @@ module Test
|
|
14
14
|
end
|
15
15
|
@options = options
|
16
16
|
end
|
17
|
+
|
18
|
+
def diff_target_string?(string)
|
19
|
+
Assertions::AssertionMessage.diff_target_string?(string)
|
20
|
+
end
|
21
|
+
|
22
|
+
def prepare_for_diff(from, to)
|
23
|
+
Assertions::AssertionMessage.prepare_for_diff(from, to)
|
24
|
+
end
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
data/lib/test/unit/version.rb
CHANGED
@@ -5,13 +5,15 @@
|
|
5
5
|
require 'test/unit'
|
6
6
|
require 'adder'
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestAdder < Test::Unit::TestCase
|
9
9
|
def setup
|
10
10
|
@adder = Adder.new(5)
|
11
11
|
end
|
12
|
+
|
12
13
|
def test_add
|
13
14
|
assert_equal(7, @adder.add(2), "Should have added correctly")
|
14
15
|
end
|
16
|
+
|
15
17
|
def teardown
|
16
18
|
@adder = nil
|
17
19
|
end
|
@@ -5,13 +5,15 @@
|
|
5
5
|
require 'test/unit'
|
6
6
|
require 'subtracter'
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestSubtracter < Test::Unit::TestCase
|
9
9
|
def setup
|
10
10
|
@subtracter = Subtracter.new(5)
|
11
11
|
end
|
12
|
+
|
12
13
|
def test_subtract
|
13
14
|
assert_equal(3, @subtracter.subtract(2), "Should have subtracted correctly")
|
14
15
|
end
|
16
|
+
|
15
17
|
def teardown
|
16
18
|
@subtracter = nil
|
17
19
|
end
|
data/sample/test_user.rb
CHANGED
data/test/collector/test-load.rb
CHANGED
@@ -240,11 +240,7 @@ EOT
|
|
240
240
|
[:test, {:name => "test1_2"}]]],
|
241
241
|
@test_case1.to_s)
|
242
242
|
|
243
|
-
assert_collect(
|
244
|
-
[:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
|
245
|
-
[:test, {:name => "test5_1"}],
|
246
|
-
[:test, {:name => "test5_2"}]]],
|
247
|
-
@no_load_sub_test_case5.to_s)
|
243
|
+
assert_collect(nil, @no_load_sub_test_case5.to_s)
|
248
244
|
end
|
249
245
|
|
250
246
|
def test_nil_pattern
|
data/test/run-test.rb
CHANGED
data/test/test-color-scheme.rb
CHANGED
@@ -8,6 +8,17 @@ class TestUnitColorScheme < Test::Unit::TestCase
|
|
8
8
|
"notification" => color("cyan", :bold => true),
|
9
9
|
"error" => color("yellow", :bold => true) +
|
10
10
|
color("black", :foreground => false),
|
11
|
+
"case" => color("white", :bold => true) +
|
12
|
+
color("blue", :foreground => false),
|
13
|
+
"suite" => color("white", :bold => true) +
|
14
|
+
color("green", :foreground => false),
|
15
|
+
"diff-inserted-tag" => color("red", :bold => true),
|
16
|
+
"diff-deleted-tag" => color("green", :bold => true),
|
17
|
+
"diff-difference-tag" => color("cyan", :bold => true),
|
18
|
+
"diff-inserted" => color("red", :foreground => false) +
|
19
|
+
color("white", :bold => true),
|
20
|
+
"diff-deleted" => color("green", :foreground => false) +
|
21
|
+
color("white", :bold => true),
|
11
22
|
},
|
12
23
|
Test::Unit::ColorScheme.default.to_hash)
|
13
24
|
end
|
data/test/test-diff.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
class TestUnitDiff < Test::Unit::TestCase
|
2
|
+
def test_binary_search_ranges
|
3
|
+
assert_found_binary_search_ranges(5, [1..2, 4..5, 7..9])
|
4
|
+
assert_not_found_binary_search_ranges(3, [1..2, 4..5, 7..9])
|
5
|
+
end
|
6
|
+
|
2
7
|
def test_to_indexes
|
3
8
|
assert_to_indexes({"abc def" => [0, 2], "abc" => [1]},
|
4
9
|
["abc def", "abc", "abc def"])
|
@@ -387,6 +392,18 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
387
392
|
end
|
388
393
|
|
389
394
|
private
|
395
|
+
def assert_found_binary_search_ranges(numeric, ranges)
|
396
|
+
assert_true(Test::Unit::Diff::UTF8Line.send(:binary_search_ranges,
|
397
|
+
numeric,
|
398
|
+
ranges))
|
399
|
+
end
|
400
|
+
|
401
|
+
def assert_not_found_binary_search_ranges(numeric, ranges)
|
402
|
+
assert_false(Test::Unit::Diff::UTF8Line.send(:binary_search_ranges,
|
403
|
+
numeric,
|
404
|
+
ranges))
|
405
|
+
end
|
406
|
+
|
390
407
|
def assert_to_indexes(expected, to, &junk_predicate)
|
391
408
|
matcher = Test::Unit::Diff::SequenceMatcher.new([""], to, &junk_predicate)
|
392
409
|
assert_equal(expected, matcher.instance_variable_get("@to_indexes"))
|
@@ -451,21 +468,30 @@ class TestUnitDiff < Test::Unit::TestCase
|
|
451
468
|
from_start, from_end,
|
452
469
|
to_start, to_end)
|
453
470
|
differ = Test::Unit::Diff::ReadableDiffer.new(from, to)
|
454
|
-
|
455
|
-
|
456
|
-
|
471
|
+
result = []
|
472
|
+
differ.instance_variable_set("@result", result)
|
473
|
+
differ.send(:diff_lines,
|
474
|
+
from_start, from_end,
|
475
|
+
to_start, to_end)
|
476
|
+
assert_equal(expected, result)
|
457
477
|
end
|
458
478
|
|
459
479
|
def assert_diff_line(expected, from_line, to_line)
|
460
480
|
differ = Test::Unit::Diff::ReadableDiffer.new([""], [""])
|
461
|
-
|
481
|
+
result = []
|
482
|
+
differ.instance_variable_set("@result", result)
|
483
|
+
differ.send(:diff_line, from_line, to_line)
|
484
|
+
assert_equal(expected, result)
|
462
485
|
end
|
463
486
|
|
464
487
|
def assert_format_diff_point(expected, from_line, to_line, from_tags, to_tags)
|
465
488
|
differ = Test::Unit::Diff::ReadableDiffer.new([""], [""])
|
466
|
-
|
467
|
-
|
468
|
-
|
489
|
+
result = []
|
490
|
+
differ.instance_variable_set("@result", result)
|
491
|
+
differ.send(:format_diff_point,
|
492
|
+
from_line, to_line,
|
493
|
+
from_tags, to_tags)
|
494
|
+
assert_equal(expected, result)
|
469
495
|
end
|
470
496
|
|
471
497
|
def assert_interesting_line(expected, from, to, from_start, to_start)
|
data/test/test_assertions.rb
CHANGED
@@ -248,32 +248,30 @@ EOM
|
|
248
248
|
|
249
249
|
def test_assert_equal_with_large_string
|
250
250
|
message = <<-EOM.chomp
|
251
|
-
<#{("a\n" + "x" *
|
251
|
+
<#{("a\n" + "x" * 997).inspect}> expected but was
|
252
252
|
<#{"x".inspect}>.
|
253
253
|
|
254
254
|
diff:
|
255
255
|
+ x
|
256
256
|
- a
|
257
|
-
- #{"x" *
|
257
|
+
- #{"x" * 997}
|
258
258
|
|
259
259
|
folded diff:
|
260
260
|
+ x
|
261
261
|
- a
|
262
|
-
|
263
|
-
- #{"x" *
|
264
|
-
- #{"x" * 78}
|
265
|
-
- #{"x" * 63}
|
262
|
+
#{(["- " + ("x" * 78)] * 12).join("\n")}
|
263
|
+
- #{"x" * 61}
|
266
264
|
EOM
|
267
265
|
check_fails(message) do
|
268
|
-
assert_equal("a\n" + "x" *
|
266
|
+
assert_equal("a\n" + "x" * 997, "x")
|
269
267
|
end
|
270
268
|
|
271
269
|
message = <<-EOM.chomp
|
272
|
-
<#{("a\n" + "x" *
|
270
|
+
<#{("a\n" + "x" * 998).inspect}> expected but was
|
273
271
|
<#{"x".inspect}>.
|
274
272
|
EOM
|
275
273
|
check_fails(message) do
|
276
|
-
assert_equal("a\n" + "x" *
|
274
|
+
assert_equal("a\n" + "x" * 998, "x")
|
277
275
|
end
|
278
276
|
end
|
279
277
|
|
@@ -1064,7 +1062,7 @@ EOM
|
|
1064
1062
|
end
|
1065
1063
|
|
1066
1064
|
private
|
1067
|
-
def add_failure(message, location=caller)
|
1065
|
+
def add_failure(message, location=caller, options=nil)
|
1068
1066
|
unless @catch_assertions
|
1069
1067
|
super
|
1070
1068
|
end
|
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: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-10-17 00:00:00 +09:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -21,13 +21,13 @@ dependencies:
|
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 2.3.
|
24
|
+
version: 2.3.3
|
25
25
|
version:
|
26
26
|
description: |-
|
27
27
|
Test::Unit 2.x - Improved version of Test::Unit bundled in
|
28
28
|
Ruby 1.8.x.
|
29
29
|
|
30
|
-
Ruby 1.9.x bundles
|
30
|
+
Ruby 1.9.x bundles minitest not Test::Unit. Test::Unit
|
31
31
|
bundled in Ruby 1.8.x had not been improved but unbundled
|
32
32
|
Test::Unit (Test::Unit 2.x) will be improved actively.
|
33
33
|
email:
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- html/index.html
|
53
53
|
- html/index.html.ja
|
54
54
|
- html/test-unit-classic.png
|
55
|
+
- images/color-diff.png
|
55
56
|
- lib/test/unit.rb
|
56
57
|
- lib/test/unit/assertionfailederror.rb
|
57
58
|
- lib/test/unit/assertions.rb
|
@@ -75,12 +76,14 @@ files:
|
|
75
76
|
- lib/test/unit/priority.rb
|
76
77
|
- lib/test/unit/runner/console.rb
|
77
78
|
- lib/test/unit/runner/emacs.rb
|
79
|
+
- lib/test/unit/runner/tap.rb
|
78
80
|
- lib/test/unit/testcase.rb
|
79
81
|
- lib/test/unit/testresult.rb
|
80
82
|
- lib/test/unit/testsuite.rb
|
81
83
|
- lib/test/unit/ui/console/outputlevel.rb
|
82
84
|
- lib/test/unit/ui/console/testrunner.rb
|
83
85
|
- lib/test/unit/ui/emacs/testrunner.rb
|
86
|
+
- lib/test/unit/ui/tap/testrunner.rb
|
84
87
|
- lib/test/unit/ui/testrunner.rb
|
85
88
|
- lib/test/unit/ui/testrunnermediator.rb
|
86
89
|
- lib/test/unit/ui/testrunnerutilities.rb
|
@@ -91,10 +94,9 @@ files:
|
|
91
94
|
- lib/test/unit/version.rb
|
92
95
|
- sample/adder.rb
|
93
96
|
- sample/subtracter.rb
|
94
|
-
- sample/
|
95
|
-
- sample/
|
97
|
+
- sample/test_adder.rb
|
98
|
+
- sample/test_subtracter.rb
|
96
99
|
- sample/test_user.rb
|
97
|
-
- sample/ts_examples.rb
|
98
100
|
- test/collector/test-descendant.rb
|
99
101
|
- test/collector/test-load.rb
|
100
102
|
- test/collector/test_dir.rb
|
@@ -147,19 +149,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
149
|
requirements: []
|
148
150
|
|
149
151
|
rubyforge_project: test-unit
|
150
|
-
rubygems_version: 1.3.
|
152
|
+
rubygems_version: 1.3.5
|
151
153
|
signing_key:
|
152
154
|
specification_version: 3
|
153
155
|
summary: Test::Unit 2.x - Improved version of Test::Unit bundled in Ruby 1.8.x
|
154
156
|
test_files:
|
155
|
-
- test/
|
157
|
+
- test/test_failure.rb
|
156
158
|
- test/collector/test_objectspace.rb
|
157
|
-
- test/
|
159
|
+
- test/collector/test_dir.rb
|
160
|
+
- test/test_testsuite.rb
|
158
161
|
- test/test_assertions.rb
|
162
|
+
- test/util/test_observable.rb
|
159
163
|
- test/util/test_procwrapper.rb
|
160
164
|
- test/util/test_backtracefilter.rb
|
161
|
-
- test/
|
162
|
-
- test/test_failure.rb
|
163
|
-
- test/test_testsuite.rb
|
165
|
+
- test/ui/test_testrunmediator.rb
|
164
166
|
- test/test_testresult.rb
|
165
167
|
- test/test_error.rb
|