summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/socket/test_nonblock.rb10
-rw-r--r--test/socket/test_unix.rb7
2 files changed, 17 insertions, 0 deletions
diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb
index 4e14c9355a..93f463daf9 100644
--- a/test/socket/test_nonblock.rb
+++ b/test/socket/test_nonblock.rb
@@ -128,6 +128,16 @@ class TestSocketNonblock < Test::Unit::TestCase
}
mesg = u1.recv_nonblock(100)
assert_equal("", mesg)
+
+ buf = "short"
+ out = "hello world" * 4
+ out.freeze
+ u2.send(out, 0, u1.getsockname)
+ IO.select [u1]
+ rv = u1.recv_nonblock(100, 0, buf)
+ assert_equal rv.object_id, buf.object_id
+ assert_equal out, rv
+ assert_equal out, buf
ensure
u1.close if u1
u2.close if u2
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index a10f2e51eb..344dcc90ad 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -385,6 +385,13 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
assert_equal("", s1.recv(10))
assert_equal("", s1.recv(10))
assert_raise(IO::EAGAINWaitReadable) { s1.recv_nonblock(10) }
+
+ buf = ""
+ s2.send("BBBBBB", 0)
+ sleep 0.1
+ rv = s1.recv(100, 0, buf)
+ assert_equal buf.object_id, rv.object_id
+ assert_equal "BBBBBB", rv
ensure
s1.close if s1
s2.close if s2