ruby-changes:40105
From: akr <ko1@a...>
Date: Sun, 18 Oct 2015 21:18:05 +0900 (JST)
Subject: [ruby-changes:40105] akr:r52186 (trunk): * lib/open-uri.rb: Specify frozen_string_literal: true.
akr 2015-10-18 21:17:52 +0900 (Sun, 18 Oct 2015) New Revision: 52186 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52186 Log: * lib/open-uri.rb: Specify frozen_string_literal: true. Modified files: trunk/ChangeLog trunk/lib/open-uri.rb trunk/test/open-uri/test_open-uri.rb trunk/test/open-uri/test_ssl.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 52185) +++ ChangeLog (revision 52186) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Oct 18 21:17:27 2015 Tanaka Akira <akr@f...> + + * lib/open-uri.rb: Specify frozen_string_literal: true. + Sun Oct 18 14:37:56 2015 KOSAKI Motohiro <kosaki.motohiro@g...> * random.c (fill_random_bytes_urandom): add a comment why using Index: lib/open-uri.rb =================================================================== --- lib/open-uri.rb (revision 52185) +++ lib/open-uri.rb (revision 52186) @@ -1,3 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb#L1 +# +# -*- frozen_string_literal: true -*- require 'uri' require 'stringio' require 'time' Index: test/open-uri/test_open-uri.rb =================================================================== --- test/open-uri/test_open-uri.rb (revision 52185) +++ test/open-uri/test_open-uri.rb (revision 52186) @@ -1,3 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L1 +# +# -*- frozen_string_literal: true -*- require 'test/unit' require 'open-uri' require 'webrick' @@ -11,6 +13,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L13 NullLog = Object.new def NullLog.<<(arg) + #puts arg if / INFO / !~ arg end def with_http(log_tester=lambda {|log| assert_equal([], log) }) @@ -242,9 +245,9 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L245 def test_proxy with_http {|srv, dr, url| - proxy_log = StringIO.new('') + proxy_log = StringIO.new(''.dup) proxy_logger = WEBrick::Log.new(proxy_log, WEBrick::BasicLog::WARN) - proxy_auth_log = '' + proxy_auth_log = ''.dup proxy = WEBrick::HTTPProxyServer.new({ :ServerType => Thread, :Logger => proxy_logger, @@ -296,9 +299,9 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L299 def test_proxy_http_basic_authentication_failure with_http {|srv, dr, url| - proxy_log = StringIO.new('') + proxy_log = StringIO.new(''.dup) proxy_logger = WEBrick::Log.new(proxy_log, WEBrick::BasicLog::WARN) - proxy_auth_log = '' + proxy_auth_log = ''.dup proxy = WEBrick::HTTPProxyServer.new({ :ServerType => Thread, :Logger => proxy_logger, @@ -329,9 +332,9 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L332 def test_proxy_http_basic_authentication_success with_http {|srv, dr, url| - proxy_log = StringIO.new('') + proxy_log = StringIO.new(''.dup) proxy_logger = WEBrick::Log.new(proxy_log, WEBrick::BasicLog::WARN) - proxy_auth_log = '' + proxy_auth_log = ''.dup proxy = WEBrick::HTTPProxyServer.new({ :ServerType => Thread, :Logger => proxy_logger, @@ -551,7 +554,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L554 def test_encoding with_http {|srv, dr, url| content_u8 = "\u3042" - content_ej = "\xa2\xa4".force_encoding("euc-jp") + content_ej = "\xa2\xa4".dup.force_encoding("euc-jp") srv.mount_proc("/u8/") {|req, res| res.body = content_u8; res['content-type'] = 'text/plain; charset=utf-8' } srv.mount_proc("/ej/") {|req, res| res.body = content_ej; res['content-type'] = 'TEXT/PLAIN; charset=EUC-JP' } srv.mount_proc("/nc/") {|req, res| res.body = "aa"; res['content-type'] = 'Text/Plain' } @@ -599,7 +602,7 @@ class TestOpenURI < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_open-uri.rb#L602 def test_content_encoding with_http {|srv, dr, url| content = "abc" * 10000 - Zlib::GzipWriter.wrap(StringIO.new(content_gz="".force_encoding("ascii-8bit"))) {|z| z.write content } + Zlib::GzipWriter.wrap(StringIO.new(content_gz="".dup.force_encoding("ascii-8bit"))) {|z| z.write content } srv.mount_proc("/data/") {|req, res| res.body = content_gz; res['content-encoding'] = 'gzip' } srv.mount_proc("/data2/") {|req, res| res.body = content_gz; res['content-encoding'] = 'gzip'; res.chunked = true } srv.mount_proc("/noce/") {|req, res| res.body = content_gz } Index: test/open-uri/test_ssl.rb =================================================================== --- test/open-uri/test_ssl.rb (revision 52185) +++ test/open-uri/test_ssl.rb (revision 52186) @@ -1,3 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/open-uri/test_ssl.rb#L1 +# +# -*- frozen_string_literal: true -*- require 'test/unit' require 'open-uri' require 'stringio' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/