summaryrefslogtreecommitdiff
path: root/test/stringio/test_stringio.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2024-01-16 23:59:55 +0900
committergit <svn-admin@ruby-lang.org>2024-01-16 15:06:22 +0000
commit6283ae8d369bd2f8a022bb69bc5b742c58529dec (patch)
treef2ffec9c57672d3a678598fbd0f672ba72bf0bc5 /test/stringio/test_stringio.rb
parentfef8ccff11a5f48eef9f11f61ff0baa165acfaff (diff)
[ruby/stringio] Update the coderange after overwrite
Fix https://bugs.ruby-lang.org/issues/20185 https://github.com/ruby/stringio/commit/8230552a46
Diffstat (limited to 'test/stringio/test_stringio.rb')
-rw-r--r--test/stringio/test_stringio.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 216b06d3ad..15fcc21146 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -953,6 +953,16 @@ class TestStringIO < Test::Unit::TestCase
$VERBOSE = verbose
end
+ def test_coderange_after_overwrite
+ s = StringIO.new("".b)
+
+ s.write("a=b&c=d")
+ s.rewind
+ assert_predicate(s.string, :ascii_only?)
+ s.write "\u{431 43e 433 443 441}"
+ assert_not_predicate(s.string, :ascii_only?)
+ end
+
def assert_string(content, encoding, str, mesg = nil)
assert_equal([content, encoding], [str, str.encoding], mesg)
end