summaryrefslogtreecommitdiff
path: root/test/socket/test_tcp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/socket/test_tcp.rb')
-rw-r--r--test/socket/test_tcp.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb
index 7328897d1e..a6c332c6c4 100644
--- a/test/socket/test_tcp.rb
+++ b/test/socket/test_tcp.rb
@@ -76,4 +76,12 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
th.join
}
end
+
+ def test_accept_nonblock
+ TCPServer.open("localhost", 0) {|svr|
+ assert_raises(IO::WaitReadable) { svr.accept_nonblock }
+ assert_equal :wait_readable, svr.accept_nonblock(exception: false)
+ assert_raises(IO::WaitReadable) { svr.accept_nonblock(exception: true) }
+ }
+ end
end if defined?(TCPSocket)