1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_partition): should use the converted result. a

patch from Marc-Andre Lafortune at [ruby-core:23540].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-05-24 22:50:11 +00:00
parent 74c7141705
commit 7a938f98f9
3 changed files with 8 additions and 0 deletions

View file

@ -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> 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 * lib/cgi/core.rb (CGI::HTTP_STATUS): typo fixed. a patch from

View file

@ -6876,6 +6876,7 @@ rb_str_partition(VALUE str, VALUE sep)
rb_raise(rb_eTypeError, "type mismatch: %s given", rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_obj_classname(sep)); rb_obj_classname(sep));
} }
sep = tmp;
pos = rb_str_index(str, sep, 0); pos = rb_str_index(str, sep, 0);
} }
if (pos < 0) { if (pos < 0) {

View file

@ -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_equal(%w(he l lo), "hello".partition("l")) assert_equal(%w(he l lo), "hello".partition("l"))
assert_raise(TypeError) { "hello".partition(1) } 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 end
def test_rpartition def test_rpartition