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

ruby-changes:63074

From: Hiroshi <ko1@a...>
Date: Thu, 24 Sep 2020 21:42:29 +0900 (JST)
Subject: [ruby-changes:63074] 588ac990ff (master): [ruby/webrick] Manually pick commit from upstream repo

https://git.ruby-lang.org/ruby.git/commit/?id=588ac990ff

From 588ac990ff170e2fb62e7ba0ed52a8088189cdbd Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Thu, 24 Sep 2020 21:41:11 +0900
Subject: [ruby/webrick] Manually pick commit from upstream repo

  Fix test when run with US-ASCII encoding

  https://github.com/ruby/webrick/commit/f402aafb36bbd43be54621405da550643a1a1a4c

diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb
index 9674c17..998e03f 100644
--- a/test/webrick/test_filehandler.rb
+++ b/test/webrick/test_filehandler.rb
@@ -291,6 +291,13 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L291
   end
 
   def test_multibyte_char_in_path
+    if Encoding.default_external == Encoding.find('US-ASCII')
+      reset_encoding = true
+      verb = $VERBOSE
+      $VERBOSE = false
+      Encoding.default_external = Encoding.find('UTF-8')
+    end
+
     c = "\u00a7"
     begin
       c = c.encode('filesystem')
@@ -320,6 +327,11 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L327
         }
       end
     end
+  ensure
+    if reset_encoding
+      Encoding.default_external = Encoding.find('US-ASCII')
+      $VERBOSE = verb
+    end
   end
 
   def test_script_disclosure
-- 
cgit v0.10.2


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

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