test-unit 3.5.7 → 3.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59ba2bbe00e50cbe8fddafde4fcab620690213d5bca53fe5e154f42f5502cd6b
4
- data.tar.gz: 5ec10a45c78af72d40b2d7439dafef5296b75fa46d89b9f1889338d2dc224829
3
+ metadata.gz: 5c662a2a626a4e04b7e0d3a572b9f885816068579bc77f506bce46be13e01dcd
4
+ data.tar.gz: 8592df7be6974cf5cbad6fa97e436083d1e705eb761d9526a9b2f3026f3bfc3c
5
5
  SHA512:
6
- metadata.gz: b638f460ef3ce8328bb51ed7e3cdf4a79bf36d864fd0ba37cbc4c5e4c43922e1847ee25c1cbb29dde6aa3f1cc38daabe760790f4c65300e4588037641dbe121f
7
- data.tar.gz: 71827e75e9bb25f5569458d3b7fa5edb9cdf3f1693c4ac988b670a3c55cd64bade2f046c966ac76293d76d1e26422afce45bf1ccbf9346086498083e6ca915e2
6
+ metadata.gz: cdfe90c8d07d74364bc8703eefc73182dfdba8a583def8c281e66ce47ea56161d1658ff12cc94fc8023bec31e639e564777fd4778003e9d0029a88b6ff91574b
7
+ data.tar.gz: 657710cb8f5d6c8950aa3bd9de0727ad278944ac100d859efbe8d8766e411f2ade3d53e9d22f63670544814ec1263c581a47c37087990b7ba8065eb0a1f03b1f
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,37 @@
1
1
  # News
2
2
 
3
+ ## 3.5.9 - 2023-05-25 {#version-3-5-9}
4
+
5
+ ### Improvements
6
+
7
+ * UI: console: Use `--progress-style=mark` with `--verbose=verbose`
8
+ by default.
9
+
10
+ ## 3.5.8 - 2023-05-12 {#version-3-5-8}
11
+
12
+ ### Improvements
13
+
14
+ * doc: Improved document for multi Ractor mode.
15
+ [GH-226][https://github.com/test-unit/test-unit/issues/226]
16
+ [Patch by Luke Gruber]
17
+
18
+ * doc: Updated minitest's URL.
19
+ [GH-228][https://github.com/test-unit/test-unit/issues/228]
20
+ [Patch by Koichi ITO]
21
+
22
+ * UI: console: Added `--progress-style` option.
23
+
24
+ * UI: console: Compacted `--verbose=important-only` output..
25
+
26
+ * UI: console: Changed the default output level to `important-only`
27
+ on GitHub Actions.
28
+
29
+ ### Thanks
30
+
31
+ * Luke Gruber
32
+
33
+ * Koichi ITO
34
+
3
35
  ## 3.5.7 - 2022-12-15 {#version-3-5-7}
4
36
 
5
37
  ### Improvements
@@ -437,7 +437,7 @@ module Test
437
437
  n = 1
438
438
  end
439
439
  i += 1
440
- keyword.sub(/^(.{#{n}})([A-Za-z]+)(?=\w*$)/, '\\1[\\2]')
440
+ keyword.sub(/^(.{#{n}})([A-Za-z-]+)(?=\w*$)/, '\\1[\\2]')
441
441
  end.join(", ")
442
442
  end
443
443
 
@@ -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,18 @@ module Test
540
572
  end
541
573
  end
542
574
 
575
+ def guess_progress_style
576
+ if @output_level >= VERBOSE
577
+ :mark
578
+ else
579
+ if ENV["GITHUB_ACTIONS"] == "true"
580
+ :fault_only
581
+ else
582
+ :inplace
583
+ end
584
+ end
585
+ end
586
+
543
587
  def windows?
544
588
  /mswin|mingw/ === RUBY_PLATFORM
545
589
  end
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.5.7"
3
+ VERSION = "3.5.9"
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.9
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-25 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.