diff options
author | Jeremy Evans <code@jeremyevans.net> | 2021-03-13 00:55:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-13 17:55:49 +0900 |
commit | b20e2c3f2a3ce227b9cf32d2bf02db0ac67eccb5 (patch) | |
tree | d6f3ee19ac9050acbc0b897dd21c48da83f02f84 /test/io | |
parent | 6f9e007729d53fdbc22e37e52129ea5aa2556d0e (diff) |
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 <sto.mar@web.de>
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Diffstat (limited to 'test/io')
-rw-r--r-- | test/io/console/test_io_console.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |