diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 4 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 14 insertions, 1 deletions
@@ -1,3 +1,10 @@ +Mon May 25 08:06:52 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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 05:32:19 2009 Yukihiro Matsumoto <matz@ruby-lang.org> * lib/cgi/core.rb (CGI::HTTP_STATUS): typo fixed. a patch from @@ -6645,6 +6645,7 @@ rb_str_partition(VALUE str, VALUE sep) rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sep)); } + sep = tmp; pos = rb_str_index(str, sep, 0); } if (pos < 0) { @@ -6692,6 +6693,7 @@ rb_str_rpartition(VALUE str, VALUE sep) 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); } diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index f6f3dd76b2..bf0ed6a830 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1699,12 +1699,16 @@ class TestString < Test::Unit::TestCase 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 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 @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-05-22" -#define RUBY_PATCHLEVEL 159 +#define RUBY_PATCHLEVEL 160 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |