about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--test/lib_read_write.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index b8483a0..fa7ccf0 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -95,6 +95,20 @@ module LibReadWriteTest
     tmp.each { |count| assert_equal nil, count }
   end
 
+  def test_tryread_extra_buf_eagain_clears_buffer
+    tmp = "hello world"
+    rv = @rd.kgio_tryread(2, tmp)
+    assert_equal Kgio::WaitReadable, rv
+    assert_equal "", tmp
+  end
+
+  def test_tryread_extra_buf_eof_clears_buffer
+    tmp = "hello world"
+    @wr.close
+    assert_nil @rd.kgio_tryread(2, tmp)
+    assert_equal "", tmp
+  end
+
   def test_monster_trywrite
     buf = "." * 1024 * 1024 * 10
     rv = @wr.kgio_trywrite(buf)