diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-06 06:25:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-06 06:25:10 +0000 |
commit | 187de9240a82462c34ab26e1851c2f60182546e7 (patch) | |
tree | 22571b758c572185fb2dd9fe2b25ad7528cb29ac /test/io | |
parent | 33a05904bbce2eabe4d863e15f36840f568f113f (diff) |
console.c: console_getpass
* ext/io/console/console.c (console_getpass): add IO#getpass
method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/io')
-rw-r--r-- | test/io/console/test_io_console.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb index c69eec757e..dc489166e8 100644 --- a/test/io/console/test_io_console.rb +++ b/test/io/console/test_io_console.rb @@ -180,6 +180,20 @@ class TestIO_Console < Test::Unit::TestCase } end + def test_getpass + th = nil + helper {|m, s| + th = Thread.start { + sleep 0.1 + s.print "asdf\n" + } + assert_equal("asdf", m.getpass("> ")) + assert_equal("\n", s.readpartial(2)) + } + ensure + th.join + end + def test_iflush helper {|m, s| m.print "a" |