diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-25 14:22:37 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-12-01 02:28:49 +0900 |
commit | d752cf7601adbe4bc2dc658effc2f61563a7dfb7 (patch) | |
tree | 7acc875d1933b330f96c7e3d7a31d61da5e77387 /tool/test | |
parent | a0b0365e905e1ac51998ace7e6fc723406a2f157 (diff) | |
download | ruby-d752cf7601adbe4bc2dc658effc2f61563a7dfb7.tar.gz |
Use class methods of `File` over `Kernel.open` and `IO.read`
Diffstat (limited to 'tool/test')
-rw-r--r-- | tool/test/webrick/test_filehandler.rb | 4 | ||||
-rw-r--r-- | tool/test/webrick/test_httprequest.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tool/test/webrick/test_filehandler.rb b/tool/test/webrick/test_filehandler.rb index 146d8ce792..9c5b83e300 100644 --- a/tool/test/webrick/test_filehandler.rb +++ b/tool/test/webrick/test_filehandler.rb @@ -85,12 +85,12 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase "Content-Type: text/plain\r\n" \ "Content-Range: bytes 0-0/#{filesize}\r\n" \ "\r\n" \ - "#{IO.read(__FILE__, 1)}\r\n" \ + "#{File.read(__FILE__, 1)}\r\n" \ "--#{boundary}\r\n" \ "Content-Type: text/plain\r\n" \ "Content-Range: bytes #{off}-#{last}/#{filesize}\r\n" \ "\r\n" \ - "#{IO.read(__FILE__, 2, off)}\r\n" \ + "#{File.read(__FILE__, 2, off)}\r\n" \ "--#{boundary}--\r\n" assert_equal exp, body end diff --git a/tool/test/webrick/test_httprequest.rb b/tool/test/webrick/test_httprequest.rb index 759ccbdada..3c0ea937d9 100644 --- a/tool/test/webrick/test_httprequest.rb +++ b/tool/test/webrick/test_httprequest.rb @@ -245,7 +245,7 @@ GET / _end_of_message_ msg.gsub!(/^ {6}/, "") - open(__FILE__){|io| + File.open(__FILE__){|io| while chunk = io.read(100) msg << chunk.size.to_s(16) << crlf msg << chunk << crlf |