diff options
-rw-r--r-- | string.c | 1 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 2 |
2 files changed, 2 insertions, 1 deletions
@@ -9795,7 +9795,6 @@ rb_str_partition(VALUE str, VALUE sep) return rb_ary_new3(3, rb_str_dup(str), str_new_empty(str), str_new_empty(str)); } sep = rb_str_subpat(str, sep, INT2FIX(0)); - if (pos == 0 && RSTRING_LEN(sep) == 0) goto failed; } else { pos = rb_str_index(str, sep, 0); diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 09d099bb4a..f0b765314c 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2567,6 +2567,8 @@ CODE hello = "hello" hello.partition("hi").map(&:upcase!) assert_equal("hello", hello, bug) + + assert_equal(["", "", "foo"], "foo".partition(/^=*/)) end def test_rpartition |