From 7d7984642ce11c48c5f0bc1627f50ff097b9e7f5 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Thu, 20 Feb 2025 18:37:35 -0600 Subject: [PATCH] [ruby/stringio] Allow seek when underlying string is frozen (https://github.com/ruby/stringio/pull/121) Fixes https://github.com/ruby/stringio/pull/119. Adds a test for this expectation. https://github.com/ruby/stringio/commit/3f90fe44c6 --- test/stringio/test_stringio.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 8d236e5bba..a00e7b8500 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -483,6 +483,11 @@ class TestStringIO < Test::Unit::TestCase f.close unless f.closed? end + def test_seek_frozen_string + f = StringIO.new(-"1234") + assert_equal(0, f.seek(1)) + end + def test_each_byte f = StringIO.new("1234") a = []