diff options
Diffstat (limited to 'test/socket/test_nonblock.rb')
-rw-r--r-- | test/socket/test_nonblock.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb index d494f91c41..e395a0ad31 100644 --- a/test/socket/test_nonblock.rb +++ b/test/socket/test_nonblock.rb @@ -190,6 +190,20 @@ class TestSocketNonblock < Test::Unit::TestCase s.close if s end + def test_read_nonblock_no_exception + c, s = tcp_pair + assert_equal :wait_readable, c.read_nonblock(100, exception: false) + assert_equal :wait_readable, s.read_nonblock(100, exception: false) + c.write("abc") + IO.select [s] + assert_equal("a", s.read_nonblock(1, exception: false)) + assert_equal("bc", s.read_nonblock(100, exception: false)) + assert_equal :wait_readable, s.read_nonblock(100, exception: false) + ensure + c.close if c + s.close if s + end + =begin def test_write_nonblock c, s = tcp_pair |