diff src/testdir/test_terminal.vim @ 13543:98d832e4e394 v8.0.1645

patch 8.0.1645: test for terminal response to escape sequence may fail commit https://github.com/vim/vim/commit/086eb876951aa0b0bee3de4ed0569bf4b70c6f31 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 25 21:24:12 2018 +0200 patch 8.0.1645: test for terminal response to escape sequence may fail Problem: Test for terminal response to escape sequence fails for some people. (toothpik) Solution: Run "cat" and let it echo the characters.
author Christian Brabandt <cb@256bit.org>
date Sun, 25 Mar 2018 21:30:07 +0200
parents 296d02b0637f
children 87a9c1be0ae3
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -833,25 +833,22 @@ func Test_terminal_response_to_control_s
   endif
 
   let buf = Run_shell_in_terminal({})
-  call WaitFor({-> term_getline(buf, 1) != ""})
+  call WaitFor({-> term_getline(buf, 1) != ''})
 
-  call writefile(["\x1b[6n"], 'Xescape')
-  call term_sendkeys(buf, "cat Xescape\<cr>")
+  call term_sendkeys(buf, "cat\<CR>")
+  call WaitFor({-> term_getline(buf, 1) =~ 'cat'})
 
-  " wait for the response of control sequence from libvterm (and send it to tty)
-  sleep 200m
-  call term_wait(buf)
+  " Request the cursor position.
+  call term_sendkeys(buf, "\x1b[6n\<CR>")
 
   " Wait for output from tty to display, below an empty line.
-  " It should show \e3;1R, but only 1R may show up
-  call assert_match('\<\d\+R', term_getline(buf, 3))
+  call WaitFor({-> term_getline(buf, 4) =~ '3;1R'})
 
-  call term_sendkeys(buf, "\<c-c>")
-  call term_wait(buf)
+  " End "cat" gently.
+  call term_sendkeys(buf, "\<CR>\<C-D>")
+
   call Stop_shell_in_terminal(buf)
-
   exe buf . 'bwipe'
-  call delete('Xescape')
   unlet g:job
 endfunc