summaryrefslogtreecommitdiff
path: root/test/io/console
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-06-27 16:22:56 +0900
committergit <svn-admin@ruby-lang.org>2025-06-27 07:23:09 +0000
commit528b75cc14f76ef703f0b22ccdd6db4b398982cc (patch)
tree8e2004cdb5ca6c391deef6fd6d8a485bfc5adbc9 /test/io/console
parent495613ffd3f1c1008e1d16515a52817b188e091d (diff)
[ruby/io-console] Ignore printed control char
It's something we don't expect and might be coming from somewhere else. https://github.com/ruby/io-console/commit/c5e47a900c
Diffstat (limited to 'test/io/console')
-rw-r--r--test/io/console/test_io_console.rb9
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 deeedf01f3..cdaa255426 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -367,6 +367,15 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do
w.print cc
w.flush
result = EnvUtil.timeout(3) {r.gets}
+ if res
+ case cc
+ when 0..31
+ cc = "^" + (cc.ord | 0x40).chr
+ when 127
+ cc = "^?"
+ end
+ res.sub!(cc, "")
+ end
assert_equal(expect, result.chomp)
end