[前][次][番号順一覧][スレッド一覧]

ruby-changes:16590

From: nahi <ko1@a...>
Date: Thu, 8 Jul 2010 23:18:34 +0900 (JST)
Subject: [ruby-changes:16590] Ruby:r28582 (ruby_1_8): * test/openssl/test_config.rb: test_s_parse_format added in the

nahi	2010-07-08 23:16:07 +0900 (Thu, 08 Jul 2010)

  New Revision: 28582

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28582

  Log:
    * 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.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/test/openssl/test_config.rb

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 28581)
+++ ruby_1_8/ChangeLog	(revision 28582)
@@ -1,3 +1,9 @@
+Thu Jul  8 23:12:30 2010  NAKAMURA, Hiroshi  <nahi@r...>
+
+	* 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@r...>
 
 	* test/openssl/test_config.rb: added tests for class methods, 
Index: ruby_1_8/test/openssl/test_config.rb
===================================================================
--- ruby_1_8/test/openssl/test_config.rb	(revision 28581)
+++ ruby_1_8/test/openssl/test_config.rb	(revision 28582)
@@ -30,9 +30,16 @@
   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 @@
 \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 @@
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]