test_copy_stream: fix userspace buffering assumption
authorEric Wong <normalperson@yhbt.net>
Fri, 13 May 2011 01:59:44 +0000 (12 18:59 -0700)
committerEric Wong <normalperson@yhbt.net>
Fri, 13 May 2011 01:59:44 +0000 (12 18:59 -0700)
And enable UNIX socket tests for this

test/test_copy_stream.rb

index 1858257..71d7cae 100644 (file)
@@ -232,7 +232,6 @@ class TestIOCopyStreamCompat < Test::Unit::TestCase
   end
 
   def test_copy_stream_socket
-    return
     mkcdtmpdir {
 
       content = "foobar"
@@ -280,13 +279,13 @@ class TestIOCopyStreamCompat < Test::Unit::TestCase
       }
 
       File.open("bigsrc") {|f|
-        assert_equal(bigcontent[0,100], f.read(100))
+        assert_equal(bigcontent[0,100], f.sysread(100))
         assert_equal(100, f.pos)
         with_socketpair {|s1, s2|
           t = Thread.new { s2.read }
           ret = IO::Splice.copy_stream(f, s1)
           assert_equal(bigcontent.bytesize-100, ret)
-          assert_equal(bigcontent.length, f.pos)
+          assert_equal(bigcontent.length, f.sysseek(0, IO::SEEK_CUR))
           s1.close
           result = t.value
           assert_equal(bigcontent[100..-1], result)