test-unit 3.4.4 → 3.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/Rakefile +0 -9
  4. data/doc/text/getting-started.md +1 -1
  5. data/doc/text/news.md +54 -1
  6. data/lib/test/unit/assertion-failed-error.rb +35 -0
  7. data/lib/test/unit/assertions.rb +93 -17
  8. data/lib/test/unit/autorunner.rb +13 -1
  9. data/lib/test/unit/collector/descendant.rb +1 -0
  10. data/lib/test/unit/collector/dir.rb +4 -2
  11. data/lib/test/unit/collector/load.rb +2 -0
  12. data/lib/test/unit/collector/objectspace.rb +1 -0
  13. data/lib/test/unit/collector.rb +31 -0
  14. data/lib/test/unit/testcase.rb +34 -1
  15. data/lib/test/unit/testsuite.rb +1 -1
  16. data/lib/test/unit/util/memory-usage.rb +47 -0
  17. data/lib/test/unit/version.rb +1 -1
  18. data/lib/test/unit.rb +4 -4
  19. metadata +6 -83
  20. data/test/collector/test-descendant.rb +0 -182
  21. data/test/collector/test-load.rb +0 -475
  22. data/test/collector/test_dir.rb +0 -407
  23. data/test/collector/test_objectspace.rb +0 -102
  24. data/test/fixtures/header-label.csv +0 -3
  25. data/test/fixtures/header-label.tsv +0 -3
  26. data/test/fixtures/header.csv +0 -3
  27. data/test/fixtures/header.tsv +0 -3
  28. data/test/fixtures/no-header.csv +0 -2
  29. data/test/fixtures/no-header.tsv +0 -2
  30. data/test/fixtures/plus.csv +0 -3
  31. data/test/run-test.rb +0 -22
  32. data/test/test-assertions.rb +0 -2281
  33. data/test/test-attribute-matcher.rb +0 -38
  34. data/test/test-attribute.rb +0 -123
  35. data/test/test-code-snippet.rb +0 -79
  36. data/test/test-color-scheme.rb +0 -123
  37. data/test/test-color.rb +0 -47
  38. data/test/test-data.rb +0 -419
  39. data/test/test-diff.rb +0 -518
  40. data/test/test-emacs-runner.rb +0 -60
  41. data/test/test-error.rb +0 -26
  42. data/test/test-failure.rb +0 -33
  43. data/test/test-fault-location-detector.rb +0 -163
  44. data/test/test-fixture.rb +0 -713
  45. data/test/test-notification.rb +0 -33
  46. data/test/test-omission.rb +0 -81
  47. data/test/test-pending.rb +0 -70
  48. data/test/test-priority.rb +0 -184
  49. data/test/test-test-case.rb +0 -1284
  50. data/test/test-test-result.rb +0 -113
  51. data/test/test-test-suite-creator.rb +0 -97
  52. data/test/test-test-suite.rb +0 -151
  53. data/test/testunit-test-util.rb +0 -33
  54. data/test/ui/test_testrunmediator.rb +0 -20
  55. data/test/util/test-method-owner-finder.rb +0 -38
  56. data/test/util/test-output.rb +0 -11
  57. data/test/util/test_backtracefilter.rb +0 -52
  58. data/test/util/test_observable.rb +0 -102
  59. data/test/util/test_procwrapper.rb +0 -36
@@ -1,33 +0,0 @@
1
- require 'test/unit'
2
- require 'testunit-test-util'
3
-
4
- class TestUnitNotification < Test::Unit::TestCase
5
- include TestUnitTestUtil
6
-
7
- class TestCase < Test::Unit::TestCase
8
- class << self
9
- def suite
10
- Test::Unit::TestSuite.new(name)
11
- end
12
- end
13
-
14
- def test_notify
15
- notify("1st notify")
16
- notify("2nd notify. Reach here.")
17
- end
18
- end
19
-
20
- def test_notify
21
- result = _run_test("test_notify")
22
- assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
23
- "0 omissions, 2 notifications",
24
- result.to_s)
25
- assert_fault_messages(["1st notify", "2nd notify. Reach here."],
26
- result.notifications)
27
- end
28
-
29
- private
30
- def _run_test(name)
31
- super(TestCase, name)
32
- end
33
- end
@@ -1,81 +0,0 @@
1
- require 'test/unit'
2
- require 'testunit-test-util'
3
-
4
- class TestUnitOmission < Test::Unit::TestCase
5
- include TestUnitTestUtil
6
-
7
- class TestCase < Test::Unit::TestCase
8
- class << self
9
- def suite
10
- Test::Unit::TestSuite.new(name)
11
- end
12
- end
13
-
14
- def test_omit
15
- omit("1st omit")
16
- omit("2nd omit. Should not be reached here.")
17
- assert(true, "Should not be reached here too.")
18
- end
19
-
20
- def test_omit_with_condition
21
- omit_if(false, "Never omit.")
22
- omit_unless(true, "Never omit too.")
23
- omit_if(true, "Should omit.")
24
- omit("The last omit. Should not be reached here.")
25
- end
26
-
27
- def test_omit_with_block
28
- omit("Omit block") do
29
- flunk("Should not be reached here.")
30
- end
31
- assert(true, "Should be reached here.")
32
- end
33
-
34
- def test_omit_with_block_and_condition
35
- omit_if(false, "Never omit.") do
36
- assert(true, "Should be reached here.")
37
- end
38
- omit_if(true, "Should omit.") do
39
- flunk("Never reached here.")
40
- end
41
- assert(true, "Should be reached here too.")
42
- end
43
- end
44
-
45
- def test_omit
46
- result = _run_test("test_omit")
47
- assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
48
- "1 omissions, 0 notifications",
49
- result.to_s)
50
- assert_fault_messages(["1st omit"], result.omissions)
51
- end
52
-
53
- def test_omit_with_condition
54
- result = _run_test("test_omit_with_condition")
55
- assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, " \
56
- "1 omissions, 0 notifications",
57
- result.to_s)
58
- assert_fault_messages(["Should omit."], result.omissions)
59
- end
60
-
61
- def test_omit_with_block
62
- result = _run_test("test_omit_with_block")
63
- assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, " \
64
- "1 omissions, 0 notifications",
65
- result.to_s)
66
- assert_fault_messages(["Omit block"], result.omissions)
67
- end
68
-
69
- def test_omit_with_condition_and_block
70
- result = _run_test("test_omit_with_block_and_condition")
71
- assert_equal("1 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, " \
72
- "1 omissions, 0 notifications",
73
- result.to_s)
74
- assert_fault_messages(["Should omit."], result.omissions)
75
- end
76
-
77
- private
78
- def _run_test(name)
79
- super(TestCase, name)
80
- end
81
- end
data/test/test-pending.rb DELETED
@@ -1,70 +0,0 @@
1
- require 'test/unit'
2
- require 'testunit-test-util'
3
-
4
- class TestUnitPending < Test::Unit::TestCase
5
- include TestUnitTestUtil
6
-
7
- class TestCase < Test::Unit::TestCase
8
- class << self
9
- def suite
10
- Test::Unit::TestSuite.new(name)
11
- end
12
- end
13
-
14
- def test_pend
15
- pend("1st pend")
16
- pend("2nd pend. Should not be reached here.")
17
- assert(true, "Should not be reached here too.")
18
- end
19
-
20
- def test_pend_with_failure_in_block
21
- pend("Wait a minute") do
22
- raise "Not implemented yet"
23
- end
24
- assert(true, "Reached here.")
25
- end
26
-
27
- def test_pend_with_no_failure_in_block
28
- pend("Wait a minute") do
29
- "Nothing raised"
30
- end
31
- assert(true, "Not reached here.")
32
- end
33
- end
34
-
35
- def test_pend
36
- test = nil
37
- result = _run_test("test_pend") {|t| test = t}
38
- assert_equal("1 tests, 0 assertions, 0 failures, 0 errors, 1 pendings, " \
39
- "0 omissions, 0 notifications",
40
- result.to_s)
41
- assert_fault_messages(["1st pend"], result.pendings)
42
- assert_true(test.interrupted?)
43
- end
44
-
45
- def test_pend_with_failure_in_block
46
- test = nil
47
- result = _run_test("test_pend_with_failure_in_block") {|t| test = t}
48
- assert_equal("1 tests, 1 assertions, 0 failures, 0 errors, 1 pendings, " \
49
- "0 omissions, 0 notifications",
50
- result.to_s)
51
- assert_fault_messages(["Wait a minute"], result.pendings)
52
- assert_false(test.interrupted?)
53
- end
54
-
55
- def test_pend_with_no_failure_in_block
56
- test = nil
57
- result = _run_test("test_pend_with_no_failure_in_block") {|t| test = t}
58
- assert_equal("1 tests, 1 assertions, 1 failures, 0 errors, 0 pendings, " \
59
- "0 omissions, 0 notifications",
60
- result.to_s)
61
- assert_fault_messages(["Pending block should not be passed: Wait a minute."],
62
- result.failures)
63
- assert_true(test.interrupted?)
64
- end
65
-
66
- private
67
- def _run_test(name, &block)
68
- super(TestCase, name, &block)
69
- end
70
- end
@@ -1,184 +0,0 @@
1
- require 'test/unit'
2
-
3
- class TestUnitPriority < Test::Unit::TestCase
4
- class TestCase < Test::Unit::TestCase
5
- class << self
6
- def suite
7
- Test::Unit::TestSuite.new(name)
8
- end
9
- end
10
-
11
- priority :must
12
- def test_must
13
- assert(true)
14
- end
15
-
16
- def test_must_inherited
17
- assert(true)
18
- end
19
-
20
- priority :important
21
- def test_important
22
- assert(true)
23
- end
24
-
25
- def test_important_inherited
26
- assert(true)
27
- end
28
-
29
- priority :high
30
- def test_high
31
- assert(true)
32
- end
33
-
34
- def test_high_inherited
35
- assert(true)
36
- end
37
-
38
- priority :normal
39
- def test_normal
40
- assert(true)
41
- end
42
-
43
- def test_normal_inherited
44
- assert(true)
45
- end
46
-
47
- priority :low
48
- def test_low
49
- assert(true)
50
- end
51
-
52
- def test_low_inherited
53
- assert(true)
54
- end
55
-
56
- priority :never
57
- def test_never
58
- assert(true)
59
- end
60
-
61
- def test_never_inherited
62
- assert(true)
63
- end
64
- end
65
-
66
- def test_priority_must
67
- assert_priority("must", 1.0, 0.0001)
68
- end
69
-
70
- def test_priority_important
71
- assert_priority("important", 0.9, 0.09)
72
- end
73
-
74
- def test_priority_high
75
- assert_priority("high", 0.70, 0.1)
76
- end
77
-
78
- def test_priority_normal
79
- assert_priority("normal", 0.5, 0.1)
80
- end
81
-
82
- def test_priority_low
83
- assert_priority("low", 0.25, 0.1)
84
- end
85
-
86
- def test_priority_never
87
- assert_priority("never", 0.0, 0.0001)
88
- end
89
-
90
- def assert_priority(priority, expected, delta)
91
- assert_need_to_run("test_#{priority}", expected, delta)
92
- assert_need_to_run("test_#{priority}_inherited", expected, delta)
93
- end
94
-
95
- def assert_need_to_run(test_name, expected, delta)
96
- test = TestCase.new(test_name)
97
- n = 1000
98
- n_need_to_run = 0
99
- n.times do |i|
100
- n_need_to_run += 1 if Test::Unit::Priority::Checker.need_to_run?(test)
101
- end
102
- assert_in_delta(expected, n_need_to_run.to_f / n, delta)
103
- end
104
-
105
- class TestClassName < self
106
- def test_colon
107
- assert_escaped_name("Test_colon__colon_Priority", "Test::Priority")
108
- end
109
-
110
- def test_space
111
- assert_escaped_name("test_priority", "test priority")
112
- end
113
-
114
- def test_slash
115
- assert_escaped_name("test_priority", "test/priority")
116
- end
117
-
118
- def test_back_slash
119
- assert_escaped_name("test_priority", "test\/priority")
120
- end
121
-
122
- def test_question
123
- assert_escaped_name("#question.predicate", "#question?")
124
- end
125
-
126
- def test_exclamation
127
- assert_escaped_name("#exclamation.destructive", "#exclamation!")
128
- end
129
-
130
- def test_equal
131
- assert_escaped_name("#equal.equal", "#equal=")
132
- end
133
-
134
- def assert_escaped_name(expected, class_name)
135
- checker = Checker.new(nil)
136
- escaped_class_name = checker.send(:escape_class_name, class_name)
137
- assert_equal(expected, escaped_class_name)
138
- end
139
- end
140
-
141
- class TestFileName < self
142
- class SpecialNameTestCase < Test::Unit::TestCase
143
- class << self
144
- def suite
145
- Test::Unit::TestSuite.new(name)
146
- end
147
- end
148
-
149
- def test_question?
150
- end
151
-
152
- def test_exclamation!
153
- end
154
-
155
- def test_equal=
156
- end
157
-
158
- test "have space" do
159
- end
160
- end
161
-
162
- def test_question
163
- assert_escaped_name("test_colon__#question.predicate_case",
164
- "test: #question? case")
165
- end
166
-
167
- def test_exclamation
168
- assert_escaped_name("test_colon__#exclamation.destructive_case",
169
- "test: #exclamation! case")
170
- end
171
-
172
- def test_equal
173
- assert_escaped_name("test_colon__#equal.equal_case",
174
- "test: #equal= case")
175
- end
176
-
177
- def assert_escaped_name(expected, test_method_name)
178
- checker = Checker.new(SpecialNameTestCase.new(test_method_name))
179
- passed_file = checker.send(:passed_file)
180
- method_name_component = File.basename(File.dirname(passed_file))
181
- assert_equal(expected, method_name_component)
182
- end
183
- end
184
- end