From 4024f1c13c52b6d1af999e0f6586a17a976e31ce Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 6 Dec 2015 06:25:10 +0000 Subject: 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 --- test/io/console/test_io_console.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') 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" -- cgit v1.2.3