This commit is contained in:
Mamoru TASAKA 2017-05-26 10:27:24 +09:00
commit 520aec7962
7 changed files with 7 additions and 1021 deletions

1
.gitignore vendored
View file

@ -30,3 +30,4 @@
/test-unit-3.2.1.gem
/test-unit-3.2.2.gem
/test-unit-3.2.3.gem
/test-unit-3.2.4.gem

View file

@ -1,816 +0,0 @@
From 3b259a38397dff780857a439798406c0c4eef3b7 Mon Sep 17 00:00:00 2001
From: Kouhei Sutou <kou@clear-code.com>
Date: Wed, 28 Dec 2016 00:37:12 +0900
Subject: [PATCH] Fix assertion message English
GitHub: fix #133
Reported by Khalil Fazal. Thanks!!!
---
lib/test/unit/assertions.rb | 63 ++++++++++----------
test/test-assertions.rb | 138 ++++++++++++++++++++++----------------------
2 files changed, 103 insertions(+), 98 deletions(-)
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index 4e02e82..af5799c 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -334,7 +334,7 @@ def assert_instance_of(klass, object, message="")
"<#{value}>"
end
full_message = build_message(message, <<EOT, object, klass_message, object.class)
-<?> expected to be instance_of\\?
+<?> was expected to be instance_of\\?
? but was
<?>.
EOT
@@ -370,7 +370,7 @@ def assert_not_instance_of(klass, object, message="")
"<#{value}>"
end
full_message = build_message(message,
- "<?> expected to not be instance_of\\?\n" +
+ "<?> was expected to not be instance_of\\?\n" +
"? but was.",
object,
klass_message)
@@ -392,7 +392,7 @@ def assert_not_instance_of(klass, object, message="")
# assert_nil [1, 2].uniq!
def assert_nil(object, message="")
full_message = build_message(message, <<EOT, object)
-<?> expected to be nil.
+<?> was expected to be nil.
EOT
assert_block(full_message) { object.nil? }
end
@@ -421,7 +421,7 @@ def assert_kind_of(klass, object, message="")
"<#{value}>"
end
full_message = build_message(message,
- "<?> expected to be kind_of\\?\n" +
+ "<?> was expected to be kind_of\\?\n" +
"? but was\n" +
"<?>.",
object,
@@ -459,7 +459,7 @@ def assert_not_kind_of(klass, object, message="")
"<#{value}>"
end
full_message = build_message(message,
- "<?> expected to not be kind_of\\?\n" +
+ "<?> was expected to not be kind_of\\?\n" +
"? but was.",
object,
klass_message)
@@ -537,7 +537,8 @@ def assert_match(pattern, string, message="")
else
pattern
end
- full_message = build_message(message, "<?> expected to be =~\n<?>.",
+ full_message = build_message(message,
+ "<?> was expected to be =~\n<?>.",
pattern, string)
assert_block(full_message) { pattern =~ string }
end
@@ -553,7 +554,7 @@ def assert_match(pattern, string, message="")
def assert_same(expected, actual, message="")
full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
<?>
-with id <?> expected to be equal\\? to
+with id <?> was expected to be equal\\? to
<?>
with id <?>.
EOT
@@ -572,7 +573,7 @@ def assert_operator(object1, operator, object2, message="")
full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
-<?> expected to be
+<?> was expected to be
?
<?>.
EOT
@@ -595,7 +596,7 @@ def assert_not_operator(object1, operator, object2, message="")
full_message = build_message(nil, "<?>\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
-<?> expected to not be
+<?> was expected to not be
?
<?>.
EOT
@@ -655,7 +656,7 @@ def flunk(message="Flunked")
def assert_not_same(expected, actual, message="")
full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
<?>
-with id <?> expected to not be equal\\? to
+with id <?> was expected to not be equal\\? to
<?>
with id <?>.
EOT
@@ -673,7 +674,9 @@ def assert_not_same(expected, actual, message="")
# @example
# assert_not_equal 'some string', 5
def assert_not_equal(expected, actual, message="")
- full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual)
+ full_message = build_message(message,
+ "<?> was expected to be != to\n<?>.",
+ expected, actual)
assert_block(full_message) { expected != actual }
end
@@ -688,7 +691,9 @@ def assert_not_equal(expected, actual, message="")
# @example
# assert_not_nil '1 two 3'.sub!(/two/, '2')
def assert_not_nil(object, message="")
- full_message = build_message(message, "<?> expected to not be nil.", object)
+ full_message = build_message(message,
+ "<?> was expected to not be nil.",
+ object)
assert_block(full_message){!object.nil?}
end
@@ -709,7 +714,7 @@ def assert_not_match(regexp, string, message="")
"<REGEXP> in assert_not_match(<REGEXP>, ...) " +
"should be a Regexp.")
full_message = build_message(message,
- "<?> expected to not match\n<?>.",
+ "<?> was expected to not match\n<?>.",
regexp, string)
assert_block(full_message) { regexp !~ string }
end
@@ -813,7 +818,7 @@ def assert_throw(expected_object, message="", &proc)
tag = extractor.extract_tag
raise if tag.nil?
full_message = build_message(message,
- "<?> expected to be thrown but\n" +
+ "<?> was expected to be thrown but\n" +
"<?> was thrown.",
expected_object, tag)
flunk(full_message)
@@ -921,12 +926,12 @@ def _assert_in_delta_message(expected_float, actual_float, delta,
message, options={})
if options[:negative_assertion]
format = <<-EOT
-<?> -/+ <?> expected to not include
+<?> -/+ <?> was expected to not include
<?>.
EOT
else
format = <<-EOT
-<?> -/+ <?> expected to include
+<?> -/+ <?> was expected to include
<?>.
EOT
end
@@ -1060,12 +1065,12 @@ def _assert_in_epsilon_message(expected_float, actual_float, epsilon,
if options[:negative_assertion]
format = <<-EOT
-<?> -/+ (<?> * <?>)[?] expected to not include
+<?> -/+ (<?> * <?>)[?] was expected to not include
<?>.
EOT
else
format = <<-EOT
-<?> -/+ (<?> * <?>)[?] expected to include
+<?> -/+ (<?> * <?>)[?] was expected to include
<?>.
EOT
end
@@ -1130,7 +1135,7 @@ def assert_send(send_array, message=nil)
"assert_send requires at least a receiver " +
"and a message name")
format = <<EOT
-<?> expected to respond to
+<?> was expected to respond to
<?(*?)> with a true value but was
<?>.
EOT
@@ -1170,7 +1175,7 @@ def assert_not_send(send_array, message=nil)
"assert_not_send requires at least a receiver " +
"and a message name")
format = <<EOT
-<?> expected to respond to
+<?> was expected to respond to
<?(*?)> with not a true value but was
<?>.
EOT
@@ -1260,7 +1265,7 @@ def assert_compare(expected, operator, actual, message=nil)
end
template = <<-EOT
<?> #{operator} <?> should be true
-<?> expected #{operator_description}
+<?> was expected to be #{operator_description}
<?>.
EOT
full_message = build_message(message, template,
@@ -1305,7 +1310,7 @@ def assert_fail_assertion(message=nil)
def assert_raise_message(expected, message=nil)
_wrap_assertion do
full_message = build_message(message,
- "<?> exception message expected " +
+ "<?> exception message was expected " +
"but none was thrown.",
expected)
exception = nil
@@ -1475,7 +1480,7 @@ def assert_alias_method(object, alias_name, original_name, message=nil)
def assert_path_exist(path, message=nil)
_wrap_assertion do
failure_message = build_message(message,
- "<?> expected to exist",
+ "<?> was expected to exist",
path)
assert_block(failure_message) do
File.exist?(path)
@@ -1493,7 +1498,7 @@ def assert_path_exist(path, message=nil)
def assert_path_not_exist(path, message=nil)
_wrap_assertion do
failure_message = build_message(message,
- "<?> expected to not exist",
+ "<?> was expected to not exist",
path)
assert_block(failure_message) do
not File.exist?(path)
@@ -1514,7 +1519,7 @@ def assert_include(collection, object, message=nil)
assert_respond_to(collection, :include?,
"The collection must respond to :include?.")
full_message = build_message(message,
- "<?> expected to include\n<?>.",
+ "<?> was expected to include\n<?>.",
collection,
object)
assert_block(full_message) do
@@ -1541,7 +1546,7 @@ def assert_not_include(collection, object, message=nil)
assert_respond_to(collection, :include?,
"The collection must respond to :include?.")
full_message = build_message(message,
- "<?> expected to not include\n<?>.",
+ "<?> was expected to not include\n<?>.",
collection,
object)
assert_block(full_message) do
@@ -1575,7 +1580,7 @@ def assert_empty(object, message=nil)
assert_respond_to(object, :empty?,
"The object must respond to :empty?.")
full_message = build_message(message,
- "<?> expected to be empty.",
+ "<?> was expected to be empty.",
object)
assert_block(full_message) do
object.empty?
@@ -1598,7 +1603,7 @@ def assert_not_empty(object, message=nil)
assert_respond_to(object, :empty?,
"The object must respond to :empty?.")
full_message = build_message(message,
- "<?> expected to not be empty.",
+ "<?> was expected to not be empty.",
object)
assert_block(full_message) do
not object.empty?
@@ -1666,7 +1671,7 @@ def _assert_raise(assert_expected_exception, *args, &block)
expected = assert_exception_helper.expected_exceptions
actual_exception = nil
full_message = build_message(message,
- "<?> exception expected " +
+ "<?> exception was expected " +
"but none was thrown.",
expected)
assert_block(full_message) do
diff --git a/test/test-assertions.rb b/test/test-assertions.rb
index a1e95d0..89ff8b3 100644
--- a/test/test-assertions.rb
+++ b/test/test-assertions.rb
@@ -495,7 +495,7 @@ def test_assert_raise_success
end
def test_assert_raise_fail
- check_fail("<RuntimeError> exception expected but none was thrown.") do
+ check_fail("<RuntimeError> exception was expected but none was thrown.") do
assert_raise(RuntimeError) do
1 + 1
end
@@ -556,7 +556,7 @@ def test_assert_raise_module
end
check_fail("<[ArgumentError, TypeError, Math, Comparable]> exception " +
- "expected but none was thrown.") do
+ "was expected but none was thrown.") do
assert_raise(*rescues) do
1 + 1
end
@@ -663,20 +663,20 @@ def test_assert_instance_of
check_nothing_fails {
assert_instance_of(String, "string", "successful assert_instance_of")
}
- check_fail(%Q{<"string"> expected to be instance_of?\n<Hash> but was\n<String>.}) {
+ check_fail(%Q{<"string"> was expected to be instance_of?\n<Hash> but was\n<String>.}) {
assert_instance_of(Hash, "string")
}
- check_fail(%Q{failed assert_instance_of.\n<"string"> expected to be instance_of?\n<Hash> but was\n<String>.}) {
+ check_fail(%Q{failed assert_instance_of.\n<"string"> was expected to be instance_of?\n<Hash> but was\n<String>.}) {
assert_instance_of(Hash, "string", "failed assert_instance_of")
}
check_nothing_fails do
assert_instance_of([Fixnum, NilClass], 100)
end
- check_fail(%Q{<"string"> expected to be instance_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
+ check_fail(%Q{<"string"> was expected to be instance_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
assert_instance_of([Fixnum, NilClass], "string")
end
- check_fail(%Q{<100> expected to be instance_of?\n[<Numeric>, <NilClass>] but was\n<Fixnum>.}) do
+ check_fail(%Q{<100> was expected to be instance_of?\n[<Numeric>, <NilClass>] but was\n<Fixnum>.}) do
assert_instance_of([Numeric, NilClass], 100)
end
end
@@ -688,20 +688,20 @@ def test_assert_not_instance_of
check_nothing_fails {
assert_not_instance_of(NilClass, "string", "successful assert_instance_of")
}
- check_fail(%Q{<"string"> expected to not be instance_of?\n<String> but was.}) {
+ check_fail(%Q{<"string"> was expected to not be instance_of?\n<String> but was.}) {
assert_not_instance_of(String, "string")
}
- check_fail(%Q{failed assert.\n<"string"> expected to not be instance_of?\n<String> but was.}) {
+ check_fail(%Q{failed assert.\n<"string"> was expected to not be instance_of?\n<String> but was.}) {
assert_not_instance_of(String, "string", "failed assert")
}
check_nothing_fails do
assert_not_instance_of([Numeric, NilClass], 100)
end
- check_fail(%Q{<100> expected to not be instance_of?\n[<Fixnum>, <NilClass>] but was.}) do
+ check_fail(%Q{<100> was expected to not be instance_of?\n[<Fixnum>, <NilClass>] but was.}) do
assert_not_instance_of([Fixnum, NilClass], 100)
end
- check_fail(%Q{<"str"> expected to not be instance_of?\n[<Numeric>, <String>] but was.}) do
+ check_fail(%Q{<"str"> was expected to not be instance_of?\n[<Numeric>, <String>] but was.}) do
assert_not_instance_of([Numeric, String], 'str')
end
end
@@ -716,10 +716,10 @@ def test_assert_nil
check_nothing_fails {
assert_nil(nil, "successful assert_nil")
}
- check_fail(%Q{<"string"> expected to be nil.}) {
+ check_fail(%Q{<"string"> was expected to be nil.}) {
assert_nil("string")
}
- check_fail(%Q{failed assert_nil.\n<"string"> expected to be nil.}) {
+ check_fail(%Q{failed assert_nil.\n<"string"> was expected to be nil.}) {
assert_nil("string", "failed assert_nil")
}
end
@@ -727,8 +727,8 @@ def test_assert_nil
def test_assert_not_nil
check_nothing_fails{assert_not_nil(false)}
check_nothing_fails{assert_not_nil(false, "message")}
- check_fail("<nil> expected to not be nil."){assert_not_nil(nil)}
- check_fail("message.\n<nil> expected to not be nil.") {assert_not_nil(nil, "message")}
+ check_fail("<nil> was expected to not be nil."){assert_not_nil(nil)}
+ check_fail("message.\n<nil> was expected to not be nil.") {assert_not_nil(nil, "message")}
end
def test_assert_kind_of
@@ -744,17 +744,17 @@ def test_assert_kind_of
check_nothing_fails {
assert_kind_of(Comparable, 1)
}
- check_fail(%Q{<"string"> expected to be kind_of?\n<Class> but was\n<String>.}) {
+ check_fail(%Q{<"string"> was expected to be kind_of?\n<Class> but was\n<String>.}) {
assert_kind_of(Class, "string")
}
- check_fail(%Q{failed assert_kind_of.\n<"string"> expected to be kind_of?\n<Class> but was\n<String>.}) {
+ check_fail(%Q{failed assert_kind_of.\n<"string"> was expected to be kind_of?\n<Class> but was\n<String>.}) {
assert_kind_of(Class, "string", "failed assert_kind_of")
}
check_nothing_fails do
assert_kind_of([Fixnum, NilClass], 100)
end
- check_fail(%Q{<"string"> expected to be kind_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
+ check_fail(%Q{<"string"> was expected to be kind_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
assert_kind_of([Fixnum, NilClass], "string")
end
end
@@ -769,17 +769,17 @@ def test_assert_not_kind_of
check_nothing_fails {
assert_not_kind_of(Integer, 1.1)
}
- check_fail(%Q{<1> expected to not be kind_of?\n<Integer> but was.}) {
+ check_fail(%Q{<1> was expected to not be kind_of?\n<Integer> but was.}) {
assert_not_kind_of(Integer, 1)
}
- check_fail(%Q{failed assert_not_kind_of.\n<"string"> expected to not be kind_of?\n<String> but was.}) {
+ check_fail(%Q{failed assert_not_kind_of.\n<"string"> was expected to not be kind_of?\n<String> but was.}) {
assert_not_kind_of(String, "string", "failed assert_not_kind_of")
}
check_nothing_fails do
assert_not_kind_of([String, NilClass], 100)
end
- check_fail(%Q{<100> expected to not be kind_of?\n[<Fixnum>, <NilClass>] but was.}) do
+ check_fail(%Q{<100> was expected to not be kind_of?\n[<Fixnum>, <NilClass>] but was.}) do
assert_not_kind_of([Fixnum, NilClass], 100)
end
end
@@ -797,13 +797,13 @@ def test_assert_match
check_nothing_fails {
assert_match(/strin./, "string", "successful assert_match")
}
- check_fail(%Q{</slin./> expected to be =~\n<"string">.}) {
+ check_fail(%Q{</slin./> was expected to be =~\n<"string">.}) {
assert_match(/slin./, "string")
}
- check_fail(%Q{</strin\\./> expected to be =~\n<"string">.}) {
+ check_fail(%Q{</strin\\./> was expected to be =~\n<"string">.}) {
assert_match("strin.", "string")
}
- check_fail(%Q{failed assert_match.\n</slin./> expected to be =~\n<"string">.}) {
+ check_fail(%Q{failed assert_match.\n</slin./> was expected to be =~\n<"string">.}) {
assert_match(/slin./, "string", "failed assert_match")
}
end
@@ -820,10 +820,10 @@ def test_assert_same
assert_same(thing, thing, "successful assert_same")
}
thing2 = "thing"
- check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
+ check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> was expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
assert_same(thing, thing2)
}
- check_fail(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
+ check_fail(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> was expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
assert_same(thing, thing2, "failed assert_same")
}
end
@@ -913,10 +913,10 @@ def test_assert_not_same
check_nothing_fails {
assert_not_same(thing, thing2, "message")
}
- check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
+ check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> was expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
assert_not_same(thing, thing)
}
- check_fail(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
+ check_fail(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> was expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
assert_not_same(thing, thing, "message")
}
end
@@ -928,10 +928,10 @@ def test_assert_not_equal
check_nothing_fails {
assert_not_equal("string1", "string2", "message")
}
- check_fail(%Q{<"string"> expected to be != to\n<"string">.}) {
+ check_fail(%Q{<"string"> was expected to be != to\n<"string">.}) {
assert_not_equal("string", "string")
}
- check_fail(%Q{message.\n<"string"> expected to be != to\n<"string">.}) {
+ check_fail(%Q{message.\n<"string"> was expected to be != to\n<"string">.}) {
assert_not_equal("string", "string", "message")
}
end
@@ -951,7 +951,7 @@ def test_assert_not_match_pass_with_message
def test_assert_not_match_fail_not_regexp
check_fail("<REGEXP> in assert_not_match(<REGEXP>, ...) " +
"should be a Regexp.\n" +
- "<\"asdf\"> expected to be instance_of?\n" +
+ "<\"asdf\"> was expected to be instance_of?\n" +
"<Regexp> but was\n" +
"<String>.") do
assert_not_match("asdf", "asdf")
@@ -959,7 +959,7 @@ def test_assert_not_match_fail_not_regexp
end
def test_assert_not_match_fail_match
- check_fail("</string/> expected to not match\n" +
+ check_fail("</string/> was expected to not match\n" +
"<\"string\">.") do
assert_not_match(/string/, "string")
end
@@ -967,7 +967,7 @@ def test_assert_not_match_fail_match
def test_assert_not_match_fail_match_with_message
check_fail("message.\n" +
- "</string/> expected to not match\n" +
+ "</string/> was expected to not match\n" +
"<\"string\">.") do
assert_not_match(/string/, "string", "message")
end
@@ -976,13 +976,13 @@ def test_assert_not_match_fail_match_with_message
def test_assert_no_match
check_nothing_fails{assert_no_match(/sling/, "string")}
check_nothing_fails{assert_no_match(/sling/, "string", "message")}
- check_fail(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> expected to be instance_of?\n<Regexp> but was\n<String>.}) do
+ check_fail(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> was expected to be instance_of?\n<Regexp> but was\n<String>.}) do
assert_no_match("asdf", "asdf")
end
- check_fail(%Q{</string/> expected to not match\n<"string">.}) do
+ check_fail(%Q{</string/> was expected to not match\n<"string">.}) do
assert_no_match(/string/, "string")
end
- check_fail(%Q{message.\n</string/> expected to not match\n<"string">.}) do
+ check_fail(%Q{message.\n</string/> was expected to not match\n<"string">.}) do
assert_no_match(/string/, "string", "message")
end
end
@@ -996,7 +996,7 @@ def test_assert_throw
tag = :thing2
check_fail("message.\n" +
- "<:thing> expected to be thrown but\n" +
+ "<:thing> was expected to be thrown but\n" +
"<#{inspect_tag(tag)}> was thrown.") do
assert_throw(:thing, "message") do
throw :thing2
@@ -1034,7 +1034,7 @@ def test_assert_operator
check_fail(%Q{<0.15>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to?(:to_str).}) do
assert_operator("thing", 0.15, "thing")
end
- check_fail(%Q{message.\n<"thing1"> expected to be\n==\n<"thing2">.}) {
+ check_fail(%Q{message.\n<"thing1"> was expected to be\n==\n<"thing2">.}) {
assert_operator("thing1", :==, "thing2", "message")
}
end
@@ -1046,7 +1046,7 @@ def test_assert_not_operator
check_fail(%Q{<42>\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to?(:to_str).}) do
assert_not_operator("thing", 42, "message")
end
- check_fail(%Q{message.\n<0> expected to not be\n==\n<0.0>.}) {
+ check_fail(%Q{message.\n<0> was expected to not be\n==\n<0.0>.}) {
assert_not_operator(0, :==, 0.0, "message")
}
end
@@ -1111,7 +1111,7 @@ def return_argument(argument, bogus)
inspected_object = AssertionMessage.convert(object)
expected_message = <<-EOM
message.
-<#{inspected_object}> expected to respond to
+<#{inspected_object}> was expected to respond to
<return_argument(*[false, "bogus"])> with a true value but was
<false>.
EOM
@@ -1210,7 +1210,7 @@ def test_assert_compare
expected_message = <<-EOM
<15> < <10> should be true
-<15> expected less than
+<15> was expected to be less than
<10>.
EOM
check_fail(expected_message.chomp) do
@@ -1219,7 +1219,7 @@ def test_assert_compare
expected_message = <<-EOM
<15> <= <10> should be true
-<15> expected less than or equal to
+<15> was expected to be less than or equal to
<10>.
EOM
check_fail(expected_message.chomp) do
@@ -1228,7 +1228,7 @@ def test_assert_compare
expected_message = <<-EOM
<10> > <15> should be true
-<10> expected greater than
+<10> was expected to be greater than
<15>.
EOM
check_fail(expected_message.chomp) do
@@ -1237,7 +1237,7 @@ def test_assert_compare
expected_message = <<-EOM
<10> >= <15> should be true
-<10> expected greater than or equal to
+<10> was expected to be greater than or equal to
<15>.
EOM
check_fail(expected_message.chomp) do
@@ -1288,7 +1288,7 @@ def test_assert_raise_message
end
expected_message = <<-EOM
-<"Expected message"> exception message expected but none was thrown.
+<"Expected message"> exception message was expected but none was thrown.
EOM
check_fail(expected_message.chomp) do
assert_raise_message("Expected message") do
@@ -1414,7 +1414,7 @@ def test_assert_path_exist
end
nonexistent_file = __FILE__ + ".nonexistent"
- check_fail("<#{nonexistent_file.inspect}> expected to exist") do
+ check_fail("<#{nonexistent_file.inspect}> was expected to exist") do
assert_path_exist(nonexistent_file)
end
end
@@ -1425,7 +1425,7 @@ def test_assert_path_not_exist
assert_path_not_exist(nonexistent_file)
end
- check_fail("<#{__FILE__.inspect}> expected to not exist") do
+ check_fail("<#{__FILE__.inspect}> was expected to not exist") do
assert_path_not_exist(__FILE__)
end
end
@@ -1635,7 +1635,7 @@ def test_pass_string_expected
def test_fail_with_message
check_fail("message.\n" +
- "<0.5> -/+ <0.05> expected to include\n" +
+ "<0.5> -/+ <0.05> was expected to include\n" +
"<0.4>.\n" +
"\n" +
"Relation:\n" +
@@ -1657,13 +1657,13 @@ def test_fail_because_not_float_like_object
def test_fail_because_negaitve_delta
check_fail("The delta should not be negative.\n" +
- "<-0.1> expected to be\n>=\n<0.0>.") do
+ "<-0.1> was expected to be\n>=\n<0.0>.") do
assert_in_delta(0.5, 0.4, -0.1, "message")
end
end
def test_fail_without_delta
- check_fail("<1.402> -/+ <0.001> expected to include\n" +
+ check_fail("<1.402> -/+ <0.001> was expected to include\n" +
"<1.404>.\n" +
"\n" +
"Relation:\n" +
@@ -1715,7 +1715,7 @@ def test_pass_string_epxected
end
def test_fail
- check_fail("<1.4> -/+ <0.11> expected to not include\n" +
+ check_fail("<1.4> -/+ <0.11> was expected to not include\n" +
"<1.5>.\n" +
"\n" +
"Relation:\n" +
@@ -1729,7 +1729,7 @@ def test_fail
end
def test_fail_without_delta
- check_fail("<1.402> -/+ <0.001> expected to not include\n" +
+ check_fail("<1.402> -/+ <0.001> was expected to not include\n" +
"<1.4021>.\n" +
"\n" +
"Relation:\n" +
@@ -1744,7 +1744,7 @@ def test_fail_without_delta
def test_fail_with_message
check_fail("message.\n" +
- "<0.5> -/+ <0.11> expected to not include\n" +
+ "<0.5> -/+ <0.11> was expected to not include\n" +
"<0.4>.\n" +
"\n" +
"Relation:\n" +
@@ -1770,7 +1770,7 @@ def test_fail_because_not_float_like_object
def test_fail_because_negaitve_delta
check_fail("The delta should not be negative.\n" +
- "<-0.11> expected to be\n>=\n<0.0>.") do
+ "<-0.11> was expected to be\n>=\n<0.0>.") do
assert_not_in_delta(0.5, 0.4, -0.11, "message")
end
end
@@ -1828,7 +1828,7 @@ def test_pass_minus_expected
def test_fail_with_message
check_fail("message.\n" +
"<10000> -/+ (<10000> * <0.1>)[1000.0] " +
- "expected to include\n" +
+ "was expected to include\n" +
"<8999>.\n" +
"\n" +
"Relation:\n" +
@@ -1854,14 +1854,14 @@ def test_fail_because_not_float_like_object
def test_fail_because_negaitve_epsilon
check_fail("The epsilon should not be negative.\n" +
- "<-0.1> expected to be\n>=\n<0.0>.") do
+ "<-0.1> was expected to be\n>=\n<0.0>.") do
assert_in_epsilon(10000, 9000, -0.1, "message")
end
end
def test_fail_without_epsilon
check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " +
- "expected to include\n" +
+ "was expected to include\n" +
"<10011>.\n" +
"\n" +
"Relation:\n" +
@@ -1914,7 +1914,7 @@ def test_pass_string_epxected
def test_fail
check_fail("<10000> -/+ (<10000> * <0.1>)[1000.0] " +
- "expected to not include\n" +
+ "was expected to not include\n" +
"<9000>.\n" +
"\n" +
"Relation:\n" +
@@ -1929,7 +1929,7 @@ def test_fail
def test_fail_without_epsilon
check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " +
- "expected to not include\n" +
+ "was expected to not include\n" +
"<9990>.\n" +
"\n" +
"Relation:\n" +
@@ -1945,7 +1945,7 @@ def test_fail_without_epsilon
def test_fail_with_message
check_fail("message.\n" +
"<10000> -/+ (<10000> * <0.1>)[1000.0] " +
- "expected to not include\n" +
+ "was expected to not include\n" +
"<9000>.\n" +
"\n" +
"Relation:\n" +
@@ -1971,7 +1971,7 @@ def test_fail_because_not_float_like_object
def test_fail_because_negaitve_epsilon
check_fail("The epsilon should not be negative.\n" +
- "<-0.1> expected to be\n>=\n<0.0>.") do
+ "<-0.1> was expected to be\n>=\n<0.0>.") do
assert_not_in_epsilon(10000, 9000, -0.1, "message")
end
end
@@ -1993,7 +1993,7 @@ def test_pass_with_message
end
def test_fail
- check_fail("<[1, 2, 3]> expected to include\n" +
+ check_fail("<[1, 2, 3]> was expected to include\n" +
"<4>.") do
assert_include([1, 2, 3], 4)
end
@@ -2001,7 +2001,7 @@ def test_fail
def test_fail_with_message
check_fail("message.\n" +
- "<[1, 2, 3]> expected to include\n" +
+ "<[1, 2, 3]> was expected to include\n" +
"<4>.") do
assert_include([1, 2, 3], 4, "message")
end
@@ -2034,7 +2034,7 @@ def test_pass_with_message
end
def test_fail
- check_fail("<[1, 2, 3]> expected to not include\n" +
+ check_fail("<[1, 2, 3]> was expected to not include\n" +
"<2>.") do
assert_not_include([1, 2, 3], 2)
end
@@ -2042,7 +2042,7 @@ def test_fail
def test_fail_with_message
check_fail("message.\n" +
- "<[1, 2, 3]> expected to not include\n" +
+ "<[1, 2, 3]> was expected to not include\n" +
"<2>.") do
assert_not_include([1, 2, 3], 2, "message")
end
@@ -2075,14 +2075,14 @@ def test_pass_with_message
end
def test_fail
- check_fail("<[1]> expected to be empty.") do
+ check_fail("<[1]> was expected to be empty.") do
assert_empty([1])
end
end
def test_fail_with_message
check_fail("message.\n" +
- "<[1]> expected to be empty.") do
+ "<[1]> was expected to be empty.") do
assert_empty([1], "message")
end
end
@@ -2114,14 +2114,14 @@ def test_pass_with_message
end
def test_fail
- check_fail("<[]> expected to not be empty.") do
+ check_fail("<[]> was expected to not be empty.") do
assert_not_empty([])
end
end
def test_fail_with_message
check_fail("message.\n" +
- "<[]> expected to not be empty.") do
+ "<[]> was expected to not be empty.") do
assert_not_empty([], "message")
end
end
@@ -2149,7 +2149,7 @@ def test_pass
def test_fail
expected_message = <<-EOM
message.
-<[1, 2]> expected to respond to
+<[1, 2]> was expected to respond to
<member?(*[2])> with not a true value but was
<true>.
EOM

View file

@ -1,71 +0,0 @@
From 5bb2a1be4d662d57d38ec451cd0089bc1a76a0d5 Mon Sep 17 00:00:00 2001
From: Kazuki Tsujimoto <kazuki@callcc.net>
Date: Sat, 7 Jan 2017 19:04:08 +0900
Subject: [PATCH] Follow up Integer Unification
---
test/test-assertions.rb | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/test/test-assertions.rb b/test/test-assertions.rb
index c3907ce..d9fc62d 100644
--- a/test/test-assertions.rb
+++ b/test/test-assertions.rb
@@ -671,13 +671,13 @@ def test_assert_instance_of
}
check_nothing_fails do
- assert_instance_of([Fixnum, NilClass], 100)
+ assert_instance_of([Class, NilClass], Array)
end
- check_fail(%Q{<"string"> was expected to be instance_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
- assert_instance_of([Fixnum, NilClass], "string")
+ check_fail(%Q{<"string"> was expected to be instance_of?\n[<Class>, <NilClass>] but was\n<String>.}) do
+ assert_instance_of([Class, NilClass], "string")
end
- check_fail(%Q{<100> was expected to be instance_of?\n[<Numeric>, <NilClass>] but was\n<Fixnum>.}) do
- assert_instance_of([Numeric, NilClass], 100)
+ check_fail(%Q{<Array> was expected to be instance_of?\n[<Module>, <NilClass>] but was\n<Class>.}) do
+ assert_instance_of([Module, NilClass], Array)
end
end
@@ -696,10 +696,10 @@ def test_assert_not_instance_of
}
check_nothing_fails do
- assert_not_instance_of([Numeric, NilClass], 100)
+ assert_not_instance_of([Module, NilClass], Array)
end
- check_fail(%Q{<100> was expected to not be instance_of?\n[<Fixnum>, <NilClass>] but was.}) do
- assert_not_instance_of([Fixnum, NilClass], 100)
+ check_fail(%Q{<Array> was expected to not be instance_of?\n[<Class>, <NilClass>] but was.}) do
+ assert_not_instance_of([Class, NilClass], Array)
end
check_fail(%Q{<"str"> was expected to not be instance_of?\n[<Numeric>, <String>] but was.}) do
assert_not_instance_of([Numeric, String], 'str')
@@ -752,10 +752,10 @@ def test_assert_kind_of
}
check_nothing_fails do
- assert_kind_of([Fixnum, NilClass], 100)
+ assert_kind_of([Class, NilClass], Array)
end
- check_fail(%Q{<"string"> was expected to be kind_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do
- assert_kind_of([Fixnum, NilClass], "string")
+ check_fail(%Q{<"string"> was expected to be kind_of?\n[<Class>, <NilClass>] but was\n<String>.}) do
+ assert_kind_of([Class, NilClass], "string")
end
end
@@ -779,8 +779,8 @@ def test_assert_not_kind_of
check_nothing_fails do
assert_not_kind_of([String, NilClass], 100)
end
- check_fail(%Q{<100> was expected to not be kind_of?\n[<Fixnum>, <NilClass>] but was.}) do
- assert_not_kind_of([Fixnum, NilClass], 100)
+ check_fail(%Q{<Array> was expected to not be kind_of?\n[<Class>, <NilClass>] but was.}) do
+ assert_not_kind_of([Class, NilClass], Array)
end
end

View file

@ -1,35 +0,0 @@
From 6e95be1f8aa437ce4b94fd3d867a4064ba87add3 Mon Sep 17 00:00:00 2001
From: Kazuki Tsujimoto <kazuki@callcc.net>
Date: Sat, 28 Jan 2017 15:19:05 +0900
Subject: [PATCH] Follow up to power_assert 1.0.0
---
test/test-assertions.rb | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/test-assertions.rb b/test/test-assertions.rb
index d9fc62d..d98893a 100644
--- a/test/test-assertions.rb
+++ b/test/test-assertions.rb
@@ -1521,15 +1521,18 @@ def test_error_wrong_number_of_arguments
class TestBlock < self
def test_with_message
if defined?(PowerAssert)
- system_message = <<-MESSAGE
- 1 == 2
+ system_message = <<-MESSAGE.chomp
+ 1.to_s == "2"
+ | |
+ | false
+ "1"
MESSAGE
else
system_message = "<false> is not true."
end
check_fail("user message.\n#{system_message}") do
assert("user message") do
- 1 == 2
+ 1.to_s == "2"
end
end
end

View file

@ -1,68 +0,0 @@
From f0b9ad6a28b666665ec6fb459c3860ed8ff78804 Mon Sep 17 00:00:00 2001
From: Kazuki Tsujimoto <kazuki@callcc.net>
Date: Sat, 7 Jan 2017 18:03:13 +0900
Subject: [PATCH] Follow up pp format change of a multiple lines string
---
test/test-assertions.rb | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/test/test-assertions.rb b/test/test-assertions.rb
index 89ff8b3..c3907ce 100644
--- a/test/test-assertions.rb
+++ b/test/test-assertions.rb
@@ -301,8 +301,8 @@ def test_same_inspected_objects
def test_multi_lines_result
message = <<-EOM.chomp
-<#{"a\nb".inspect}> expected but was
-<#{"x".inspect}>.
+<#{AssertionMessage.convert("a\nb")}> expected but was
+<#{AssertionMessage.convert("x")}>.
diff:
+ x
@@ -316,8 +316,8 @@ def test_multi_lines_result
def test_large_string
message = <<-EOM.chomp
-<#{("a\n" + "x" * 997).inspect}> expected but was
-<#{"x".inspect}>.
+<#{AssertionMessage.convert("a\n" + "x" * 997)}> expected but was
+<#{AssertionMessage.convert("x")}>.
diff:
+ x
@@ -335,8 +335,8 @@ def test_large_string
end
message = <<-EOM.chomp
-<#{("a\n" + "x" * 998).inspect}> expected but was
-<#{"x".inspect}>.
+<#{AssertionMessage.convert("a\n" + "x" * 998)}> expected but was
+<#{AssertionMessage.convert("x")}>.
EOM
check_fail(message) do
assert_equal("a\n" + "x" * 998, "x")
@@ -349,8 +349,8 @@ def test_max_diff_target_string_size
ENV[key] = "100"
begin
message = <<-EOM.chomp
-<#{("a\n" + "x" * 97).inspect}> expected but was
-<#{"x".inspect}>.
+<#{AssertionMessage.convert("a\n" + "x" * 97)}> expected but was
+<#{AssertionMessage.convert("x")}>.
diff:
+ x
@@ -368,8 +368,8 @@ def test_max_diff_target_string_size
end
message = <<-EOM.chomp
-<#{("a\n" + "x" * 98).inspect}> expected but was
-<#{"x".inspect}>.
+<#{AssertionMessage.convert("a\n" + "x" * 98)}> expected but was
+<#{AssertionMessage.convert("x")}>.
EOM
check_fail(message) do
assert_equal("a\n" + "x" * 98, "x")

View file

@ -5,8 +5,8 @@
Summary: Improved version of Test::Unit bundled in Ruby 1.8.x
Name: rubygem-%{gem_name}
Version: 3.2.3
Release: 103%{?dist}
Version: 3.2.4
Release: 100%{?dist}
Group: Development/Languages
# lib/test/unit/diff.rb is under GPLv2 or Ruby or Python
# lib/test-unit.rb is under LGPLv2+ or Ruby
@ -15,17 +15,6 @@ License: (GPLv2 or Ruby) and (GPLv2 or Ruby or Python) and (LGPLv2+ or Ruby)
URL: http://test-unit.github.io/
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
# https://github.com/test-unit/test-unit/pull/136
# Patch3 needs Patch1
# https://github.com/test-unit/test-unit/commit/3b259a38397dff780857a439798406c0c4eef3b7.patch
Patch1: rubygem-test-unit-3.2.3-fix-assertion-message.patch
# https://github.com/test-unit/test-unit/commit/f0b9ad6a28b666665ec6fb459c3860ed8ff78804.patch
Patch2: rubygem-test-unit-3.2.3-follow-up-pp-format-change.patch
# https://github.com/test-unit/test-unit/commit/5bb2a1be4d662d57d38ec451cd0089bc1a76a0d5.patch
Patch3: rubygem-test-unit-3.2.3-follow-up-integer-unification.patch
# https://github.com/test-unit/test-unit/pull/137
# https://github.com/test-unit/test-unit/commit/43b78d95c5386df37a226ab2f3da957b545a2e9c.patch
Patch4: rubygem-test-unit-3.2.3-follow-up-power_assert-1.0.0.patch
BuildRequires: ruby(release)
BuildRequires: rubygems
@ -65,11 +54,6 @@ pushd tmpunpackdir
gem unpack %{SOURCE0}
cd %{gem_name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
gem build %{gem_name}.gemspec
mv %{gem_name}-%{version}.gem $TOPDIR
@ -88,15 +72,6 @@ mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
# Keep testrb2
%if 0%{?fedora} < 22
mkdir %{buildroot}%{_bindir}
cat %{_bindir}/testrb | \
sed -e '\@require@s|test/unit|test-unit|' \
> %{buildroot}%{_bindir}/testrb2
chmod 0755 %{buildroot}%{_bindir}/testrb2
%endif
%check
pushd .%{gem_instdir}
#rake test --trace
@ -109,9 +84,6 @@ popd
%doc %{gem_instdir}/[A-Z]*
%exclude %{gem_instdir}/Rakefile
%if 0%{?fedora} < 22
%{_bindir}/testrb2
%endif
%{gem_instdir}/lib/
%exclude %{gem_cache}
@ -128,6 +100,9 @@ popd
%{gem_docdir}/
%changelog
* Fri May 26 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.2.4-100
- 3.2.4
* Fri May 5 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.2.3-103
- Follow up power_assert 1.0.0 change

View file

@ -1 +1 @@
a1ce253a7b71816e32e2ef482ca0b378 test-unit-3.2.3.gem
SHA512 (test-unit-3.2.4.gem) = e2ff209c9aef1b01c14a9dcea0c07d22fdc302cb42d68ffa8dd98d64dc444252ee746c3f3a2ad6ff4651c176d84d1b862e037a8a140c078b7f142a624115d3c7