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

ruby-changes:11903

From: nobu <ko1@a...>
Date: Mon, 25 May 2009 08:07:14 +0900 (JST)
Subject: [ruby-changes:11903] Ruby:r23564 (trunk): * string.c (rb_str_rpartition): ditto.

nobu	2009-05-25 08:06:57 +0900 (Mon, 25 May 2009)

  New Revision: 23564

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

  Log:
    * string.c (rb_str_rpartition): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
    trunk/test/ruby/test_string.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23563)
+++ ChangeLog	(revision 23564)
@@ -1,8 +1,10 @@
-Mon May 25 07:50:05 2009  Nobuyoshi Nakada  <nobu@r...>
+Mon May 25 08:06:52 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_partition): should use the converted result.  a
 	  patch from Marc-Andre Lafortune at [ruby-core:23540].
 
+	* string.c (rb_str_rpartition): ditto.
+
 Mon May 25 06:25:38 2009  Yukihiro Matsumoto  <matz@r...>
 
 	* test/ruby/test_hash.rb (TestHash::test_equal2): recursive hashes
Index: string.c
===================================================================
--- string.c	(revision 23563)
+++ string.c	(revision 23564)
@@ -6924,6 +6924,7 @@
 	    rb_raise(rb_eTypeError, "type mismatch: %s given",
 		     rb_obj_classname(sep));
 	}
+	sep = tmp;
 	pos = rb_str_sublen(str, pos);
 	pos = rb_str_rindex(str, sep, pos);
     }
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 23563)
+++ test/ruby/test_string.rb	(revision 23564)
@@ -1712,6 +1712,8 @@
     assert_equal(%w(hel l o), "hello".rpartition(/l/))
     assert_equal(%w(hel l o), "hello".rpartition("l"))
     assert_raise(TypeError) { "hello".rpartition(1) }
+    def (hyphen = Object.new).to_str; "-"; end
+    assert_equal(%w(foo - bar), "foo-bar".rpartition(hyphen), '[ruby-core:23540]')
   end
 
   def test_setter

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

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