From 6f1c08f7d8a43a5d220aca7a5c449a8d04d3017b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 14 Sep 2019 15:58:11 +0900 Subject: Replace `String#byteslice` by custom `IO._bufread`. `byteslice` creates 2 string objects. `_bufread` creates one, and modifies the original buffer string, that is more efficient. --- mrbgems/mruby-io/test/io.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mrbgems/mruby-io/test') diff --git a/mrbgems/mruby-io/test/io.rb b/mrbgems/mruby-io/test/io.rb index 3aaa109a8..e3024cf9a 100644 --- a/mrbgems/mruby-io/test/io.rb +++ b/mrbgems/mruby-io/test/io.rb @@ -129,10 +129,11 @@ end assert "IO#read(n) with n > IO::BUF_SIZE" do skip "pipe is not supported on this platform" if MRubyIOTestUtil.win? - r,w = IO.pipe - n = IO::BUF_SIZE+1 - w.write 'a'*n - assert_equal r.read(n), 'a'*n + IO.pipe do |r,w| + n = IO::BUF_SIZE+1 + w.write 'a'*n + assert_equal 'a'*n, r.read(n) + end end assert('IO#readchar', '15.2.20.5.15') do -- cgit v1.2.3