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

ruby-changes:7414

From: naruse <ko1@a...>
Date: Sat, 30 Aug 2008 07:50:35 +0900 (JST)
Subject: [ruby-changes:7414] Ruby:r18933 (trunk): * encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.

naruse	2008-08-30 07:50:16 +0900 (Sat, 30 Aug 2008)

  New Revision: 18933

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

  Log:
    * encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.
    
    * test/ruby/test_m17n.rb (test_compatible): fix test.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
    trunk/test/ruby/test_m17n.rb

Index: encoding.c
===================================================================
--- encoding.c	(revision 18932)
+++ encoding.c	(revision 18933)
@@ -880,13 +880,15 @@
 {
     rb_encoding *enc;
 
-    if (BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
-       rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
-		 rb_obj_classname(str1));
+    if (SPECIAL_CONST_P(str1) || 
+	    BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
+	rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
+		rb_obj_classname(str1));
     }
-    if (BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
-       rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
-		 rb_obj_classname(str2));
+    if (SPECIAL_CONST_P(str2) || 
+	    BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
+	rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
+		rb_obj_classname(str2));
     }
     if (!enc_capable(str1)) return Qnil;
     if (!enc_capable(str2)) return Qnil;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18932)
+++ ChangeLog	(revision 18933)
@@ -1,3 +1,9 @@
+Sat Aug 30 07:48:48 2008  NARUSE, Yui  <naruse@r...>
+
+	* encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.
+
+	* test/ruby/test_m17n.rb (test_compatible): fix test.
+
 Sat Aug 30 02:48:11 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* object.c (rb_obj_freeze): update rdoc to mention RuntimeError
Index: test/ruby/test_m17n.rb
===================================================================
--- test/ruby/test_m17n.rb	(revision 18932)
+++ test/ruby/test_m17n.rb	(revision 18933)
@@ -1280,7 +1280,7 @@
   end
 
   def test_compatible
-    assert_equal(nil, Encoding.compatible?("",0), "moved from btest/knownbug")
+    assert_raise(TypeError) {Encoding.compatible?("",0)}
   end
 
   def test_force_encoding

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

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