@@ -442,7 +442,8 @@ def test_tty_amibuous_width
442
442
ruby_file . write ( <<~RUBY )
443
443
require 'reline'
444
444
Thread.new { sleep 2; puts 'timeout'; exit }
445
- p [Reline.ambiguous_width, gets.chomp]
445
+ line = Reline.readline('>')
446
+ p [Reline.ambiguous_width, line]
446
447
RUBY
447
448
ruby_file . close
448
449
lib = File . expand_path ( '../../lib' , __dir__ )
@@ -452,8 +453,8 @@ def test_tty_amibuous_width
452
453
[ 1 , 2 ] . each do |ambiguous_width |
453
454
PTY . spawn ( *cmd ) do |r , w , pid |
454
455
loop { break if r . readpartial ( 1024 ) . include? ( "\e [6n" ) }
455
- w . puts "hello\e [10;#{ ambiguous_width + 1 } Rworld"
456
- assert_include ( r . gets , [ ambiguous_width , 'helloworld' ] . inspect )
456
+ w . puts "hello\e [10;#{ ambiguous_width + 1 } Rworld\n "
457
+ assert_include ( r . gets + r . gets , [ ambiguous_width , 'helloworld' ] . inspect )
457
458
ensure
458
459
r . close
459
460
w . close
@@ -464,8 +465,8 @@ def test_tty_amibuous_width
464
465
# Ambiguous width = 1 when cursor pos timed out
465
466
PTY . spawn ( *cmd ) do |r , w , pid |
466
467
loop { break if r . readpartial ( 1024 ) . include? ( "\e [6n" ) }
467
- w . puts "hello \e [10;2Sworld "
468
- assert_include ( r . gets , [ 1 , "hello \e [10;2Sworld " ] . inspect )
468
+ w . puts "helloworld \n "
469
+ assert_include ( r . gets + r . gets , [ 1 , "helloworld " ] . inspect )
469
470
ensure
470
471
r . close
471
472
w . close
0 commit comments