ruby-changes:19430
From: kosaki <ko1@a...>
Date: Sun, 8 May 2011 00:17:29 +0900 (JST)
Subject: [ruby-changes:19430] Ruby:r31470 (trunk): * test/io/wait/test_io_wait.rb: use Socket.pair instaed of pipe.
kosaki 2011-05-08 00:17:22 +0900 (Sun, 08 May 2011) New Revision: 31470 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31470 Log: * test/io/wait/test_io_wait.rb: use Socket.pair instaed of pipe. Windows can only treat a socket. Modified files: trunk/ChangeLog trunk/test/io/wait/test_io_wait.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 31469) +++ ChangeLog (revision 31470) @@ -1,7 +1,7 @@ -Sat May 7 23:56:56 2011 KOSAKI Motohiro <kosaki.motohiro@g...> +Sun May 8 00:13:05 2011 KOSAKI Motohiro <kosaki.motohiro@g...> - * test/io/wait/test_io_wait.rb: skip tests if the platform is - mswin. + * test/io/wait/test_io_wait.rb: use Socket.pair instaed of pipe. + Windows can only treat a socket. Sat May 7 22:43:48 2011 KOSAKI Motohiro <kosaki.motohiro@g...> Index: test/io/wait/test_io_wait.rb =================================================================== --- test/io/wait/test_io_wait.rb (revision 31469) +++ test/io/wait/test_io_wait.rb (revision 31470) @@ -1,5 +1,6 @@ require 'test/unit' require 'timeout' +require 'socket' begin require 'io/wait' rescue LoadError @@ -8,7 +9,7 @@ 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 @@ 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/