aboutsummaryrefslogtreecommitdiffstats
path: root/test/io
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-04 13:25:01 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-04 13:25:01 +0000
commit4fdebdbadf127911f07f8d71a934ef0e6a0c22f2 (patch)
treeda2d525cec0aec92ba77299a958b6f8e2abcfc04 /test/io
parenta57a3895a56e585ae14d60839f655f320c79870a (diff)
downloadruby-4fdebdbadf127911f07f8d71a934ef0e6a0c22f2.tar.gz
Improve line covearge of ext/io/nonblock/nonblock.c from 54.5% to 95.5%
Not so good test, but it would be better than nothing, I guess... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/io')
-rw-r--r--test/io/nonblock/test_flush.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/io/nonblock/test_flush.rb b/test/io/nonblock/test_flush.rb
index bc60cab8bf..e014a5f3db 100644
--- a/test/io/nonblock/test_flush.rb
+++ b/test/io/nonblock/test_flush.rb
@@ -50,4 +50,22 @@ class TestIONonblock < Test::Unit::TestCase
assert_equal(4097, result.size)
true
end
+
+ def test_nonblock
+ IO.pipe {|r, w|
+ assert_equal(false, w.nonblock?)
+ w.nonblock do
+ assert_equal(true, w.nonblock?)
+ w.nonblock(false) do
+ assert_equal(false, w.nonblock?)
+ w.nonblock(false) do
+ assert_equal(false, w.nonblock?)
+ end
+ assert_equal(false, w.nonblock?)
+ end
+ assert_equal(true, w.nonblock?)
+ end
+ assert_equal(false, w.nonblock?)
+ }
+ end
end if IO.method_defined?(:nonblock)