summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-20 17:39:44 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-20 17:39:44 +0000
commit8ea54420c27d119c102cf9c404b354f7372ba952 (patch)
tree012b5baffce83aa0e150a36c588fee1060c62ff2 /test
parent8af8d88b127db5a43f37d0192cc1b82a6d20c607 (diff)
downloadruby-8ea54420c27d119c102cf9c404b354f7372ba952.tar.gz
ruby-8ea54420c27d119c102cf9c404b354f7372ba952.tar.xz
ruby-8ea54420c27d119c102cf9c404b354f7372ba952.zip
* ext/openssl/lib/openssl/buffering.rb
(OpenSSL::Buffering#write_nonblock): new method. * ext/openssl/ossl_ssl.c (ossl_ssl_write_nonblock): new method. (ossl_ssl_write_internal): defined. (ossl_ssl_write): use ossl_ssl_write_internal. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_pair.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb
index e5beebc50..a6f1e4f55 100644
--- a/test/openssl/test_pair.rb
+++ b/test/openssl/test_pair.rb
@@ -165,6 +165,33 @@ class OpenSSL::TestPair < Test::Unit::TestCase
}
end
+ def test_write_nonblock
+ ssl_pair {|s1, s2|
+ n = 0
+ begin
+ n += s1.write_nonblock("a" * 100000)
+ n += s1.write_nonblock("b" * 100000)
+ n += s1.write_nonblock("c" * 100000)
+ n += s1.write_nonblock("d" * 100000)
+ n += s1.write_nonblock("e" * 100000)
+ n += s1.write_nonblock("f" * 100000)
+ rescue IO::WaitWritable
+ end
+ s1.close
+ assert_equal(n, s2.read.length)
+ }
+ end
+
+ def test_write_nonblock_with_buffered_data
+ ssl_pair {|s1, s2|
+ s1.write "foo"
+ s1.write_nonblock("bar")
+ s1.write "baz"
+ s1.close
+ assert_equal("foobarbaz", s2.read)
+ }
+ end
+
end
end