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

ruby-changes:14245

From: naruse <ko1@a...>
Date: Sun, 13 Dec 2009 01:39:34 +0900 (JST)
Subject: [ruby-changes:14245] Ruby:r26068 (trunk): Add rdoc and test of Encoding#replicate.

naruse	2009-12-13 01:35:10 +0900 (Sun, 13 Dec 2009)

  New Revision: 26068

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

  Log:
    Add rdoc and test of Encoding#replicate.

  Modified files:
    trunk/encoding.c
    trunk/test/ruby/test_encoding.rb

Index: encoding.c
===================================================================
--- encoding.c	(revision 26067)
+++ encoding.c	(revision 26068)
@@ -313,6 +313,15 @@
     return idx;
 }
 
+/*
+ * call-seq:
+ *   enc.replicate(name) => encoding
+ *
+ * Returns a replicated encoding of _enc whose name is _name_.
+ * The new encoding should have the same byte structure of _enc_.
+ * If _name_ is used by another encoding, raise ArgumentError.
+ *
+ */
 static VALUE
 enc_replicate(VALUE encoding, VALUE name)
 {
Index: test/ruby/test_encoding.rb
===================================================================
--- test/ruby/test_encoding.rb	(revision 26067)
+++ test/ruby/test_encoding.rb	(revision 26068)
@@ -51,6 +51,11 @@
     end
   end
 
+  def test_replicate
+    assert(Encoding::UTF_8.replicate('UTF-8-ANOTHER'))
+    assert(Encoding::ISO_2022_JP.replicate('ISO-2022-JP-ANOTHER'))
+  end
+
   def test_dummy_p
     assert_equal(true, Encoding::ISO_2022_JP.dummy?)
     assert_equal(false, Encoding::UTF_8.dummy?)

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

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