test-unit 2.4.0 → 2.4.1

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.
@@ -83,3 +83,4 @@ h2. Thanks
83
83
  * Hans de Graaff: Bug reports.
84
84
  * James Mead: A bug report.
85
85
  * Marc Seeger (Acquia): A bug report.
86
+ * boutil: A bug report.
@@ -62,17 +62,24 @@ module Test
62
62
  public
63
63
  def assert(boolean, message=nil)
64
64
  _wrap_assertion do
65
+ assertion_message = nil
65
66
  case message
66
67
  when nil, String, Proc
68
+ when AssertionMessage
69
+ assertion_message = message
67
70
  else
68
- error_message = "assertion message must be String or Proc: "
71
+ error_message = "assertion message must be String, Proc or "
72
+ error_message << "#{AssertionMessage}: "
69
73
  error_message << "<#{message.inspect}>(<#{message.class}>)"
70
74
  raise ArgumentError, error_message, filter_backtrace(caller)
71
75
  end
72
76
  assert_block("assert should not be called with a block.") do
73
77
  !block_given?
74
78
  end
75
- assert_block(build_message(message, "<?> is not true.", boolean)) do
79
+ assertion_message ||= build_message(message,
80
+ "<?> is not true.",
81
+ boolean)
82
+ assert_block(assertion_message) do
76
83
  boolean
77
84
  end
78
85
  end
@@ -1,7 +1,7 @@
1
1
  # port of Python's difflib.
2
2
  #
3
3
  # Copyright (c) 2001-2008 Python Software Foundation; All Rights Reserved
4
- # Copyright (c) 2008-2010 Kouhei Sutou; All Rights Reserved
4
+ # Copyright (c) 2008-2011 Kouhei Sutou; All Rights Reserved
5
5
  #
6
6
  # It is free software, and is distributed under the Ruby
7
7
  # license and/or the PSF license. See the COPYING file and
@@ -166,7 +166,7 @@ module Test
166
166
  end
167
167
  end
168
168
  end
169
- matches.sort_by do |(from_index, to_index, match_size)|
169
+ matches.sort_by do |(from_index, _, _)|
170
170
  from_index
171
171
  end
172
172
  end
@@ -601,7 +601,7 @@ module Test
601
601
  from_tags = from_tags[common..-1].rstrip
602
602
  to_tags = to_tags[common..-1].rstrip
603
603
 
604
- result = tag_deleted([from_line])
604
+ tag_deleted([from_line])
605
605
  unless from_tags.empty?
606
606
  tag_difference(["#{"\t" * common}#{from_tags}"])
607
607
  end
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = '2.4.0'
3
+ VERSION = '2.4.1'
4
4
  end
5
5
  end
@@ -330,7 +330,7 @@ EOM
330
330
  end
331
331
  ascii_8bit_string = utf8_string.dup.force_encoding("ascii-8bit")
332
332
  message = <<-EOM.chomp
333
- <"こんにちは">("UTF-8") expected but was
333
+ <#{utf8_string.inspect}>("UTF-8") expected but was
334
334
  <#{ascii_8bit_string.inspect}>("ASCII-8BIT").
335
335
  EOM
336
336
  check_fails(message) do
@@ -1303,8 +1303,18 @@ EOM
1303
1303
  end
1304
1304
  end
1305
1305
 
1306
- def test_error_invalid_message
1307
- check_fails("assertion message must be String or Proc: " +
1306
+ def test_fail_with_assertion_message
1307
+ check_fails("user message.\n" +
1308
+ "placeholder <:in> message") do
1309
+ assert(false, build_message("user message",
1310
+ "placeholder <?> message",
1311
+ :in))
1312
+ end
1313
+ end
1314
+
1315
+ def test_error_invalid_message_true
1316
+ check_fails("assertion message must be String, Proc or " +
1317
+ "Test::Unit::Assertions::AssertionMessage: " +
1308
1318
  "<true>(<TrueClass>)") do
1309
1319
  begin
1310
1320
  assert(true, true)
@@ -87,7 +87,6 @@ module Test
87
87
  check("Should have a Failure", fault.instance_of?(Failure))
88
88
  check("The Failure should have the correct message", "nested" == fault.message)
89
89
  check("The Failure should have the correct test_name (was <#{fault.test_name}>)", fault.test_name == "test_nested_failure(TC_FailureError)")
90
- r =
91
90
 
92
91
  location = fault.location
93
92
  check("The location should be an array", location.kind_of?(Array))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-unit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 4
9
- - 0
10
- version: 2.4.0
9
+ - 1
10
+ version: 2.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kouhei Sutou
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-18 00:00:00 Z
19
+ date: 2011-11-09 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  requirements: []
194
194
 
195
195
  rubyforge_project: test-unit
196
- rubygems_version: 1.7.2
196
+ rubygems_version: 1.8.10
197
197
  signing_key:
198
198
  specification_version: 3
199
199
  summary: test-unit 2 - Improved version of Test::Unit bundled in Ruby 1.8.x.