ruby-changes:40012
From: shugo <ko1@a...>
Date: Fri, 9 Oct 2015 16:42:45 +0900 (JST)
Subject: [ruby-changes:40012] shugo:r52093 (trunk): * lib/net/imap.rb: use frozen_string_literal: true.
shugo 2015-10-09 16:42:34 +0900 (Fri, 09 Oct 2015) New Revision: 52093 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52093 Log: * lib/net/imap.rb: use frozen_string_literal: true. * test/net/imap/test_imap.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. Modified files: trunk/ChangeLog trunk/lib/net/imap.rb trunk/test/net/imap/test_imap.rb trunk/test/net/imap/test_imap_response_parser.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 52092) +++ ChangeLog (revision 52093) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Oct 9 16:42:26 2015 Shugo Maeda <shugo@r...> + + * lib/net/imap.rb: use frozen_string_literal: true. + + * test/net/imap/test_imap.rb: ditto. + + * test/net/imap/test_imap_response_parser.rb: ditto. + Fri Oct 9 15:52:28 2015 Shugo Maeda <shugo@r...> * lib/net/ftp.rb: use frozen_string_literal: true. Index: lib/net/imap.rb =================================================================== --- lib/net/imap.rb (revision 52092) +++ lib/net/imap.rb (revision 52093) @@ -1,4 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L1 # +# -*- frozen_string_literal: true -*- +# # = net/imap.rb # # Copyright (C) 2000 Shugo Maeda <shugo@r...> @@ -1191,7 +1193,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L1193 end def get_response - buff = "" + buff = String.new while true s = @sock.gets(CRLF) break unless s @@ -2729,7 +2731,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L2731 end def section - str = "" + str = String.new token = match(T_LBRA) str.concat(token.value) token = match(T_ATOM, T_NUMBER, T_RBRA) @@ -3210,7 +3212,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L3212 end def atom - result = "" + result = String.new while true token = lookahead if atom_token?(token) Index: test/net/imap/test_imap_response_parser.rb =================================================================== --- test/net/imap/test_imap_response_parser.rb (revision 52092) +++ test/net/imap/test_imap_response_parser.rb (revision 52093) @@ -1,3 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap_response_parser.rb#L1 +# +# -*- frozen_string_literal: true -*- + require "net/imap" require "test/unit" Index: test/net/imap/test_imap.rb =================================================================== --- test/net/imap/test_imap.rb (revision 52092) +++ test/net/imap/test_imap.rb (revision 52093) @@ -1,3 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap.rb#L1 +# +# -*- frozen_string_literal: true -*- + require "net/imap" require "test/unit" @@ -26,13 +29,13 @@ class IMAPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap.rb#L29 assert_equal("foo", Net::IMAP.encode_utf7("foo")) assert_equal("&-", Net::IMAP.encode_utf7("&")) - utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8") + utf8 = "\357\274\241\357\274\242\357\274\243".dup.force_encoding("UTF-8") s = Net::IMAP.encode_utf7(utf8) assert_equal("&,yH,Iv8j-", s) s = Net::IMAP.encode_utf7("foo&#{utf8}-bar".encode("EUC-JP")) assert_equal("foo&-&,yH,Iv8j--bar", s) - utf8 = "\343\201\202&".force_encoding("UTF-8") + utf8 = "\343\201\202&".dup.force_encoding("UTF-8") s = Net::IMAP.encode_utf7(utf8) assert_equal("&MEI-&-", s) s = Net::IMAP.encode_utf7(utf8.encode("EUC-JP")) @@ -44,7 +47,7 @@ class IMAPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/imap/test_imap.rb#L47 assert_equal("&-", Net::IMAP.decode_utf7("&--")) s = Net::IMAP.decode_utf7("&,yH,Iv8j-") - utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8") + utf8 = "\357\274\241\357\274\242\357\274\243".dup.force_encoding("UTF-8") assert_equal(utf8, s) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/