test-unit 3.5.6 → 3.5.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/README.md +1 -1
- data/doc/text/news.md +33 -1
- data/lib/test/unit/runner/console.rb +13 -2
- data/lib/test/unit/testcase.rb +1 -1
- data/lib/test/unit/ui/console/testrunner.rb +73 -31
- data/lib/test/unit/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87316242bf95be028eca18e6b4da38984f75fb2e2e6b97641c17b4724f802102
|
|
4
|
+
data.tar.gz: ce1ae80016128f58874503100e09ae3ebd150f08482c48c6c7cc92cf0c6e9b4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b6928cb432d65c2b1cbfc30a6bba8fce92c527b067f6986bb363ea31aeba30bbc3a2596863a7dc4b5e70e1763818b39715746d3bfc11531f948b576500b08fe
|
|
7
|
+
data.tar.gz: b6f9ebaff9aae704c5e4e6037d73d5a7983913defa1c0e744b6d8d77c7a10e765ff90aa6d0785bf90aeefbe8de2282dd5d6d6652daf380ec275b428a2cce3df7
|
data/README.md
CHANGED
|
@@ -19,7 +19,7 @@ test-unit ships as part of Ruby as a bundled gem. To check which version is incl
|
|
|
19
19
|
It's only necessary to install the gem if you need a newer version.
|
|
20
20
|
|
|
21
21
|
test-unit is the original Ruby unit testing library, and is still active.
|
|
22
|
-
It is one of two unit testing libraries bundled with Ruby, the other being [minitest](https://github.com/
|
|
22
|
+
It is one of two unit testing libraries bundled with Ruby, the other being [minitest](https://github.com/minitest/minitest).
|
|
23
23
|
|
|
24
24
|
When deciding which to use, consider:
|
|
25
25
|
|
data/doc/text/news.md
CHANGED
|
@@ -1,10 +1,42 @@
|
|
|
1
1
|
# News
|
|
2
2
|
|
|
3
|
+
## 3.5.8 - 2023-05-12 {#version-3-5-8}
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
* doc: Improved document for multi Ractor mode.
|
|
8
|
+
[GH-226][https://github.com/test-unit/test-unit/issues/226]
|
|
9
|
+
[Patch by Luke Gruber]
|
|
10
|
+
|
|
11
|
+
* doc: Updated minitest's URL.
|
|
12
|
+
[GH-228][https://github.com/test-unit/test-unit/issues/228]
|
|
13
|
+
[Patch by Koichi ITO]
|
|
14
|
+
|
|
15
|
+
* UI: console: Added `--progress-style` option.
|
|
16
|
+
|
|
17
|
+
* UI: console: Compacted `--verbose=important-only` output..
|
|
18
|
+
|
|
19
|
+
* UI: console: Changed the default output level to `important-only`
|
|
20
|
+
on GitHub Actions.
|
|
21
|
+
|
|
22
|
+
### Thanks
|
|
23
|
+
|
|
24
|
+
* Luke Gruber
|
|
25
|
+
|
|
26
|
+
* Koichi ITO
|
|
27
|
+
|
|
28
|
+
## 3.5.7 - 2022-12-15 {#version-3-5-7}
|
|
29
|
+
|
|
30
|
+
### Improvements
|
|
31
|
+
|
|
32
|
+
* [UI][console]: Changed to use color escape sequence for each line
|
|
33
|
+
instead of each output that may consist with multiple lines.
|
|
34
|
+
|
|
3
35
|
## 3.5.6 - 2022-12-15 {#version-3-5-6}
|
|
4
36
|
|
|
5
37
|
### Improvements
|
|
6
38
|
|
|
7
|
-
* Enabled 256 colors output on GitHub Actions by default.
|
|
39
|
+
* [UI][console]: Enabled 256 colors output on GitHub Actions by default.
|
|
8
40
|
|
|
9
41
|
## 3.5.5 - 2022-10-04 {#version-3-5-5}
|
|
10
42
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2008-
|
|
1
|
+
# Copyright (C) 2008-2023 Sutou Kouhei <kou@clear-code.com>
|
|
2
2
|
|
|
3
3
|
module Test
|
|
4
4
|
module Unit
|
|
@@ -18,7 +18,7 @@ module Test
|
|
|
18
18
|
["verbose", UI::Console::OutputLevel::VERBOSE],
|
|
19
19
|
]
|
|
20
20
|
opts.on('-v', '--verbose=[LEVEL]', output_levels,
|
|
21
|
-
"Set the output level (default is
|
|
21
|
+
"Set the output level (default is normal).",
|
|
22
22
|
"(#{auto_runner.keyword_display(output_levels)})") do |level|
|
|
23
23
|
level ||= output_levels.assoc("verbose")[1]
|
|
24
24
|
auto_runner.runner_options[:output_level] = level
|
|
@@ -51,6 +51,17 @@ module Test
|
|
|
51
51
|
auto_runner.runner_options[:progress_row_max] = max
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
progress_styles = [
|
|
55
|
+
["inplace", :inplace],
|
|
56
|
+
["mark", :mark],
|
|
57
|
+
["fault-only", :fault_only],
|
|
58
|
+
]
|
|
59
|
+
opts.on("--progress-style=STYLE", progress_styles,
|
|
60
|
+
"Uses STYLE as progress style",
|
|
61
|
+
"(#{auto_runner.keyword_display(progress_styles)}") do |style|
|
|
62
|
+
auto_runner.runner_options[:progress_style] = style
|
|
63
|
+
end
|
|
64
|
+
|
|
54
65
|
opts.on("--no-show-detail-immediately",
|
|
55
66
|
"Shows not passed test details immediately.",
|
|
56
67
|
"(default is yes)") do |boolean|
|
data/lib/test/unit/testcase.rb
CHANGED
|
@@ -357,7 +357,7 @@ module Test
|
|
|
357
357
|
# Ractor mode is enabled in the current process and it's not
|
|
358
358
|
# disabled even when only one Ractor is running after running
|
|
359
359
|
# a test that uses Ractor on Ruby 3.0. It will be solved in
|
|
360
|
-
#
|
|
360
|
+
# the future.
|
|
361
361
|
#
|
|
362
362
|
# This is implemented by setting the `:ractor` attribute of
|
|
363
363
|
# the test to `true`.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: Nathaniel Talbott.
|
|
4
4
|
# Copyright::
|
|
5
5
|
# * Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
|
6
|
-
# * Copyright (c) 2008-
|
|
6
|
+
# * Copyright (c) 2008-2023 Sutou Kouhei <kou@clear-code.com>
|
|
7
7
|
# License:: Ruby license.
|
|
8
8
|
|
|
9
9
|
begin
|
|
@@ -36,12 +36,15 @@ module Test
|
|
|
36
36
|
# STDOUT.
|
|
37
37
|
def initialize(suite, options={})
|
|
38
38
|
super
|
|
39
|
-
@output_level = @options[:output_level] ||
|
|
39
|
+
@output_level = @options[:output_level] || guess_output_level
|
|
40
40
|
@output = @options[:output] || STDOUT
|
|
41
41
|
@use_color = @options[:use_color]
|
|
42
42
|
@use_color = guess_color_availability if @use_color.nil?
|
|
43
43
|
@color_scheme = @options[:color_scheme] || ColorScheme.default
|
|
44
44
|
@reset_color = Color.new("reset")
|
|
45
|
+
@progress_style = @options[:progress_style] || guess_progress_style
|
|
46
|
+
@progress_marks = ["|", "/", "-", "\\", "|", "/", "-", "\\"]
|
|
47
|
+
@progress_mark_index = 0
|
|
45
48
|
@progress_row = 0
|
|
46
49
|
@progress_row_max = @options[:progress_row_max]
|
|
47
50
|
@progress_row_max ||= guess_progress_row_max
|
|
@@ -114,10 +117,13 @@ module Test
|
|
|
114
117
|
nl if output?(NORMAL) and !output?(VERBOSE)
|
|
115
118
|
output_faults
|
|
116
119
|
end
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
case @progress_style
|
|
121
|
+
when :inplace
|
|
122
|
+
output_single("\r", nil, PROGRESS_ONLY)
|
|
123
|
+
when :mark
|
|
124
|
+
nl(PROGRESS_ONLY)
|
|
120
125
|
end
|
|
126
|
+
output_statistics(elapsed_time)
|
|
121
127
|
end
|
|
122
128
|
|
|
123
129
|
def output_faults
|
|
@@ -322,9 +328,13 @@ module Test
|
|
|
322
328
|
end
|
|
323
329
|
|
|
324
330
|
def output_statistics(elapsed_time)
|
|
325
|
-
|
|
331
|
+
change_output_level(IMPORTANT_FAULTS_ONLY) do
|
|
332
|
+
output("Finished in #{elapsed_time} seconds.")
|
|
333
|
+
end
|
|
326
334
|
output_summary_marker
|
|
327
|
-
|
|
335
|
+
change_output_level(IMPORTANT_FAULTS_ONLY) do
|
|
336
|
+
output(@result)
|
|
337
|
+
end
|
|
328
338
|
output("%g%% passed" % @result.pass_percentage)
|
|
329
339
|
unless elapsed_time.zero?
|
|
330
340
|
output_summary_marker
|
|
@@ -339,11 +349,8 @@ module Test
|
|
|
339
349
|
end
|
|
340
350
|
|
|
341
351
|
def output_summary_marker
|
|
342
|
-
if @progress_row_max
|
|
343
|
-
|
|
344
|
-
else
|
|
345
|
-
nl
|
|
346
|
-
end
|
|
352
|
+
return if @progress_row_max <= 0
|
|
353
|
+
output("-" * @progress_row_max, summary_marker_color)
|
|
347
354
|
end
|
|
348
355
|
|
|
349
356
|
def test_started(test)
|
|
@@ -372,7 +379,15 @@ module Test
|
|
|
372
379
|
|
|
373
380
|
def test_finished(test)
|
|
374
381
|
unless @already_outputted
|
|
375
|
-
|
|
382
|
+
case @progress_style
|
|
383
|
+
when :inplace
|
|
384
|
+
mark = @progress_marks[@progress_mark_index]
|
|
385
|
+
@progress_mark_index =
|
|
386
|
+
(@progress_mark_index + 1) % @progress_marks.size
|
|
387
|
+
output_progress(mark, color("pass-marker"))
|
|
388
|
+
when :mark
|
|
389
|
+
output_progress(".", color("pass-marker"))
|
|
390
|
+
end
|
|
376
391
|
end
|
|
377
392
|
@already_outputted = false
|
|
378
393
|
|
|
@@ -435,18 +450,24 @@ module Test
|
|
|
435
450
|
|
|
436
451
|
def output_single(something, color=nil, level=nil)
|
|
437
452
|
return false unless output?(level)
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
453
|
+
something.to_s.each_line do |line|
|
|
454
|
+
if @use_color and color
|
|
455
|
+
line = "%s%s%s" % [color.escape_sequence,
|
|
456
|
+
line,
|
|
457
|
+
@reset_color.escape_sequence]
|
|
458
|
+
end
|
|
459
|
+
@output.write(line)
|
|
442
460
|
end
|
|
443
|
-
@output.write(something)
|
|
444
461
|
@output.flush
|
|
445
462
|
true
|
|
446
463
|
end
|
|
447
464
|
|
|
448
465
|
def output_progress(mark, color=nil)
|
|
449
|
-
if
|
|
466
|
+
if @progress_style == :inplace
|
|
467
|
+
output_single("\r#{mark}", color, PROGRESS_ONLY)
|
|
468
|
+
else
|
|
469
|
+
return unless output?(PROGRESS_ONLY)
|
|
470
|
+
output_single(mark, color)
|
|
450
471
|
return unless @progress_row_max > 0
|
|
451
472
|
@progress_row += mark.size
|
|
452
473
|
if @progress_row >= @progress_row_max
|
|
@@ -457,24 +478,29 @@ module Test
|
|
|
457
478
|
end
|
|
458
479
|
|
|
459
480
|
def output_progress_in_detail_marker(fault)
|
|
460
|
-
if @progress_row_max
|
|
461
|
-
|
|
462
|
-
else
|
|
463
|
-
nl
|
|
464
|
-
end
|
|
481
|
+
return if @progress_row_max <= 0
|
|
482
|
+
output("=" * @progress_row_max)
|
|
465
483
|
end
|
|
466
484
|
|
|
467
485
|
def output_progress_in_detail(fault)
|
|
468
486
|
return if @output_level == SILENT
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
output_fault_in_detail(fault)
|
|
487
|
+
need_detail_faults = (categorize_fault(fault) == :need_detail_faults)
|
|
488
|
+
if need_detail_faults
|
|
489
|
+
log_level = IMPORTANT_FAULTS_ONLY
|
|
473
490
|
else
|
|
474
|
-
|
|
491
|
+
log_level = @current_output_level
|
|
492
|
+
end
|
|
493
|
+
change_output_level(log_level) do
|
|
494
|
+
nl(NORMAL)
|
|
495
|
+
output_progress_in_detail_marker(fault)
|
|
496
|
+
if need_detail_faults
|
|
497
|
+
output_fault_in_detail(fault)
|
|
498
|
+
else
|
|
499
|
+
output_fault_in_short(fault)
|
|
500
|
+
end
|
|
501
|
+
output_progress_in_detail_marker(fault)
|
|
502
|
+
@progress_row = 0
|
|
475
503
|
end
|
|
476
|
-
output_progress_in_detail_marker(fault)
|
|
477
|
-
@progress_row = 0
|
|
478
504
|
end
|
|
479
505
|
|
|
480
506
|
def output?(level)
|
|
@@ -508,6 +534,14 @@ module Test
|
|
|
508
534
|
color("#{@result.status}-marker")
|
|
509
535
|
end
|
|
510
536
|
|
|
537
|
+
def guess_output_level
|
|
538
|
+
if ENV["GITHUB_ACTIONS"] == "true"
|
|
539
|
+
IMPORTANT_FAULTS_ONLY
|
|
540
|
+
else
|
|
541
|
+
NORMAL
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
|
|
511
545
|
TERM_COLOR_SUPPORT = /
|
|
512
546
|
color| # explicitly claims color support in the name
|
|
513
547
|
direct| # explicitly claims "direct color" (24 bit) support
|
|
@@ -538,6 +572,14 @@ module Test
|
|
|
538
572
|
end
|
|
539
573
|
end
|
|
540
574
|
|
|
575
|
+
def guess_progress_style
|
|
576
|
+
if ENV["GITHUB_ACTIONS"] == "true"
|
|
577
|
+
:fault_only
|
|
578
|
+
else
|
|
579
|
+
:inplace
|
|
580
|
+
end
|
|
581
|
+
end
|
|
582
|
+
|
|
541
583
|
def windows?
|
|
542
584
|
/mswin|mingw/ === RUBY_PLATFORM
|
|
543
585
|
end
|
data/lib/test/unit/version.rb
CHANGED
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.5.
|
|
4
|
+
version: 3.5.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:
|
|
12
|
+
date: 2023-05-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: power_assert
|
|
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
195
195
|
- !ruby/object:Gem::Version
|
|
196
196
|
version: '0'
|
|
197
197
|
requirements: []
|
|
198
|
-
rubygems_version: 3.
|
|
198
|
+
rubygems_version: 3.5.0.dev
|
|
199
199
|
signing_key:
|
|
200
200
|
specification_version: 4
|
|
201
201
|
summary: An xUnit family unit testing framework for Ruby.
|