about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-05 13:24:36 -0700
committerEric Wong <normalperson@yhbt.net>2011-05-05 13:29:15 -0700
commit9c98bbd79f152fd72b257f9c37ca185587e56225 (patch)
tree4112448567043f78b832faeff484f903f013127d /test
parentc821ebeb851807840f74c4cb4f1a10e691bf222a (diff)
downloadkgio-9c98bbd79f152fd72b257f9c37ca185587e56225.tar.gz
This is needed under Ruby trunk if the string is not actually
resized.
Diffstat (limited to 'test')
-rw-r--r--test/lib_read_write.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 593a9e9..d7f50c2 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -30,6 +30,24 @@ module LibReadWriteTest
     assert_equal "", buf
   end
 
+  def test_read_shared
+    a = "." * 0x1000
+    b = a.dup
+    @wr.syswrite "a"
+    assert_equal "a", @rd.kgio_read(0x1000, a)
+    assert_equal "a", a
+    assert_equal "." * 0x1000, b
+  end
+
+  def test_read_shared_2
+    a = "." * 0x1000
+    b = a.dup
+    @wr.syswrite "a"
+    assert_equal "a", @rd.kgio_read(0x1000, b)
+    assert_equal "a", b
+    assert_equal "." * 0x1000, a
+  end
+
   def test_tryread_zero
     assert_equal "", @rd.kgio_tryread(0)
     buf = "foo"
@@ -37,6 +55,24 @@ module LibReadWriteTest
     assert_equal "", buf
   end
 
+  def test_tryread_shared
+    a = "." * 0x1000
+    b = a.dup
+    @wr.syswrite("a")
+    assert_equal "a", @rd.kgio_tryread(0x1000, b)
+    assert_equal "a", b
+    assert_equal "." * 0x1000, a
+  end
+
+  def test_tryread_shared_2
+    a = "." * 0x1000
+    b = a.dup
+    @wr.syswrite("a")
+    assert_equal "a", @rd.kgio_tryread(0x1000, a)
+    assert_equal "a", a
+    assert_equal "." * 0x1000, b
+  end
+
   def test_read_eof
     @wr.close
     assert_nil @rd.kgio_read(5)