ruby-changes:11901
From: nobu <ko1@a...>
Date: Mon, 25 May 2009 07:50:32 +0900 (JST)
Subject: [ruby-changes:11901] Ruby:r23562 (trunk): * string.c (rb_str_partition): should use the converted result. a
nobu 2009-05-25 07:50:11 +0900 (Mon, 25 May 2009) New Revision: 23562 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23562 Log: * string.c (rb_str_partition): should use the converted result. a patch from Marc-Andre Lafortune at [ruby-core:23540]. Modified files: trunk/ChangeLog trunk/string.c trunk/test/ruby/test_string.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 23561) +++ ChangeLog (revision 23562) @@ -1,3 +1,8 @@ +Mon May 25 07:50:05 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]. + Mon May 25 05:32:19 2009 Yukihiro Matsumoto <matz@r...> * lib/cgi/core.rb (CGI::HTTP_STATUS): typo fixed. a patch from Index: string.c =================================================================== --- string.c (revision 23561) +++ string.c (revision 23562) @@ -6876,6 +6876,7 @@ rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sep)); } + sep = tmp; pos = rb_str_index(str, sep, 0); } if (pos < 0) { Index: test/ruby/test_string.rb =================================================================== --- test/ruby/test_string.rb (revision 23561) +++ test/ruby/test_string.rb (revision 23562) @@ -1704,6 +1704,8 @@ assert_equal(%w(he l lo), "hello".partition(/l/)) assert_equal(%w(he l lo), "hello".partition("l")) assert_raise(TypeError) { "hello".partition(1) } + def (hyphen = Object.new).to_str; "-"; end + assert_equal(%w(foo - bar), "foo-bar".partition(hyphen), '[ruby-core:23540]') end def test_rpartition -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/