Fix multithread issue in the test of r35391

pipe() uses threads and its reader thread may work before the writer
writes "foob". On such case, the reader will raise error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-04-19 02:49:48 +00:00
Родитель 1ff181cf8c
Коммит c1903a9f17
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -1069,13 +1069,12 @@ class TestIO < Test::Unit::TestCase
def test_read_nonblock_with_not_empty_buffer
skip "IO#read_nonblock is not supported on file/pipe." if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
pipe(proc do |w|
with_pipe {|r, w|
w.write "foob"
w.close
end, proc do |r|
r.read_nonblock(5, s = "01234567")
assert_equal("foob", s)
end)
}
end
def test_read_nonblock_error