Skip to content

Commit

Permalink
test/webrick/test_filehandler.rb: no .encode("filesystem") if US-ASCII
Browse files Browse the repository at this point in the history
http://ci.rvm.jp/logfiles/brlog.trunk-theap-asserts.20200618-002305
```
I, [2020-06-18T00:28:11.661066 #31625]  INFO -- :   1) Failure:
I, [2020-06-18T00:28:11.661157 #31625]  INFO -- : WEBrick::TestFileHandler#test_cjk_in_path [/tmp/ruby/v3/src/trunk-theap-asserts/test/webrick/utils.rb:72]:
I, [2020-06-18T00:28:11.661216 #31625]  INFO -- : exceptions on 1 threads:
I, [2020-06-18T00:28:11.661269 #31625]  INFO -- : U+3042 from UTF-8 to US-ASCII
```
  • Loading branch information
mame committed Jun 18, 2020
1 parent 35a6741 commit bed1797
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/webrick/test_filehandler.rb
Expand Up @@ -294,8 +294,13 @@ def test_cjk_in_path
config = { :DocumentRoot => dir }
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
http = Net::HTTP.new(addr, port)
filesystem_path = "\u3042".encode("filesystem").bytes.map {|b| "%%%X" % b }.join
req = Net::HTTP::Get.new("/#{ filesystem_path }.txt")
case enc = Encoding.find('filesystem')
when Encoding::US_ASCII, Encoding::ASCII_8BIT
filesystem_path = "\u3042"
else
filesystem_path = "\u3042".encode("filesystem")
end
req = Net::HTTP::Get.new("/#{ filesystem_path.bytes.map {|b| "%%%X" % b }.join }.txt")
http.request(req){|res| assert_equal("200", res.code, log.call + "\nFilesystem encoding is #{Encoding.find('filesystem')}") }
end
end
Expand Down

0 comments on commit bed1797

Please sign in to comment.