summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-15 07:23:48 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-15 07:23:48 +0000
commitc35e7519b948e765d0f64f014775ce955a5c17de (patch)
tree42a5f45f72a296170dbacd491a50530b474dfc8a /test
parent73eb0eafef3de25d637a7ac77b28049203dbb338 (diff)
merge revision(s) 37487,37563: [Backport #7278]
* lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line): don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278] * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line): treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/net/protocol/test_protocol.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/net/protocol/test_protocol.rb b/test/net/protocol/test_protocol.rb
new file mode 100644
index 0000000000..f6ee4941cf
--- /dev/null
+++ b/test/net/protocol/test_protocol.rb
@@ -0,0 +1,19 @@
+require "test/unit"
+require "net/protocol"
+require "stringio"
+
+class TestProtocol < Test::Unit::TestCase
+ def test_each_crlf_line
+ assert_output('', '') do
+ sio = StringIO.new("")
+ imio = Net::InternetMessageIO.new(sio)
+ assert_equal(23, imio.write_message("\u3042\r\u3044\n\u3046\r\n\u3048"))
+ assert_equal("\u3042\r\n\u3044\r\n\u3046\r\n\u3048\r\n.\r\n", sio.string)
+
+ sio = StringIO.new("")
+ imio = Net::InternetMessageIO.new(sio)
+ assert_equal(8, imio.write_message("\u3042\r"))
+ assert_equal("\u3042\r\n.\r\n", sio.string)
+ end
+ end
+end