Skip to content

Commit 480080b

Browse files
karesmatzbot
authored andcommitted
[ruby/stringio] fix: (jruby) failing to clean buffer's code-range
same bug as: jruby/jruby#9035 ruby/stringio@65b144b175
1 parent 36cd985 commit 480080b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/stringio/test_stringio.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,20 @@ def test_coderange_after_overwrite
10641064
assert_predicate(s.string, :ascii_only?)
10651065
end
10661066

1067+
def test_coderange_after_read_into_buffer
1068+
s = StringIO.new("01234567890".b)
1069+
1070+
buf = "¿Cómo estás? Ça va bien?"
1071+
assert_not_predicate(buf, :ascii_only?)
1072+
1073+
assert_predicate(s.string, :ascii_only?)
1074+
1075+
s.read(10, buf)
1076+
1077+
assert_predicate(buf, :ascii_only?)
1078+
assert_equal '0123456789', buf
1079+
end
1080+
10671081
require "objspace"
10681082
if ObjectSpace.respond_to?(:dump) && ObjectSpace.dump(eval(%{"test"})).include?('"chilled":true') # Ruby 3.4+ chilled strings
10691083
def test_chilled_string

0 commit comments

Comments
 (0)