From b20e2c3f2a3ce227b9cf32d2bf02db0ac67eccb5 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sat, 13 Mar 2021 00:55:49 -0800 Subject: Backport io-console 0.5.7 to Ruby 3.0 (#4252) * [ruby/io-console] [DOC] Note that IO#getpass returns a chomped string IO#getpass uses String#chomp! on the read input line. https://github.com/ruby/io-console/commit/1e98c93bc8 * [ruby/io-console] Ignore chomp! result and return the modified string https://github.com/ruby/io-console/commit/09e5ccc729 * [ruby/io-console] Pre-define chomp! ID https://github.com/ruby/io-console/commit/028e1c9497 * [ruby/io-console] Shrink struct query_args https://github.com/ruby/io-console/commit/720be0a3e5 * [ruby/io-console] bump up to 0.5.7 https://github.com/ruby/io-console/commit/f55d7ebff6 Co-authored-by: Marcus Stollsteimer Co-authored-by: Nobuyoshi Nakada --- test/io/console/test_io_console.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/io') diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb index 3962de3790..bec10c5da0 100644 --- a/test/io/console/test_io_console.rb +++ b/test/io/console/test_io_console.rb @@ -235,6 +235,15 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do assert_equal("\r\n", r.gets) assert_equal("\"asdf\"", r.gets.chomp) end + + run_pty("p IO.console.getpass('> ')") do |r, w| + assert_equal("> ", r.readpartial(10)) + sleep 0.1 + w.print "asdf\C-D\C-D" + sleep 0.1 + assert_equal("\r\n", r.gets) + assert_equal("\"asdf\"", r.gets.chomp) + end end def test_iflush -- cgit v1.2.3