[前][次][番号順一覧][スレッド一覧]

ruby-changes:52712

From: naruse <ko1@a...>
Date: Fri, 5 Oct 2018 19:36:28 +0900 (JST)
Subject: [ruby-changes:52712] naruse:r64924 (trunk): Use binread because webrick also uses binread

naruse	2018-10-05 19:36:24 +0900 (Fri, 05 Oct 2018)

  New Revision: 64924

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64924

  Log:
    Use binread because webrick also uses binread
    
    Reported-by: MSP-Greg [Bug #15203]

  Modified files:
    trunk/test/webrick/test_filehandler.rb
    trunk/test/webrick/test_httprequest.rb
Index: test/webrick/test_filehandler.rb
===================================================================
--- test/webrick/test_filehandler.rb	(revision 64923)
+++ test/webrick/test_filehandler.rb	(revision 64924)
@@ -98,7 +98,7 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L98
     config = { :DocumentRoot => File.dirname(__FILE__), }
     this_file = File.basename(__FILE__)
     filesize = File.size(__FILE__)
-    this_data = File.open(__FILE__, "rb") {|f| f.read}
+    this_data = File.binread(__FILE__)
     range = nil
     bug2593 = '[ruby-dev:40030]'
 
@@ -114,7 +114,7 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L114
       http.request(req){|res|
         assert_equal("200", res.code, log.call)
         assert_equal("text/plain", res.content_type, log.call)
-        assert_equal(File.read(__FILE__), res.body, log.call)
+        assert_equal(this_data, res.body, log.call)
       }
 
       req = Net::HTTP::Get.new("/#{this_file}", "range"=>"bytes=#{filesize-100}-")
Index: test/webrick/test_httprequest.rb
===================================================================
--- test/webrick/test_httprequest.rb	(revision 64923)
+++ test/webrick/test_httprequest.rb	(revision 64924)
@@ -237,7 +237,7 @@ GET / https://github.com/ruby/ruby/blob/trunk/test/webrick/test_httprequest.rb#L237
 
   def test_chunked
     crlf = "\x0d\x0a"
-    expect = File.read(__FILE__).freeze
+    expect = File.binread(__FILE__).freeze
     msg = <<-_end_of_message_
       POST /path HTTP/1.1
       Host: test.ruby-lang.org:8080

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]