diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-11-15 15:28:02 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-11-17 10:39:54 +1300 |
commit | 5190926e40febeeb3822b8bd7c031b06279dc3f1 (patch) | |
tree | 039bbc39ede56a6b3e0f2f707d22753ed0d4e474 /test | |
parent | a19a657514a384a6c36cb62a2b4eb5352fb3074e (diff) |
Validate string type when constructing IO::Buffer for string mapping.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5115
Diffstat (limited to 'test')
-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 12937729f4..57d1867b25 100644 --- a/test/ruby/test_io_buffer.rb +++ b/test/ruby/test_io_buffer.rb @@ -81,6 +81,14 @@ class TestIOBuffer < Test::Unit::TestCase assert_equal "Hello World", string end + def test_non_string + not_string = Object.new + + assert_raise TypeError do + IO::Buffer.for(not_string) + end + end + def test_resize buffer = IO::Buffer.new(1024, IO::Buffer::MAPPED) buffer.resize(2048, 0) |