зеркало из https://github.com/github/ruby.git
[ruby/openssl] config: relax test assertions against error messages
Test that the error message contains the necessary text instead of the exact match. Exceptions raised by ossl_raise() may carry additional context information in the message. https://github.com/ruby/openssl/commit/fd6f76c0d3
This commit is contained in:
Родитель
01d368e7b0
Коммит
382b42be94
|
@ -91,22 +91,19 @@ __EOC__
|
|||
assert_equal('123baz456bar798', c['dollar']['qux'])
|
||||
assert_equal('123baz456bar798.123baz456bar798', c['dollar']['quxx'])
|
||||
|
||||
excn = assert_raise(OpenSSL::ConfigError) do
|
||||
assert_raise_with_message(OpenSSL::ConfigError, /error in line 1: variable has no value/) do
|
||||
OpenSSL::Config.parse("foo = $bar")
|
||||
end
|
||||
assert_equal("error in line 1: variable has no value", excn.message)
|
||||
|
||||
excn = assert_raise(OpenSSL::ConfigError) do
|
||||
assert_raise_with_message(OpenSSL::ConfigError, /error in line 1: no close brace/) do
|
||||
OpenSSL::Config.parse("foo = $(bar")
|
||||
end
|
||||
assert_equal("error in line 1: no close brace", excn.message)
|
||||
|
||||
excn = assert_raise(OpenSSL::ConfigError) do
|
||||
assert_raise_with_message(OpenSSL::ConfigError, /error in line 1: missing equal sign/) do
|
||||
OpenSSL::Config.parse("f o =b ar # no space in key")
|
||||
end
|
||||
assert_equal("error in line 1: missing equal sign", excn.message)
|
||||
|
||||
excn = assert_raise(OpenSSL::ConfigError) do
|
||||
assert_raise_with_message(OpenSSL::ConfigError, /error in line 7: missing close square bracket/) do
|
||||
OpenSSL::Config.parse(<<__EOC__)
|
||||
# comment 1 # comments
|
||||
|
||||
|
@ -117,7 +114,6 @@ __EOC__
|
|||
[third # section not terminated
|
||||
__EOC__
|
||||
end
|
||||
assert_equal("error in line 7: missing close square bracket", excn.message)
|
||||
end
|
||||
|
||||
def test_s_parse_include
|
||||
|
|
Загрузка…
Ссылка в новой задаче