aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--string.c1
-rw-r--r--test/ruby/test_string.rb2
3 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e4856928f..9709a3b984 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon May 25 07:50:05 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].
+
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
diff --git a/string.c b/string.c
index 3d864e54b5..246599d050 100644
--- a/string.c
+++ b/string.c
@@ -6876,6 +6876,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) {
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index e87b6d3c8f..4a784b18f1 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1704,6 +1704,8 @@ 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