зеркало из https://github.com/github/ruby.git
test_m17n_comb.rb: refine assertions
* test/ruby/test_m17n_comb.rb (test_str_scan): refine assertion messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7c9f1aa3d5
Коммит
2dc8f669a8
|
@ -1036,25 +1036,26 @@ class TestM17NComb < Test::Unit::TestCase
|
|||
|
||||
def test_str_scan
|
||||
combination(STRINGS, STRINGS) {|s1, s2|
|
||||
desc = proc {"#{s1.dump}.scan(#{s2.dump})"}
|
||||
if !s2.valid_encoding?
|
||||
assert_raise(RegexpError) { s1.scan(s2) }
|
||||
assert_raise(RegexpError, desc) { s1.scan(s2) }
|
||||
next
|
||||
end
|
||||
if !s1.ascii_only? && !s2.ascii_only? && s1.encoding != s2.encoding
|
||||
if s1.valid_encoding?
|
||||
assert_raise(Encoding::CompatibilityError) { s1.scan(s2) }
|
||||
assert_raise(Encoding::CompatibilityError, desc) { s1.scan(s2) }
|
||||
else
|
||||
assert_match(/invalid byte sequence/, assert_raise(ArgumentError) { s1.scan(s2) }.message)
|
||||
assert_raise_with_message(ArgumentError, /invalid byte sequence/, desc) { s1.scan(s2) }
|
||||
end
|
||||
next
|
||||
end
|
||||
if !s1.valid_encoding?
|
||||
assert_raise(ArgumentError) { s1.scan(s2) }
|
||||
assert_raise(ArgumentError, desc) { s1.scan(s2) }
|
||||
next
|
||||
end
|
||||
r = enccall(s1, :scan, s2)
|
||||
r.each {|t|
|
||||
assert_equal(s2, t)
|
||||
assert_equal(s2, t, desc)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче