summaryrefslogtreecommitdiff
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
commit440dc6b7e0b3b74db221eed81871516e301d4b3e (patch)
treeda2d525cec0aec92ba77299a958b6f8e2abcfc04 /test/io
parentb833c34f8cafa2fbf1355f26658bd05a8454c2d9 (diff)
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)