summaryrefslogtreecommitdiff
path: root/test/io/wait/test_io_wait.rb
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-07 15:17:22 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-07 15:17:22 +0000
commit16846eb90cda0d82a26d9c724d29672ae309fc6d (patch)
tree2da4226349499d5c4140a5e238e142f15fd419e6 /test/io/wait/test_io_wait.rb
parent70e9201610cf83408f5e408571a48b7eab8cc5fa (diff)
* test/io/wait/test_io_wait.rb: use Socket.pair instaed of pipe.
Windows can only treat a socket. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/io/wait/test_io_wait.rb')
-rw-r--r--test/io/wait/test_io_wait.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb
index 53b200148ea..66d01907a61 100644
--- a/test/io/wait/test_io_wait.rb
+++ b/test/io/wait/test_io_wait.rb
@@ -1,5 +1,6 @@
require 'test/unit'
require 'timeout'
+require 'socket'
begin
require 'io/wait'
rescue LoadError
@@ -8,7 +9,7 @@ end
class TestIOWait < Test::Unit::TestCase
def setup
- @r, @w = IO.pipe
+ @r, @w = Socket.pair(Socket::AF_INET, Socket::SOCK_STREAM, 0)
end
def teardown
@@ -17,21 +18,18 @@ class TestIOWait < Test::Unit::TestCase
end
def test_nread
- return if /mswin/ =~ RUBY_PLATFORM
assert_equal 0, @r.nread
@w.syswrite "."
assert_equal 1, @r.nread
end
def test_nread_buffered
- return if /mswin/ =~ RUBY_PLATFORM
@w.syswrite ".\n!"
assert_equal ".\n", @r.read(2)
assert_equal 1, @r.nread
end
def test_ready?
- return if /mswin/ =~ RUBY_PLATFORM
refute @r.ready?
@w.syswrite "."
assert @r.ready?
@@ -44,27 +42,23 @@ class TestIOWait < Test::Unit::TestCase
end
def test_wait
- return if /mswin/ =~ RUBY_PLATFORM
assert_nil @r.wait(0)
@w.syswrite "."
assert_equal @r, @r.wait(0)
end
def test_wait_buffered
- return if /mswin/ =~ RUBY_PLATFORM
@w.syswrite ".\n!"
assert_equal ".\n", @r.gets
assert_equal true, @r.wait(0)
end
def test_wait_forever
- return if /mswin/ =~ RUBY_PLATFORM
Thread.new { sleep 0.01; @w.syswrite "." }
assert_equal @r, @r.wait
end
def test_wait_eof
- return if /mswin/ =~ RUBY_PLATFORM
Thread.new { sleep 0.01; @w.close }
assert_nil @r.wait
end