test-unit 3.5.7 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59ba2bbe00e50cbe8fddafde4fcab620690213d5bca53fe5e154f42f5502cd6b
4
- data.tar.gz: 5ec10a45c78af72d40b2d7439dafef5296b75fa46d89b9f1889338d2dc224829
3
+ metadata.gz: 87316242bf95be028eca18e6b4da38984f75fb2e2e6b97641c17b4724f802102
4
+ data.tar.gz: ce1ae80016128f58874503100e09ae3ebd150f08482c48c6c7cc92cf0c6e9b4f
5
5
  SHA512:
6
- metadata.gz: b638f460ef3ce8328bb51ed7e3cdf4a79bf36d864fd0ba37cbc4c5e4c43922e1847ee25c1cbb29dde6aa3f1cc38daabe760790f4c65300e4588037641dbe121f
7
- data.tar.gz: 71827e75e9bb25f5569458d3b7fa5edb9cdf3f1693c4ac988b670a3c55cd64bade2f046c966ac76293d76d1e26422afce45bf1ccbf9346086498083e6ca915e2
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/seattlerb/minitest).
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,5 +1,30 @@
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
+
3
28
  ## 3.5.7 - 2022-12-15 {#version-3-5-7}
4
29
 
5
30
  ### Improvements
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2008-2017 Kouhei Sutou <kou@clear-code.com>
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 verbose).",
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|
@@ -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
- # Ruby 3.1.
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-2017 Kouhei Sutou <kou@clear-code.com>
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] || NORMAL
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
- nl(PROGRESS_ONLY)
118
- change_output_level(IMPORTANT_FAULTS_ONLY) do
119
- output_statistics(elapsed_time)
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
- output("Finished in #{elapsed_time} seconds.")
331
+ change_output_level(IMPORTANT_FAULTS_ONLY) do
332
+ output("Finished in #{elapsed_time} seconds.")
333
+ end
326
334
  output_summary_marker
327
- output(@result)
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 > 0
343
- output("-" * @progress_row_max, summary_marker_color)
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
- output_progress(".", color("pass-marker"))
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
 
@@ -448,7 +463,11 @@ module Test
448
463
  end
449
464
 
450
465
  def output_progress(mark, color=nil)
451
- if output_single(mark, color, PROGRESS_ONLY)
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)
452
471
  return unless @progress_row_max > 0
453
472
  @progress_row += mark.size
454
473
  if @progress_row >= @progress_row_max
@@ -459,24 +478,29 @@ module Test
459
478
  end
460
479
 
461
480
  def output_progress_in_detail_marker(fault)
462
- if @progress_row_max > 0
463
- output("=" * @progress_row_max)
464
- else
465
- nl
466
- end
481
+ return if @progress_row_max <= 0
482
+ output("=" * @progress_row_max)
467
483
  end
468
484
 
469
485
  def output_progress_in_detail(fault)
470
486
  return if @output_level == SILENT
471
- nl
472
- output_progress_in_detail_marker(fault)
473
- if categorize_fault(fault) == :need_detail_faults
474
- 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
475
490
  else
476
- output_fault_in_short(fault)
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
477
503
  end
478
- output_progress_in_detail_marker(fault)
479
- @progress_row = 0
480
504
  end
481
505
 
482
506
  def output?(level)
@@ -510,6 +534,14 @@ module Test
510
534
  color("#{@result.status}-marker")
511
535
  end
512
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
+
513
545
  TERM_COLOR_SUPPORT = /
514
546
  color| # explicitly claims color support in the name
515
547
  direct| # explicitly claims "direct color" (24 bit) support
@@ -540,6 +572,14 @@ module Test
540
572
  end
541
573
  end
542
574
 
575
+ def guess_progress_style
576
+ if ENV["GITHUB_ACTIONS"] == "true"
577
+ :fault_only
578
+ else
579
+ :inplace
580
+ end
581
+ end
582
+
543
583
  def windows?
544
584
  /mswin|mingw/ === RUBY_PLATFORM
545
585
  end
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.5.7"
3
+ VERSION = "3.5.8"
4
4
  end
5
5
  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: 3.5.7
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: 2022-12-15 00:00:00.000000000 Z
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.4.0.dev
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.