summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-25 07:14:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-25 07:14:12 +0000
commit945e4692ca9898c0595ef30437ec3a45b75483a4 (patch)
tree62ec6e92983e45ec47b203bed90cd9ec9a053109 /test
parentf0806c4863c4440f9644ef0aea233739269ed45a (diff)
console.c: IO.console arguments passing
* ext/io/console/console.c (console_dev): send the given arguments to the opened console. as a special case, do nothing if :close is given. * test/lib/leakchecker.rb (LeakChecker#check_fd_leak): close if console. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/io/console/test_io_console.rb8
-rw-r--r--test/lib/leakchecker.rb3
2 files changed, 11 insertions, 0 deletions
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 237a41a35fe..3481a2b2138 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -222,14 +222,22 @@ class TestIO_Console < Test::Unit::TestCase
IO.console.close
assert_kind_of(IO, IO.console)
assert_nothing_raised(IOError) {IO.console.fileno}
+
+ IO.console(:close)
+ assert(IO.console(:tty?))
+ ensure
+ IO.console(:close)
end
def test_sync
assert(IO.console.sync, "console should be unbuffered")
+ ensure
+ IO.console(:close)
end
else
def test_close
assert_equal(["true"], run_pty("IO.console.close; p IO.console.fileno >= 0"))
+ assert_equal(["true"], run_pty("IO.console(:close); p IO.console(:tty?)"))
end
def test_sync
diff --git a/test/lib/leakchecker.rb b/test/lib/leakchecker.rb
index 5d05c1e4567..37c87c9f72e 100644
--- a/test/lib/leakchecker.rb
+++ b/test/lib/leakchecker.rb
@@ -31,6 +31,9 @@ class LeakChecker
def check_fd_leak(test_name)
leaked = false
live1 = @fd_info
+ if IO.respond_to?(:console)
+ IO.console(:close)
+ end
live2 = find_fds
fd_closed = live1 - live2
if !fd_closed.empty?