To: vim_dev@googlegroups.com Subject: Patch 8.2.4078 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4078 Problem: Terminal test for current directory not used on FreeBSD. Solution: Make it work on FreeBSD. (Ozaki Kiichi, closes #9516) Add TermWait() inside Run_shell_in_terminal() as a generic solution. Files: src/testdir/test_terminal3.vim, src/testdir/term_util.vim, src/testdir/test_terminal.vim, src/testdir/test_terminal2.vim, src/testdir/test_mapping.vim *** ../vim-8.2.4077/src/testdir/test_terminal3.vim 2021-12-17 09:44:29.143056549 +0000 --- src/testdir/test_terminal3.vim 2022-01-13 15:15:34.931486573 +0000 *************** *** 779,786 **** func Test_terminal_sync_shell_dir() CheckUnix " The test always use sh (see src/testdir/unix.vim). - " However, BSD's sh doesn't seem to play well with OSC 7 escape sequence. - CheckNotBSD set asd " , is --- 779,784 ---- *************** *** 789,803 **** let chars = ",a" " "," is url-encoded as '%2C' let chars_url = "%2Ca" ! let tmpfolder = fnamemodify(tempname(),':h').'/'.chars ! let tmpfolder_url = fnamemodify(tempname(),':h').'/'.chars_url call mkdir(tmpfolder, "p") let buf = Run_shell_in_terminal({}) ! call term_sendkeys(buf, "echo -ne $'\\e\]7;file://".tmpfolder_url."\\a'\") ! "call term_sendkeys(buf, "cd ".tmpfolder."\") call TermWait(buf) if has("mac") ! let expected = "/private".tmpfolder else let expected = tmpfolder endif --- 787,801 ---- let chars = ",a" " "," is url-encoded as '%2C' let chars_url = "%2Ca" ! let tmpfolder = fnamemodify(tempname(),':h') .. '/' .. chars ! let tmpfolder_url = fnamemodify(tempname(),':h') .. '/' .. chars_url call mkdir(tmpfolder, "p") let buf = Run_shell_in_terminal({}) ! call term_sendkeys(buf, "echo $'\\e\]7;file://" .. tmpfolder_url .. "\\a'\") ! "call term_sendkeys(buf, "cd " .. tmpfolder .. "\") call TermWait(buf) if has("mac") ! let expected = "/private" .. tmpfolder else let expected = tmpfolder endif *** ../vim-8.2.4077/src/testdir/term_util.vim 2021-04-04 14:28:55.509067733 +0100 --- src/testdir/term_util.vim 2022-01-13 15:15:09.023529114 +0000 *************** *** 24,29 **** --- 24,30 ---- call term_sendkeys(a:buf, "exit\r") let job = term_getjob(a:buf) call WaitForAssert({-> assert_equal("dead", job_status(job))}) + call TermWait(a:buf) endfunc " Wrapper around term_wait() to allow more time for re-runs of flaky tests *************** *** 176,181 **** --- 177,186 ---- let string = string({'job': buf->term_getjob()}) call assert_match("{'job': 'process \\d\\+ run'}", string) + " On slower systems it may take a bit of time before the shell is ready to + " accept keys. This mainly matters when using term_sendkeys() next. + call TermWait(buf) + return buf endfunc *** ../vim-8.2.4077/src/testdir/test_terminal.vim 2021-12-16 18:02:03.363882332 +0000 --- src/testdir/test_terminal.vim 2022-01-13 15:23:43.974700238 +0000 *************** *** 26,32 **** call assert_fails('set modifiable', 'E946:') call StopShellInTerminal(buf) - call TermWait(buf) call assert_equal('n', mode()) call assert_match('%aF[^\n]*finished]', execute('ls')) call assert_match('%aF[^\n]*finished]', execute('ls F')) --- 26,31 ---- *************** *** 48,54 **** call assert_equal("", bufname(buf)) call assert_match('\[No Name\]', execute('file')) call StopShellInTerminal(buf) - call TermWait(buf) endfunc func Test_terminal_TerminalWinOpen() --- 47,52 ---- *************** *** 71,77 **** func Test_terminal_make_change() let buf = Run_shell_in_terminal({}) call StopShellInTerminal(buf) - call TermWait(buf) setlocal modifiable exe "normal Axxx\" --- 69,74 ---- *************** *** 109,115 **** func Test_terminal_split_quit() let buf = Run_shell_in_terminal({}) - call TermWait(buf) split quit! call TermWait(buf) --- 106,111 ---- *************** *** 363,369 **** call assert_inrange(91, 100, lines) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' set termwinscroll& call delete('Xtext') --- 359,364 ---- *************** *** 751,757 **** let g:job = term_getjob(buf) call StopShellInTerminal(buf) - call TermWait(buf) unlet g:job bwipe endfunc --- 746,751 ---- *************** *** 934,940 **** call term_sendkeys(buf, "\r") call StopShellInTerminal(buf) - call TermWait(buf) tunmap 123 tunmap 456 --- 928,933 ---- *************** *** 952,958 **** let buf = Run_shell_in_terminal({}) wall call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' unlet g:job endfunc --- 945,950 ---- *************** *** 961,967 **** let buf = Run_shell_in_terminal({}) call assert_fails('wqall', 'E948:') call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' unlet g:job endfunc --- 953,958 ---- *************** *** 2001,2007 **** let buf = Run_shell_in_terminal({}) call assert_equal(colors, term_getansicolors(buf)) call StopShellInTerminal(buf) - call TermWait(buf) call assert_equal([], term_getansicolors(buf)) exe buf . 'bwipe' --- 1992,1997 ---- *************** *** 2026,2032 **** let buf = Run_shell_in_terminal({}) call assert_equal(g:terminal_ansi_colors, term_getansicolors(buf)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' unlet g:terminal_ansi_colors --- 2016,2021 ---- *************** *** 2060,2066 **** call assert_fails('call term_setansicolors(buf, {})', 'E714:') call StopShellInTerminal(buf) - call TermWait(buf) call assert_equal(0, term_setansicolors(buf, [])) exe buf . 'bwipe' endfunc --- 2049,2054 ---- *** ../vim-8.2.4077/src/testdir/test_terminal2.vim 2021-12-12 18:50:16.019937129 +0000 --- src/testdir/test_terminal2.vim 2022-01-13 15:14:45.619567635 +0000 *************** *** 49,55 **** let win = bufwinid(buf) call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' set termwinsize=7x0 --- 49,54 ---- *************** *** 57,63 **** let win = bufwinid(buf) call assert_equal([7, winwidth(win)], term_getsize(buf)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' set termwinsize=0x33 --- 56,61 ---- *************** *** 65,71 **** let win = bufwinid(buf) call assert_equal([winheight(win), 33], term_getsize(buf)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' set termwinsize= --- 63,68 ---- *************** *** 95,101 **** call assert_equal(30, winwidth(win)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' set termwinsize=0*0 --- 92,97 ---- *************** *** 103,109 **** let win = bufwinid(buf) call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' set termwinsize= --- 99,104 ---- *************** *** 287,293 **** call assert_equal(1, winnr('$')) let buf = Run_shell_in_terminal({'term_finish': 'close'}) call StopShellInTerminal(buf) - call TermWait(buf) " closing window wipes out the terminal buffer a with finished job call WaitForAssert({-> assert_equal(1, winnr('$'))}) --- 282,287 ---- *************** *** 572,578 **** call assert_equal('', term_gettty(buf + 1)) call StopShellInTerminal(buf) - call TermWait(buf) exe buf . 'bwipe' endfunc --- 566,571 ---- *** ../vim-8.2.4077/src/testdir/test_mapping.vim 2021-12-24 19:54:49.216150256 +0000 --- src/testdir/test_mapping.vim 2022-01-13 15:15:50.527461032 +0000 *************** *** 976,982 **** call assert_equal('t', m) call assert_equal('t', mode(1)) call StopShellInTerminal(buf) - call TermWait(buf) close! tunmap endif --- 976,981 ---- *** ../vim-8.2.4077/src/version.c 2022-01-13 14:49:06.702083230 +0000 --- src/version.c 2022-01-13 15:04:59.132585857 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4078, /**/ -- Back up my hard drive? I can't find the reverse switch! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///