diff options
author | Matthew Draper <matthew@trebex.net> | 2012-02-28 23:39:09 +1030 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-02-28 20:37:23 +0000 |
commit | 8a3f48341248b919b5c4816bf4f7079eb35d6882 (patch) | |
tree | 057b62e8a24fef38a4961648955c82f57f777ce8 /test/socket_test.rb | |
parent | 55365e01dc0b2b5db01441004f4c6921d1fd04d6 (diff) | |
download | mogilefs-client-8a3f48341248b919b5c4816bf4f7079eb35d6882.tar.gz |
Leave size unchanged, so it's available for easy comparison with buf.bytesize. [ew: added test case] Acked-by: Eric Wong <normalperson@yhbt.net>
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 |