aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 7dd76f76f7..c53668ea61 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -2859,6 +2859,17 @@ CODE
assert_equal(Encoding::UTF_8, k.encoding, '[ruby-dev:39068]')
end
+ def test_force_encoding_changing_terminator_length
+ assert_no_memory_leak([], 's0 = "x" * 65535', <<~'end;')
+ 1_000.times {
+ # Allocate its own buffer of (65535+1) bytes
+ s = s0.b; s.setbyte(0, 0)
+ # Expand it to (65535+4) bytes
+ s.force_encoding("UTF-32LE")
+ }
+ end;
+ end
+
def test_ascii_incomat_inspect
bug4081 = '[ruby-core:33283]'
[Encoding::UTF_16LE, Encoding::UTF_16BE,