diff --git a/ChangeLog b/ChangeLog index f0d6c1c41f..09dea7f57f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jul 8 23:12:30 2010 NAKAMURA, Hiroshi + + * 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 * 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('#', @it.inspect) end def test_freeze