summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-30 04:45:20 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-30 04:45:20 +0000
commit766c32adc3c2d6848fea2e7d7976bdb9f26487b9 (patch)
treef9e6c9de4337207bf27254f77fcb270cf250d2f6
parentf9a973ad4f47203e19c2abfa55b5a762d8da04bd (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/io/wait/test_io_wait.rb64
-rw-r--r--version.h2
3 files changed, 70 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 18b4b5fe8d..891cc339bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Apr 30 03:25:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * 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@ruby-lang.org>
* test/dl/test_base.rb (DL::LIBC_SO): its always msvc*.dll on
diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb
new file mode 100644
index 0000000000..4aad7cd106
--- /dev/null
+++ b/test/io/wait/test_io_wait.rb
@@ -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)
diff --git a/version.h b/version.h
index cd46ba548c..5f29ed5e98 100644
--- a/version.h
+++ b/version.h
@@ -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