diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-08 14:16:07 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-08 14:16:07 +0000 |
commit | 5c68afdaab830260f19e98ed9aa6ec866cac1ad0 (patch) | |
tree | 6e49b55990f9e9ed561273126bb31d7993a0c5eb | |
parent | c345797525cca36ec6f6f04a54a1f59f3c37a207 (diff) |
* 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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/openssl/test_config.rb | 32 |
2 files changed, 28 insertions, 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, diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb index bde2c68552..fa4dbc467f 100644 --- a/test/openssl/test_config.rb +++ b/test/openssl/test_config.rb @@ -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 |