mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
* test/openssl/test_config.rb: test_s_parse_format added in the
prvious commit fails for all OpenSSL implementations. fixed the test. tested against OpenSSL 1.0.0a and OpenSSL 0.9.8o. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@28582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c345797525
commit
5c68afdaab
2 changed files with 28 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
|||
Thu Jul 8 23:12:30 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* test/openssl/test_config.rb: test_s_parse_format added in the
|
||||
prvious commit fails for all OpenSSL implementations. fixed the
|
||||
test. tested against OpenSSL 1.0.0a and OpenSSL 0.9.8o.
|
||||
|
||||
Thu Jul 8 21:10:36 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* test/openssl/test_config.rb: added tests for class methods,
|
||||
|
|
|
@ -30,9 +30,16 @@ __EOD__
|
|||
end
|
||||
|
||||
def test_s_parse_format
|
||||
c = OpenSSL::Config.parse(<<__EOC__)
|
||||
excn = assert_raise(OpenSSL::ConfigError) do
|
||||
OpenSSL::Config.parse(<<__EOC__)
|
||||
[default]\t\t # trailing chars are ignored
|
||||
f o =b ar # it's "o = b"
|
||||
__EOC__
|
||||
end
|
||||
assert_equal("error in line 2: missing equal sign", excn.message)
|
||||
|
||||
excn = assert_raise(OpenSSL::ConfigError) do
|
||||
OpenSSL::Config.parse(<<__EOC__)
|
||||
# comment 1 # all comments (non foo=bar line) are ignored
|
||||
|
||||
#
|
||||
|
@ -40,17 +47,24 @@ __EOD__
|
|||
\t#comment 3
|
||||
[second ]\t # section line must start with [. ignored
|
||||
[third # ignored (section not terminated)
|
||||
__EOC__
|
||||
end
|
||||
assert_equal("error in line 7: missing close square bracket", excn.message)
|
||||
|
||||
c = OpenSSL::Config.parse(<<__EOC__)
|
||||
baz =qx\t # "baz = qx"
|
||||
|
||||
a=\t \t
|
||||
=b
|
||||
c= # must have key and value. and this line is "c = #"
|
||||
a=\t \t # "a = ": trailing spaces are ignored
|
||||
=b # " = b": empty key
|
||||
=c # " = c": empty key (override the above line)
|
||||
d= # "c = ": trailing comment is ignored
|
||||
__EOC__
|
||||
assert_equal(['default'], c.sections)
|
||||
assert_equal('b', c['default']['o'])
|
||||
assert_equal(['', 'a', 'baz', 'd'], c['default'].keys.sort)
|
||||
assert_equal('c', c['default'][''])
|
||||
assert_equal('', c['default']['a'])
|
||||
assert_equal('qx', c['default']['baz'])
|
||||
assert_equal('#', c['default']['c'])
|
||||
assert_equal(['baz', 'c', 'o'], c['default'].keys.sort)
|
||||
assert_equal('', c['default']['d'])
|
||||
end
|
||||
|
||||
def test_s_load
|
||||
|
@ -176,9 +190,7 @@ __EOC__
|
|||
end
|
||||
|
||||
def test_inspect
|
||||
assert_nothing_raised do
|
||||
@it.inspect
|
||||
end
|
||||
assert_equal('#<OpenSSL::Config sections=["CA_default", "default", "ca"]>', @it.inspect)
|
||||
end
|
||||
|
||||
def test_freeze
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue