@@ -442,7 +442,8 @@ def test_tty_amibuous_width
442442 ruby_file . write ( <<~RUBY )
443443 require 'reline'
444444 Thread.new { sleep 2; puts 'timeout'; exit }
445- p [Reline.ambiguous_width, gets.chomp]
445+ line = Reline.readline('>')
446+ p [Reline.ambiguous_width, line]
446447 RUBY
447448 ruby_file . close
448449 lib = File . expand_path ( '../../lib' , __dir__ )
@@ -452,8 +453,8 @@ def test_tty_amibuous_width
452453 [ 1 , 2 ] . each do |ambiguous_width |
453454 PTY . spawn ( *cmd ) do |r , w , pid |
454455 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 )
457458 ensure
458459 r . close
459460 w . close
@@ -464,8 +465,8 @@ def test_tty_amibuous_width
464465 # Ambiguous width = 1 when cursor pos timed out
465466 PTY . spawn ( *cmd ) do |r , w , pid |
466467 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 )
469470 ensure
470471 r . close
471472 w . close
0 commit comments