From 5190926e40febeeb3822b8bd7c031b06279dc3f1 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 15 Nov 2021 15:28:02 +1300 Subject: Validate string type when constructing IO::Buffer for string mapping. --- test/ruby/test_io_buffer.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') 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) -- cgit v1.2.3