[前][次][番号順一覧][スレッド一覧]

ruby-changes:19776

From: yugui <ko1@a...>
Date: Mon, 30 May 2011 13:45:33 +0900 (JST)
Subject: [ruby-changes:19776] yugui:r31821 (ruby_1_9_2): merges r31389 and r31398 from trunk into ruby_1_9_2.

yugui	2011-05-30 13:45:20 +0900 (Mon, 30 May 2011)

  New Revision: 31821

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31821

  Log:
    merges r31389 and r31398 from trunk into ruby_1_9_2.
    --
    * test/io/wait/test_io_wait.rb: New. for testing ext/io/wait.
      the patch was written by Eric Wong. [Feature #4531]
    --
    fix commit mistake of r31389.

  Added directories:
    branches/ruby_1_9_2/test/io/wait/
  Added files:
    branches/ruby_1_9_2/test/io/wait/test_io_wait.rb
  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 31820)
+++ ruby_1_9_2/ChangeLog	(revision 31821)
@@ -1,3 +1,8 @@
+Sat Apr 30 03:25:53 2011  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* test/io/wait/test_io_wait.rb: New. for testing ext/io/wait.
+	  the patch was written by Eric Wong. [Feature #4531]
+
 Thu Apr 28 15:32:53 2011  NAKAMURA Usaku  <usa@r...>
 
 	* test/dl/test_base.rb (DL::LIBC_SO): its always msvc*.dll on
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 31820)
+++ ruby_1_9_2/version.h	(revision 31821)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 245
+#define RUBY_PATCHLEVEL 246
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_2/test/io/wait/test_io_wait.rb
===================================================================
--- ruby_1_9_2/test/io/wait/test_io_wait.rb	(revision 0)
+++ ruby_1_9_2/test/io/wait/test_io_wait.rb	(revision 31821)
@@ -0,0 +1,64 @@
+require 'test/unit'
+require 'timeout'
+begin
+  require 'io/wait'
+rescue LoadError
+end
+
+class TestIOWait < Test::Unit::TestCase
+
+  def setup
+    @r, @w = IO.pipe
+  end
+
+  def teardown
+    @r.close unless @r.closed?
+    @w.close unless @w.closed?
+  end
+
+  def test_nread
+    assert_equal 0, @r.nread
+    @w.syswrite "."
+    assert_equal 1, @r.nread
+  end
+
+  def test_nread_buffered
+    @w.syswrite ".\n!"
+    assert_equal ".\n", @r.read(2)
+    assert_equal 1, @r.nread
+  end
+
+  def test_ready?
+    refute @r.ready?
+    @w.syswrite "."
+    assert @r.ready?
+  end
+
+  def test_buffered_ready?
+    @w.syswrite ".\n!"
+    assert_equal ".\n", @r.gets
+    assert @r.ready?
+  end
+
+  def test_wait
+    assert_nil @r.wait(0)
+    @w.syswrite "."
+    assert_equal @r, @r.wait(0)
+  end
+
+  def test_wait_buffered
+    @w.syswrite ".\n!"
+    assert_equal ".\n", @r.gets
+    assert_equal true, @r.wait(0)
+  end
+
+  def test_wait_forever
+    Thread.new { sleep 0.01; @w.syswrite "." }
+    assert_equal @r, @r.wait
+  end
+
+  def test_wait_eof
+    Thread.new { sleep 0.01; @w.close }
+    assert_nil @r.wait
+  end
+end if IO.method_defined?(:wait)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]