* 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:
nahi 2010-07-08 14:16:07 +00:00
parent c345797525
commit 5c68afdaab
2 changed files with 28 additions and 10 deletions

View file

@ -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> Thu Jul 8 21:10:36 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/openssl/test_config.rb: added tests for class methods, * test/openssl/test_config.rb: added tests for class methods,

View file

@ -30,9 +30,16 @@ __EOD__
end end
def test_s_parse_format 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 [default]\t\t # trailing chars are ignored
f o =b ar # it's "o = b" 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 # comment 1 # all comments (non foo=bar line) are ignored
# #
@ -40,17 +47,24 @@ __EOD__
\t#comment 3 \t#comment 3
[second ]\t # section line must start with [. ignored [second ]\t # section line must start with [. ignored
[third # ignored (section not terminated) [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" baz =qx\t # "baz = qx"
a=\t \t a=\t \t # "a = ": trailing spaces are ignored
=b =b # " = b": empty key
c= # must have key and value. and this line is "c = #" =c # " = c": empty key (override the above line)
d= # "c = ": trailing comment is ignored
__EOC__ __EOC__
assert_equal(['default'], c.sections) 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('qx', c['default']['baz'])
assert_equal('#', c['default']['c']) assert_equal('', c['default']['d'])
assert_equal(['baz', 'c', 'o'], c['default'].keys.sort)
end end
def test_s_load def test_s_load
@ -176,9 +190,7 @@ __EOC__
end end
def test_inspect def test_inspect
assert_nothing_raised do assert_equal('#<OpenSSL::Config sections=["CA_default", "default", "ca"]>', @it.inspect)
@it.inspect
end
end end
def test_freeze def test_freeze