aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-08-24 16:30:53 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-08-24 21:01:09 +0900
commit6c62ffbee925c27ed5252ceab298658a54dd9563 (patch)
tree4583676d8e604e9704c6a165284693fb3a888f52
parentac482b7ca7505c50ac7d5d84a32ae4dc0c5ea438 (diff)
downloadruby-openssl-6c62ffbee925c27ed5252ceab298658a54dd9563.tar.gz
test/test_ssl: move test_multibyte_read_write to test_pair
-rw-r--r--test/test_pair.rb21
-rw-r--r--test/test_ssl.rb24
2 files changed, 21 insertions, 24 deletions
diff --git a/test/test_pair.rb b/test/test_pair.rb
index 570309af..52a90018 100644
--- a/test/test_pair.rb
+++ b/test/test_pair.rb
@@ -187,6 +187,27 @@ module OpenSSL::TestPairM
}
end
+ def test_multibyte_read_write
+ # German a umlaut
+ auml = [%w{ C3 A4 }.join('')].pack('H*')
+ auml.force_encoding(Encoding::UTF_8)
+ bsize = auml.bytesize
+
+ ssl_pair { |s1, s2|
+ assert_equal bsize, s1.write(auml)
+ read = s2.read(bsize)
+ assert_equal Encoding::ASCII_8BIT, read.encoding
+ assert_equal bsize, read.bytesize
+ assert_equal auml, read.force_encoding(Encoding::UTF_8)
+
+ s1.puts(auml)
+ read = s2.gets
+ assert_equal Encoding::ASCII_8BIT, read.encoding
+ assert_equal bsize + 1, read.bytesize
+ assert_equal auml + "\n", read.force_encoding(Encoding::UTF_8)
+ }
+ end
+
def test_read_nonblock
ssl_pair {|s1, s2|
err = nil
diff --git a/test/test_ssl.rb b/test/test_ssl.rb
index 452e7c47..ac739429 100644
--- a/test/test_ssl.rb
+++ b/test/test_ssl.rb
@@ -744,30 +744,6 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
end
end
- def test_multibyte_read_write
- #German a umlaut
- auml = [%w{ C3 A4 }.join('')].pack('H*')
- auml.force_encoding(Encoding::UTF_8)
-
- [10, 1000, 100000].each {|i|
- str = nil
- num_written = nil
- server_proc = Proc.new {|ctx, ssl|
- cmp = ssl.read
- raw_size = cmp.size
- cmp.force_encoding(Encoding::UTF_8)
- assert_equal(str, cmp)
- assert_equal(num_written, raw_size)
- }
- start_server(server_proc: server_proc) { |port|
- server_connect(port) { |ssl|
- str = auml * i
- num_written = ssl.write(str)
- }
- }
- }
- end
-
def test_unset_OP_ALL
ctx_proc = Proc.new { |ctx|
# If OP_DONT_INSERT_EMPTY_FRAGMENTS is not defined, this test is