diff options
Diffstat (limited to 'test/socket_test.rb')
-rw-r--r-- | test/socket_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/socket_test.rb b/test/socket_test.rb index c4dcf02..e217da5 100644 --- a/test/socket_test.rb +++ b/test/socket_test.rb @@ -95,4 +95,18 @@ module SocketTest accepted.close assert_nil sock.timed_gets end + + def test_read_in_full + sock = MogileFS::Socket.tcp(@host, @port) + accepted = @srv.accept + thr = Thread.new do + accepted.write "HELLO" + sleep 0.1 + accepted.write " " + sleep 0.1 + accepted.write "WORLD!!!" + end + buf = sock.read("HELLO WORLD!!!".bytesize) + assert_equal "HELLO WORLD!!!", buf + end end |