diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-04 13:25:01 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-04 13:25:01 +0000 |
commit | 440dc6b7e0b3b74db221eed81871516e301d4b3e (patch) | |
tree | da2d525cec0aec92ba77299a958b6f8e2abcfc04 | |
parent | b833c34f8cafa2fbf1355f26658bd05a8454c2d9 (diff) | |
download | ruby-440dc6b7e0b3b74db221eed81871516e301d4b3e.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
-rw-r--r-- | ext/io/nonblock/nonblock.c | 2 | ||||
-rw-r--r-- | test/io/nonblock/test_flush.rb | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/ext/io/nonblock/nonblock.c b/ext/io/nonblock/nonblock.c index 2509329f6c..1c0bdc68e7 100644 --- a/ext/io/nonblock/nonblock.c +++ b/ext/io/nonblock/nonblock.c @@ -1,6 +1,6 @@ /********************************************************************** - io/wait.c - + io/nonblock.c - $Author$ created at: Tue Jul 14 21:53:18 2009 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) |