summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2023-07-01 21:55:31 +0900
committerKazuki Yamaguchi <k@rhe.jp>2023-08-16 14:48:41 +0900
commit382b42be9446e1d215109cc47db9ebc156cb8f8f (patch)
treeef146160792c6474431ea26a1c2e034932568663
parent01d368e7b06ccf34f92c535a117a2856956d2bcb (diff)
[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
-rw-r--r--test/openssl/test_config.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb
index 24a215a486..6dbb9c6138 100644
--- a/test/openssl/test_config.rb
+++ b/test/openssl/test_config.rb
@@ -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