test-unit 3.2.6 → 3.2.7

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
  SHA1:
3
- metadata.gz: 9ddfe122387606bd5c9d06ffa5943907756becf3
4
- data.tar.gz: bee7b843682d5aebca132166cc005e8f534fb55d
3
+ metadata.gz: 906aaf6d18c456041612ba02dfe0eeff56be81f4
4
+ data.tar.gz: 4d065ef6b4db8517994d6f3a5a6342e1051e51e5
5
5
  SHA512:
6
- metadata.gz: 6b6d4e183f16c8e931f1ca02fb179e45857ea539cfe5a6efe448c7a24caeb691bc6cda85f0ce90305522df2db5fab8a1c39e856ef4bc1e22663863acb9364813
7
- data.tar.gz: 5b87675676f620d09cc4580f40f8d8677e91ed9eb01406d91f098b0037b1a16817f80392a3d8cb7133aeb216d10108f86d5feb8cab7184aceccbea355969c967
6
+ metadata.gz: f2b1f9bc3236ad6c7cb9bb59d67d209bab5faab09fa6d4eb3f4f4b76f25e6548c66078ed6d59504048dd5070921b34c10d35d5e93a190f3cebd679df910f7ec1
7
+ data.tar.gz: d30651032f9f04967d694fb75071ad4e1c42d66ceb8e00d79aa09fe310682cb7ed811bf00a8cee4a9a164546b8c98c79e8cdca5cf98475050c3b8148be7b5909
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # test-unit
2
2
 
3
- [![](https://badge.fury.io/rb/test-unit.png)](http://badge.fury.io/rb/test-unit)
4
- [![](https://travis-ci.org/test-unit/test-unit.png?branch=master)](https://travis-ci.org/test-unit/test-unit)
3
+ [![](https://badge.fury.io/rb/test-unit.svg)](http://badge.fury.io/rb/test-unit)
4
+ [![](https://travis-ci.org/test-unit/test-unit.svg?branch=master)](https://travis-ci.org/test-unit/test-unit)
5
5
 
6
6
  * http://test-unit.github.io/
7
7
  * https://github.com/test-unit/test-unit
@@ -1,5 +1,34 @@
1
1
  # News
2
2
 
3
+ ## 3.2.7 - 2017-12-12 {#version-3-2-7}
4
+
5
+ ### Improvements
6
+
7
+ * Added source code link to gemspec.
8
+ [GitHub#157][Patch by Grey Baker]
9
+
10
+ * Changed to use SVG image for badges in README.
11
+ [GitHub#158][Patch by Olle Jonsson]
12
+
13
+ * [UI][console]: Added `--reverse-output` option to output fault
14
+ details in reverse like Ruby 2.5. It's enabled by default only for
15
+ tty output.
16
+
17
+ ### Fixes
18
+
19
+ * Fixed a typo.
20
+ [GitHub#156][Patch by masa kunikata]
21
+
22
+ * [UI][console]: Fixed a bug that broken align in verbose mode.
23
+
24
+ ### Thanks
25
+
26
+ * masa kunikata
27
+
28
+ * Grey Baker
29
+
30
+ * Olle Jonsson
31
+
3
32
  ## 3.2.6 - 2017-09-21 {#version-3-2-6}
4
33
 
5
34
  ### Improvements
@@ -139,7 +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
+ attr_writer :stop_on_failure
143
143
  attr_writer :runner, :collector
144
144
 
145
145
  def initialize(standalone)
@@ -1,3 +1,22 @@
1
+ # Copyright (C) 2008-2017 Kouhei Sutou <kou@clear-code.com>
2
+ #
3
+ # License: Ruby OR LGPL-2.1+
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18
+ # 02110-1301 USA
19
+
1
20
  module Test
2
21
  module Unit
3
22
  AutoRunner.register_runner(:console) do |auto_runner|
@@ -54,6 +73,12 @@ module Test
54
73
  "(default is yes)") do |boolean|
55
74
  auto_runner.runner_options[:show_detail_immediately] = boolean
56
75
  end
76
+
77
+ opts.on("--[no-]reverse-output",
78
+ "Shows fault details in reverse.",
79
+ "(default is yes for tty output, no otherwise)") do |boolean|
80
+ auto_runner.runner_options[:reverse_output] = boolean
81
+ end
57
82
  end
58
83
  end
59
84
  end
@@ -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-2013 Kouhei Sutou <kou@clear-code.com>
6
+ # * Copyright (c) 2008-2017 Kouhei Sutou <kou@clear-code.com>
7
7
  # License:: Ruby license.
8
8
 
9
9
  begin
@@ -47,6 +47,8 @@ module Test
47
47
  @progress_row_max ||= guess_progress_row_max
48
48
  @show_detail_immediately = @options[:show_detail_immediately]
49
49
  @show_detail_immediately = true if @show_detail_immediately.nil?
50
+ @reverse_output = @options[:reverse_output]
51
+ @reverse_output = @output.tty? if @reverse_output.nil?
50
52
  @already_outputted = false
51
53
  @indent = 0
52
54
  @top_level = true
@@ -110,8 +112,10 @@ module Test
110
112
  end
111
113
 
112
114
  def finished(elapsed_time)
113
- nl if output?(NORMAL) and !output?(VERBOSE)
114
- output_faults unless @show_detail_immediately
115
+ unless @show_detail_immediately
116
+ nl if output?(NORMAL) and !output?(VERBOSE)
117
+ output_faults
118
+ end
115
119
  nl(PROGRESS_ONLY)
116
120
  change_output_level(IMPORTANT_FAULTS_ONLY) do
117
121
  output_statistics(elapsed_time)
@@ -178,22 +182,31 @@ module Test
178
182
 
179
183
  def output_fault_in_detail(fault)
180
184
  if fault.is_a?(Failure) and
181
- fault.inspected_expected and fault.inspected_actual
182
- output_single("#{fault.label}: ")
183
- output(fault.test_name, fault_color(fault))
184
- output_fault_backtrace(fault)
185
- output_failure_message(fault)
185
+ fault.inspected_expected and
186
+ fault.inspected_actual
187
+ if @reverse_output
188
+ output_fault_backtrace(fault)
189
+ output_failure_message(fault)
190
+ output_single("#{fault.label}: ")
191
+ output(fault.test_name, fault_color(fault))
192
+ else
193
+ output_single("#{fault.label}: ")
194
+ output(fault.test_name, fault_color(fault))
195
+ output_fault_backtrace(fault)
196
+ output_failure_message(fault)
197
+ end
186
198
  else
187
- if fault.is_a?(Error)
199
+ if @reverse_output
200
+ output_fault_backtrace(fault)
188
201
  output_single("#{fault.label}: ")
189
202
  output_single(fault.test_name, fault_color(fault))
190
203
  output_fault_message(fault)
191
204
  else
192
- output_single(fault.label, fault_color(fault))
205
+ output_single("#{fault.label}: ")
206
+ output_single(fault.test_name, fault_color(fault))
193
207
  output_fault_message(fault)
194
- output(fault.test_name)
208
+ output_fault_backtrace(fault)
195
209
  end
196
- output_fault_backtrace(fault)
197
210
  end
198
211
  end
199
212
 
@@ -218,6 +231,7 @@ module Test
218
231
  # workaround for test-spec. :<
219
232
  # see also GitHub:#22
220
233
  backtrace ||= []
234
+ backtrace = backtrace.reverse if @reverse_output
221
235
  backtrace.each_with_index do |entry, i|
222
236
  output(entry)
223
237
  next if snippet_is_shown
@@ -303,9 +317,17 @@ module Test
303
317
  end
304
318
 
305
319
  def output_fault_in_short(fault)
306
- output_single(fault.message, fault_color(fault))
307
- output(" [#{fault.test_name}]")
308
- output(fault.location.first)
320
+ if @reverse_output
321
+ output(fault.location.first)
322
+ output_single("#{fault.label}: ")
323
+ output_single(fault.message, fault_color(fault))
324
+ output(" [#{fault.test_name}]")
325
+ else
326
+ output_single("#{fault.label}: ")
327
+ output_single(fault.message, fault_color(fault))
328
+ output(" [#{fault.test_name}]")
329
+ output(fault.location.first)
330
+ end
309
331
  end
310
332
 
311
333
  def format_fault(fault)
@@ -330,24 +352,34 @@ module Test
330
352
  end
331
353
 
332
354
  def output_summary_marker
333
- term_width = guess_term_width
334
- if term_width.zero?
335
- marker_width = 6
355
+ if @progress_row_max > 0
356
+ output("-" * @progress_row_max, summary_marker_color)
336
357
  else
337
- marker_width = term_width
358
+ nl
338
359
  end
339
- output("-" * marker_width, summary_marker_color)
340
360
  end
341
361
 
342
362
  def test_started(test)
343
363
  return unless output?(VERBOSE)
344
364
 
365
+ tab_width = 8
345
366
  name = test.local_name
346
- right_space = 8 * 2
367
+ separator = ":"
368
+ left_used = indent.size + name.size + separator.size
369
+ right_space = tab_width * 2
347
370
  left_space = @progress_row_max - right_space
348
- left_space = left_space - indent.size - name.size
349
- tab_stop = "\t" * ([left_space - 1, 0].max / 8)
350
- output_single("#{indent}#{name}:#{tab_stop}", nil, VERBOSE)
371
+ if (left_used % tab_width).zero?
372
+ left_space -= left_used
373
+ n_tabs = 0
374
+ else
375
+ left_space -= ((left_used / tab_width) + 1) * tab_width
376
+ n_tabs = 1
377
+ end
378
+ n_tabs += [left_space, 0].max / tab_width
379
+ tab_stop = "\t" * n_tabs
380
+ output_single("#{indent}#{name}#{separator}#{tab_stop}",
381
+ nil,
382
+ VERBOSE)
351
383
  @test_start = Time.now
352
384
  end
353
385
 
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.2.6"
3
+ VERSION = "3.2.7"
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.2.6
4
+ version: 3.2.7
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: 2017-09-21 00:00:00.000000000 Z
12
+ date: 2017-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert
@@ -213,7 +213,8 @@ homepage: http://test-unit.github.io/
213
213
  licenses:
214
214
  - Ruby
215
215
  - PSFL
216
- metadata: {}
216
+ metadata:
217
+ source_code_uri: https://github.com/test-unit/test-unit
217
218
  post_install_message:
218
219
  rdoc_options: []
219
220
  require_paths:
@@ -230,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
231
  version: '0'
231
232
  requirements: []
232
233
  rubyforge_project:
233
- rubygems_version: 2.5.2
234
+ rubygems_version: 2.5.2.1
234
235
  signing_key:
235
236
  specification_version: 4
236
237
  summary: An xUnit family unit testing framework for Ruby.