test-unit 3.1.7 → 3.1.8
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/doc/text/news.md +8 -0
- data/lib/test/unit/assertions.rb +0 -1
- data/lib/test/unit/autorunner.rb +23 -0
- data/lib/test/unit/testresult.rb +7 -0
- data/lib/test/unit/ui/testrunnermediator.rb +9 -7
- data/lib/test/unit/version.rb +1 -1
- data/test/test-assertions.rb +8 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5844bfd9d0754f090d6234c91739e29922476a05
|
4
|
+
data.tar.gz: 8b1eeab14fe29d9451f73a456792d47079cbca41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85cd16c83e1572e93970165b9e0d6b8845d366a381b6c7e424d63750dbe6d48029e1ed409e6e9bbca54bee29edbe1c28ac9c2f31b4534283b89adb549351d356
|
7
|
+
data.tar.gz: 023ef74d97b7f612dfb927d99763ccaaf82c3758e17a9806a345f87878186db6f59c0a9fd4a17b1b0a1f89a6c635fed32be98c82e7bae7f1152e25d84878931a
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.1.8 - 2016-03-19 {#version-3-1-8}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Added `--stop-on-failure` command line option. With this option,
|
8
|
+
running test suite is stopped immediately when one test is failed
|
9
|
+
or an error is raised in one test.
|
10
|
+
|
3
11
|
## 3.1.7 - 2016-01-17 {#version-3-1-7}
|
4
12
|
|
5
13
|
### Fixes
|
data/lib/test/unit/assertions.rb
CHANGED
data/lib/test/unit/autorunner.rb
CHANGED
@@ -139,6 +139,7 @@ module Test
|
|
139
139
|
attr_accessor :default_test_paths
|
140
140
|
attr_accessor :pattern, :exclude, :base, :workdir
|
141
141
|
attr_accessor :color_scheme, :listeners
|
142
|
+
attr_writer :stop_on_failuere
|
142
143
|
attr_writer :runner, :collector
|
143
144
|
|
144
145
|
def initialize(standalone)
|
@@ -153,6 +154,7 @@ module Test
|
|
153
154
|
@default_arguments = []
|
154
155
|
@workdir = nil
|
155
156
|
@listeners = []
|
157
|
+
@stop_on_failure = false
|
156
158
|
config_file = "test-unit.yml"
|
157
159
|
if File.exist?(config_file)
|
158
160
|
load_config(config_file)
|
@@ -162,6 +164,10 @@ module Test
|
|
162
164
|
yield(self) if block_given?
|
163
165
|
end
|
164
166
|
|
167
|
+
def stop_on_failure?
|
168
|
+
@stop_on_failure
|
169
|
+
end
|
170
|
+
|
165
171
|
def prepare
|
166
172
|
PREPARE_HOOKS.each do |handler|
|
167
173
|
handler.call(self)
|
@@ -361,6 +367,12 @@ module Test
|
|
361
367
|
assertion_message_class.max_diff_target_string_size = size
|
362
368
|
end
|
363
369
|
|
370
|
+
o.on("--[no-]stop-on-failure",
|
371
|
+
"Stops immediately on the first non success test",
|
372
|
+
"(#{@stop_on_failure})") do |boolean|
|
373
|
+
@stop_on_failure = boolean
|
374
|
+
end
|
375
|
+
|
364
376
|
ADDITIONAL_OPTIONS.each do |option_builder|
|
365
377
|
option_builder.call(self, o)
|
366
378
|
end
|
@@ -419,6 +431,9 @@ module Test
|
|
419
431
|
@runner_options[:color_scheme] ||= @color_scheme
|
420
432
|
@runner_options[:listeners] ||= []
|
421
433
|
@runner_options[:listeners].concat(@listeners)
|
434
|
+
if @stop_on_failure
|
435
|
+
@runner_options[:listeners] << StopOnFailureListener.new
|
436
|
+
end
|
422
437
|
change_work_directory do
|
423
438
|
runner.run(suite, @runner_options).passed?
|
424
439
|
end
|
@@ -504,6 +519,14 @@ module Test
|
|
504
519
|
:method_name => test.method_name)
|
505
520
|
end
|
506
521
|
end
|
522
|
+
|
523
|
+
class StopOnFailureListener
|
524
|
+
def attach_to_mediator(mediator)
|
525
|
+
mediator.add_listener(TestResult::FINISHED) do |result|
|
526
|
+
result.stop unless result.passed?
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
507
530
|
end
|
508
531
|
end
|
509
532
|
end
|
data/lib/test/unit/testresult.rb
CHANGED
@@ -38,12 +38,15 @@ module Test
|
|
38
38
|
|
39
39
|
attr_reader :run_count, :pass_count, :assertion_count, :faults
|
40
40
|
|
41
|
+
attr_accessor :stop_tag
|
42
|
+
|
41
43
|
# Constructs a new, empty TestResult.
|
42
44
|
def initialize
|
43
45
|
@run_count, @pass_count, @assertion_count = 0, 0, 0
|
44
46
|
@summary_generators = []
|
45
47
|
@problem_checkers = []
|
46
48
|
@faults = []
|
49
|
+
@stop_tag = nil
|
47
50
|
initialize_containers
|
48
51
|
end
|
49
52
|
|
@@ -92,6 +95,10 @@ module Test
|
|
92
95
|
end
|
93
96
|
end
|
94
97
|
|
98
|
+
def stop
|
99
|
+
throw @stop_tag
|
100
|
+
end
|
101
|
+
|
95
102
|
def to_s
|
96
103
|
summary
|
97
104
|
end
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
5
5
|
# License:: Ruby license.
|
6
6
|
|
7
|
-
require 'test/unit'
|
8
7
|
require 'test/unit/util/observable'
|
9
8
|
require 'test/unit/testresult'
|
10
9
|
|
@@ -18,9 +17,9 @@ module Test
|
|
18
17
|
RESET = name + "::RESET"
|
19
18
|
STARTED = name + "::STARTED"
|
20
19
|
FINISHED = name + "::FINISHED"
|
21
|
-
|
20
|
+
|
22
21
|
include Util::Observable
|
23
|
-
|
22
|
+
|
24
23
|
# Creates a new TestRunnerMediator initialized to run
|
25
24
|
# the passed suite.
|
26
25
|
def initialize(suite)
|
@@ -37,11 +36,14 @@ module Test
|
|
37
36
|
Test::Unit.run_at_start_hooks
|
38
37
|
start_time = Time.now
|
39
38
|
begin
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
catch do |stop_tag|
|
40
|
+
result.stop_tag = stop_tag
|
41
|
+
with_listener(result) do
|
42
|
+
notify_listeners(RESET, @suite.size)
|
43
|
+
notify_listeners(STARTED, result)
|
43
44
|
|
44
|
-
|
45
|
+
run_suite(result)
|
46
|
+
end
|
45
47
|
end
|
46
48
|
ensure
|
47
49
|
elapsed_time = Time.now - start_time
|
data/lib/test/unit/version.rb
CHANGED
data/test/test-assertions.rb
CHANGED
@@ -68,7 +68,10 @@ module Test
|
|
68
68
|
"Incorrect expected message type in assert_nothing_failed")
|
69
69
|
end
|
70
70
|
else
|
71
|
-
|
71
|
+
case return_value_expected
|
72
|
+
when :dont_care
|
73
|
+
# do nothing
|
74
|
+
when true
|
72
75
|
check(!return_value.nil?, "Should return a value")
|
73
76
|
else
|
74
77
|
check(return_value.nil?,
|
@@ -812,22 +815,22 @@ EOM
|
|
812
815
|
end
|
813
816
|
|
814
817
|
def test_assert_nothing_raised
|
815
|
-
check_nothing_fails {
|
818
|
+
check_nothing_fails(:dont_care) {
|
816
819
|
assert_nothing_raised {
|
817
820
|
1 + 1
|
818
821
|
}
|
819
822
|
}
|
820
|
-
check_nothing_fails {
|
823
|
+
check_nothing_fails(:dont_care) {
|
821
824
|
assert_nothing_raised("successful assert_nothing_raised") {
|
822
825
|
1 + 1
|
823
826
|
}
|
824
827
|
}
|
825
|
-
check_nothing_fails {
|
828
|
+
check_nothing_fails(:dont_care) {
|
826
829
|
assert_nothing_raised("successful assert_nothing_raised") {
|
827
830
|
1 + 1
|
828
831
|
}
|
829
832
|
}
|
830
|
-
check_nothing_fails {
|
833
|
+
check_nothing_fails(:dont_care) {
|
831
834
|
begin
|
832
835
|
assert_nothing_raised(RuntimeError, StandardError, Comparable, "successful assert_nothing_raised") {
|
833
836
|
raise ZeroDivisionError.new("ArgumentError")
|
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.1.
|
4
|
+
version: 3.1.8
|
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: 2016-
|
12
|
+
date: 2016-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: power_assert
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.
|
232
|
+
rubygems_version: 2.5.1
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: An xUnit family unit testing framework for Ruby.
|