aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--lib/net/imap.rb8
-rw-r--r--test/net/imap/test_imap.rb9
-rw-r--r--test/net/imap/test_imap_response_parser.rb3
4 files changed, 22 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a873d1195..bebd009a9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Oct 9 16:42:26 2015 Shugo Maeda <shugo@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* lib/net/ftp.rb: use frozen_string_literal: true.
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 1cf7aa4ee2..cc7935ec43 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -1,4 +1,6 @@
#
+# -*- frozen_string_literal: true -*-
+#
# = net/imap.rb
#
# Copyright (C) 2000 Shugo Maeda <shugo@ruby-lang.org>
@@ -1191,7 +1193,7 @@ module Net
end
def get_response
- buff = ""
+ buff = String.new
while true
s = @sock.gets(CRLF)
break unless s
@@ -2729,7 +2731,7 @@ module Net
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
end
def atom
- result = ""
+ result = String.new
while true
token = lookahead
if atom_token?(token)
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index da3353393c..bf57aa5cc4 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -1,3 +1,6 @@
+#
+# -*- frozen_string_literal: true -*-
+
require "net/imap"
require "test/unit"
@@ -26,13 +29,13 @@ class IMAPTest < Test::Unit::TestCase
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
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
diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb
index 1612d78e87..1104a490fa 100644
--- a/test/net/imap/test_imap_response_parser.rb
+++ b/test/net/imap/test_imap_response_parser.rb
@@ -1,3 +1,6 @@
+#
+# -*- frozen_string_literal: true -*-
+
require "net/imap"
require "test/unit"