diff options
-rw-r--r-- | string.c | 4 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -6268,7 +6268,7 @@ rb_str_byteslice(int argc, VALUE *argv, VALUE str) * bytesplice(index, length, str) -> string * bytesplice(range, str) -> string * - * Replaces some or all of the content of +self+ with +str+, and returns +str+. + * Replaces some or all of the content of +self+ with +str+, and returns +self+. * The portion of the string affected is determined using * the same criteria as String#byteslice, except that +length+ cannot be omitted. * If the replacement string is not the same length as the text it is replacing, @@ -6330,7 +6330,7 @@ rb_str_bytesplice(int argc, VALUE *argv, VALUE str) cr = ENC_CODERANGE_AND(ENC_CODERANGE(str), ENC_CODERANGE(val)); if (cr != ENC_CODERANGE_BROKEN) ENC_CODERANGE_SET(str, cr); - return val; + return str; } /* diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index e34fd116c9..2e66521df7 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -3489,7 +3489,7 @@ CODE private def assert_bytesplice_result(expected, s, *args) - assert_equal(args.last, s.send(:bytesplice, *args)) + assert_equal(expected, s.send(:bytesplice, *args)) assert_equal(expected, s) end |