test-unit 3.2.4 → 3.2.5

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: 560e12d199e303860aa5410d5b4b7f73e4491970
4
- data.tar.gz: b6dbafc77f21fd1b3f179542c4333eb965393cb4
3
+ metadata.gz: 367cf38cdec937cd00374b17aeddd2cd85271223
4
+ data.tar.gz: 66d1270f41f63a6d324c419cb91cb8e4a4e66fed
5
5
  SHA512:
6
- metadata.gz: f1a8fde930effcca2418506776f8142390502033107f8c1ed239d83d854e6255c28cb846bfcf4e76cbec96948f1a74c0d1e9fc0996ca60a548c16f4b9888f40d
7
- data.tar.gz: 7fbd95ad36bc11c0cc8efb7610a94f7c0f191a745a5b71723dc4cb5f9711dca4442137c735fd20a8fdb8c38f0afdb4708eca1c95de5c5366ec238bbc375a7f19
6
+ metadata.gz: 546256249a6ac765e2789a60feec91fd97ec4e66cbcf951897085bf378b435f81a548be56381c22ecdddda0e491b63adcacda90b74d916865f82cb4848e60098
7
+ data.tar.gz: 4e17e054bd8cdf04b401d7aee9205403be33c7a9a9e0fd7244d468897db61f5aecf9b25f4bdd3a03a75409faa8e56c6eece579b5eebab7accc1a1e48cff9f51b
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2008-2013 Kouhei Sutou <kou@clear-code.com>
3
+ # Copyright (C) 2008-2017 Kouhei Sutou <kou@clear-code.com>
4
4
  #
5
5
  # This library is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the GNU Lesser General Public
@@ -18,6 +18,15 @@
18
18
 
19
19
  Encoding.default_internal = "UTF-8" if defined?(Encoding.default_internal)
20
20
 
21
+ # TODO: Remove me when we drop Ruby 1.9 support.
22
+ unless "".respond_to?(:b)
23
+ class String
24
+ def b
25
+ dup.force_encoding("ASCII-8BIT")
26
+ end
27
+ end
28
+ end
29
+
21
30
  require "erb"
22
31
  require "yaml"
23
32
  require "rubygems"
@@ -1,5 +1,16 @@
1
1
  # News
2
2
 
3
+ ## 3.2.5 - 2017-06-24 {#version-3-2-5}
4
+
5
+ ### Improvements
6
+
7
+ * Supported `--enable-frozen-string-literal` `ruby` option.
8
+ [GitHub#149][Reported by Pat Allan]
9
+
10
+ ### Thanks
11
+
12
+ * Pat Allan
13
+
3
14
  ## 3.2.4 - 2017-05-23 {#version-3-2-4}
4
15
 
5
16
  ### Improvements
@@ -153,8 +153,8 @@ module Test
153
153
  assertion_message = message
154
154
  else
155
155
  error_message = "assertion message must be String, Proc or "
156
- error_message << "#{AssertionMessage}: "
157
- error_message << "<#{message.inspect}>(<#{message.class}>)"
156
+ error_message += "#{AssertionMessage}: "
157
+ error_message += "<#{message.inspect}>(<#{message.class}>)"
158
158
  raise ArgumentError, error_message, filter_backtrace(caller)
159
159
  end
160
160
  assertion_message ||= build_message(message,
@@ -192,8 +192,8 @@ module Test
192
192
  assertion_message = message
193
193
  else
194
194
  error_message = "assertion message must be String, Proc or "
195
- error_message << "#{AssertionMessage}: "
196
- error_message << "<#{message.inspect}>(<#{message.class}>)"
195
+ error_message += "#{AssertionMessage}: "
196
+ error_message += "<#{message.inspect}>(<#{message.class}>)"
197
197
  raise ArgumentError, error_message, filter_backtrace(caller)
198
198
  end
199
199
  assert_block("refute should not be called with a block.") do
@@ -362,7 +362,7 @@ EOT
362
362
  else
363
363
  klasses = [klass]
364
364
  end
365
- assert_block("The first parameter to assert_not_instance_of should be " <<
365
+ assert_block("The first parameter to assert_not_instance_of should be " +
366
366
  "a Class or an Array of Class.") do
367
367
  klasses.all? {|k| k.is_a?(Class)}
368
368
  end
@@ -965,7 +965,7 @@ EOT
965
965
  end
966
966
 
967
967
  if relation_format
968
- format << <<-EOT
968
+ format += <<-EOT
969
969
 
970
970
  Relation:
971
971
  #{relation_format}
@@ -1103,7 +1103,7 @@ EOT
1103
1103
  end
1104
1104
 
1105
1105
  if relation_format
1106
- format << <<-EOT
1106
+ format += <<-EOT
1107
1107
 
1108
1108
  Relation:
1109
1109
  #{relation_format}
@@ -1780,7 +1780,7 @@ EOT
1780
1780
 
1781
1781
  if Diff.need_fold?(diff)
1782
1782
  folded_diff = Diff.folded_readable(from, to)
1783
- diff << "\n\nfolded diff:\n#{folded_diff}"
1783
+ diff += "\n\nfolded diff:\n#{folded_diff}"
1784
1784
  end
1785
1785
 
1786
1786
  diff
@@ -1794,9 +1794,9 @@ EOT
1794
1794
  inspector = Inspector.new(object)
1795
1795
  if use_pp
1796
1796
  begin
1797
- require 'pp' unless defined?(PP)
1797
+ require "pp" unless defined?(PP)
1798
1798
  begin
1799
- return PP.pp(inspector, '').chomp
1799
+ return PP.pp(inspector, String.new).chomp
1800
1800
  rescue NameError
1801
1801
  end
1802
1802
  rescue LoadError
@@ -2045,26 +2045,26 @@ EOT
2045
2045
  expanded_template = ""
2046
2046
  @parts.each do |part|
2047
2047
  if part == '?'
2048
- encoding_safe_concat(expanded_template, params.shift)
2048
+ param = params.shift
2049
+ if Object.const_defined?(:Encoding)
2050
+ expanded_template += concatenatable(param,
2051
+ expanded_template.encoding)
2052
+ else
2053
+ expanded_template += param
2054
+ end
2049
2055
  else
2050
- expanded_template << part.gsub(/\\\?/m, '?')
2056
+ expanded_template += part.gsub(/\\\?/m, '?')
2051
2057
  end
2052
2058
  end
2053
2059
  expanded_template
2054
2060
  end
2055
2061
 
2056
2062
  private
2057
- if Object.const_defined?(:Encoding)
2058
- def encoding_safe_concat(buffer, parameter)
2059
- if Encoding.compatible?(buffer, parameter)
2060
- buffer << parameter
2061
- else
2062
- buffer << parameter.dup.force_encoding(buffer.encoding)
2063
- end
2064
- end
2065
- else
2066
- def encoding_safe_concat(buffer, parameter)
2067
- buffer << parameter
2063
+ def concatenatable(text, encoding)
2064
+ if Encoding.compatible?(text, encoding)
2065
+ text
2066
+ else
2067
+ text.dup.force_encoding(encoding)
2068
2068
  end
2069
2069
  end
2070
2070
  end
@@ -189,7 +189,7 @@ module Test
189
189
  def options
190
190
  @options ||= OptionParser.new do |o|
191
191
  o.banner = "Test::Unit automatic runner."
192
- o.banner << "\nUsage: #{$0} [options] [-- untouched arguments]"
192
+ o.banner += "\nUsage: #{$0} [options] [-- untouched arguments]"
193
193
 
194
194
  o.on("-r", "--runner=RUNNER", RUNNERS,
195
195
  "Use the given RUNNER.",
@@ -269,7 +269,7 @@ module Test
269
269
 
270
270
  private
271
271
  def tag(mark, contents)
272
- contents.collect {|content| "#{mark}#{content}"}
272
+ contents.collect {|content| mark + content}
273
273
  end
274
274
  end
275
275
 
@@ -450,7 +450,7 @@ module Test
450
450
 
451
451
  def tag(mark, contents)
452
452
  contents.each do |content|
453
- @result << "#{mark}#{content}"
453
+ @result << (mark + content)
454
454
  end
455
455
  end
456
456
 
@@ -577,15 +577,15 @@ module Test
577
577
  to_width = compute_width(to_line, to_start, to_end)
578
578
  case tag
579
579
  when :replace
580
- from_tags << "^" * from_width
581
- to_tags << "^" * to_width
580
+ from_tags += "^" * from_width
581
+ to_tags += "^" * to_width
582
582
  when :delete
583
- from_tags << "-" * from_width
583
+ from_tags += "-" * from_width
584
584
  when :insert
585
- to_tags << "+" * to_width
585
+ to_tags += "+" * to_width
586
586
  when :equal
587
- from_tags << " " * from_width
588
- to_tags << " " * to_width
587
+ from_tags += " " * from_width
588
+ to_tags += " " * to_width
589
589
  else
590
590
  raise "unknown tag: #{tag}"
591
591
  end
@@ -30,16 +30,16 @@ module Test
30
30
  location_display = "\n" + failure.location.join("\n")
31
31
  end
32
32
  result = "#{failure.label}:\n"
33
- result << "#{failure.test_name}#{location_display}:\n"
34
- result << failure.message
33
+ result += "#{failure.test_name}#{location_display}:\n"
34
+ result += failure.message
35
35
  result
36
36
  end
37
37
 
38
38
  def format_fault_error(error)
39
39
  result = "#{error.label}:\n"
40
- result << "#{error.test_name}:\n"
41
- result << "#{error.message}\n"
42
- result << error.backtrace.join("\n")
40
+ result += "#{error.test_name}:\n"
41
+ result += "#{error.message}\n"
42
+ result += error.backtrace.join("\n")
43
43
  result
44
44
  end
45
45
  end
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.2.4"
3
+ VERSION = "3.2.5"
4
4
  end
5
5
  end
@@ -819,7 +819,7 @@ EOM
819
819
  check_nothing_fails {
820
820
  assert_same(thing, thing, "successful assert_same")
821
821
  }
822
- thing2 = "thing"
822
+ thing2 = thing.dup
823
823
  check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> was expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
824
824
  assert_same(thing, thing2)
825
825
  }
@@ -906,7 +906,7 @@ EOM
906
906
 
907
907
  def test_assert_not_same
908
908
  thing = "thing"
909
- thing2 = "thing"
909
+ thing2 = thing.dup
910
910
  check_nothing_fails {
911
911
  assert_not_same(thing, thing2)
912
912
  }
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.4
4
+ version: 3.2.5
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-05-23 00:00:00.000000000 Z
12
+ date: 2017-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert