diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2023-07-01 21:55:31 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2023-08-11 01:35:26 +0900 |
commit | fd6f76c0d306cb96d9d5fd0792a844cd6b65140a (patch) | |
tree | af2507ea6d6445a8ebb33150f40c0d318bc7e22d | |
parent | db633c52f7b364ded8185b661fb557e9db2f6383 (diff) | |
download | ruby-openssl-fd6f76c0d306cb96d9d5fd0792a844cd6b65140a.tar.gz |
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.
-rw-r--r-- | test/openssl/test_config.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb index 24a215a4..6dbb9c61 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 |