aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2020-02-19 05:06:09 +0000
committerKazuki Yamaguchi <k@rhe.jp>2020-05-13 16:01:18 +0900
commitc891e0ea8951230c19919c6960d88b8d038395e9 (patch)
tree086b76a33cf9f20200477b1613f59fd8cba0705c /test
parentb70817faec1ca45cebe533a02617e7ac04d5ecbc (diff)
downloadruby-openssl-c891e0ea8951230c19919c6960d88b8d038395e9.tar.gz
config: revert to C implementation of OpenSSL::Config
Revert OpenSSL::Config to using the OpenSSL API and remove our own parser implementation for the config file syntax. OpenSSL::Config now wraps a CONF object. Accessor methods deal with the object directly rather than Ruby-level internal state. This work is based on the old C code we used before 2010.
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_config.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb
index 01be2816..3af9923d 100644
--- a/test/openssl/test_config.rb
+++ b/test/openssl/test_config.rb
@@ -150,6 +150,10 @@ __EOC__
# Include a file by relative path
c1 = OpenSSL::Config.parse(include_file)
+ if c1["sec-main"][".include"]
+ # OpenSSL < 1.1.1 parses '.include =' as a normal assignment
+ pend ".include directive is not supported"
+ end
assert_equal(["default", "sec-a", "sec-b", "sec-main"], c1.sections.sort)
assert_equal(["file-a", "file-b", "file-main"], c1["default"].keys.sort)
assert_equal({"a" => "123"}, c1["sec-a"])
@@ -157,9 +161,9 @@ __EOC__
assert_equal({"main" => "123", "key_outside_section" => "value_a"}, c1["sec-main"])
# Relative paths are from the working directory
- assert_raise(OpenSSL::ConfigError) do
- Dir.chdir("child") { OpenSSL::Config.parse(include_file) }
- end
+ # Inclusion fails, but the error is ignored silently
+ c2 = Dir.chdir("child") { OpenSSL::Config.parse(include_file) }
+ assert_equal(["default", "sec-main"], c2.sections.sort)
end
end