From 71bf5cef75b9d244a06261c9fc0b84fbe5a1592f Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 20 Dec 2021 09:43:22 +1300 Subject: Fix handling of frozens strings. --- test/ruby/test_io_buffer.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby/test_io_buffer.rb') diff --git a/test/ruby/test_io_buffer.rb b/test/ruby/test_io_buffer.rb index 385a133421..76fa1bd774 100644 --- a/test/ruby/test_io_buffer.rb +++ b/test/ruby/test_io_buffer.rb @@ -83,6 +83,7 @@ class TestIOBuffer < Test::Unit::TestCase def test_string_mapped string = "Hello World" buffer = IO::Buffer.for(string) + refute buffer.immutable? # Cannot modify string as it's locked by the buffer: assert_raise RuntimeError do @@ -99,6 +100,13 @@ class TestIOBuffer < Test::Unit::TestCase assert_equal "Hello World", string end + def test_string_mapped_frozen + string = "Hello World".freeze + buffer = IO::Buffer.for(string) + + assert buffer.immutable? + end + def test_non_string not_string = Object.new -- cgit v1.2.3