diff options
author | Samuel Williams <[email protected]> | 2021-12-20 09:43:22 +1300 |
---|---|---|
committer | Samuel Williams <[email protected]> | 2021-12-21 12:25:42 +1300 |
commit | 71bf5cef75b9d244a06261c9fc0b84fbe5a1592f (patch) | |
tree | 9ecde04f340d154b4860d8004b5e9bf345bf8afb /test/ruby/test_io_buffer.rb | |
parent | 9de5c4ec761aad3edc50b38d9824b40665d18911 (diff) |
Fix handling of frozens strings.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5303
Diffstat (limited to 'test/ruby/test_io_buffer.rb')
-rw-r--r-- | test/ruby/test_io_buffer.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |