summaryrefslogtreecommitdiff
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-21 15:57:52 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-21 15:57:52 +0000
commit9cfe35ad503cd6bb598dea85517949b932719afe (patch)
tree00b50c4b264d237624d19632bc9b086feaeac4a8 /test/ruby/test_io.rb
parent6adda0379c0dc2b2f881060cba2ad40493e59608 (diff)
* io.c (io_getpartial): error message describes what should be
waited after nonblocking error. (rb_io_write_nonblock): ditto. * ext/socket/init.c (s_recvfrom_nonblock): ditto. (s_accept_nonblock): ditto. * ext/socket/socket.c (sock_connect_nonblock): ditto. * ext/socket/ancdata.c (bsock_sendmsg_internal): ditto. (bsock_recvmsg_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 0c1c6b2d2b..0f448dbf39 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -857,6 +857,30 @@ class TestIO < Test::Unit::TestCase
end)
end
+ def test_read_nonblock_error
+ return if !have_nonblock?
+ with_pipe {|r, w|
+ begin
+ r.read_nonblock 4096
+ rescue Errno::EWOULDBLOCK
+ assert_match(/WANT_READ/, $!.message)
+ end
+ }
+ end
+
+ def test_write_nonblock_error
+ return if !have_nonblock?
+ with_pipe {|r, w|
+ begin
+ loop {
+ w.write_nonblock "a"*100000
+ }
+ rescue Errno::EWOULDBLOCK
+ assert_match(/WANT_WRITE/, $!.message)
+ end
+ }
+ end
+
def test_gets
pipe(proc do |w|
w.write "foobarbaz"