comparison src/testdir/test_terminal2.vim @ 27098:8bb07c88ac27 v8.2.4078

patch 8.2.4078: terminal test for current directory not used on FreeBSD Commit: https://github.com/vim/vim/commit/ced2b38a560cc4f4ec983ed2cf4372ab62e1dbc1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 13 15:25:32 2022 +0000 patch 8.2.4078: terminal test for current directory not used on FreeBSD Problem: Terminal test for current directory not used on FreeBSD. Solution: Make it work on FreeBSD. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/9516) Add TermWait() inside Run_shell_in_terminal() as a generic solution.
author Bram Moolenaar <Bram@vim.org>
date Thu, 13 Jan 2022 16:30:04 +0100
parents c6a57c46271e
children 13b02c1ea0f7
comparison
equal deleted inserted replaced
27097:6612e555c1c0 27098:8bb07c88ac27
47 set termwinsize=0x0 47 set termwinsize=0x0
48 let buf = Run_shell_in_terminal({}) 48 let buf = Run_shell_in_terminal({})
49 let win = bufwinid(buf) 49 let win = bufwinid(buf)
50 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) 50 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
51 call StopShellInTerminal(buf) 51 call StopShellInTerminal(buf)
52 call TermWait(buf)
53 exe buf . 'bwipe' 52 exe buf . 'bwipe'
54 53
55 set termwinsize=7x0 54 set termwinsize=7x0
56 let buf = Run_shell_in_terminal({}) 55 let buf = Run_shell_in_terminal({})
57 let win = bufwinid(buf) 56 let win = bufwinid(buf)
58 call assert_equal([7, winwidth(win)], term_getsize(buf)) 57 call assert_equal([7, winwidth(win)], term_getsize(buf))
59 call StopShellInTerminal(buf) 58 call StopShellInTerminal(buf)
60 call TermWait(buf)
61 exe buf . 'bwipe' 59 exe buf . 'bwipe'
62 60
63 set termwinsize=0x33 61 set termwinsize=0x33
64 let buf = Run_shell_in_terminal({}) 62 let buf = Run_shell_in_terminal({})
65 let win = bufwinid(buf) 63 let win = bufwinid(buf)
66 call assert_equal([winheight(win), 33], term_getsize(buf)) 64 call assert_equal([winheight(win), 33], term_getsize(buf))
67 call StopShellInTerminal(buf) 65 call StopShellInTerminal(buf)
68 call TermWait(buf)
69 exe buf . 'bwipe' 66 exe buf . 'bwipe'
70 67
71 set termwinsize= 68 set termwinsize=
72 endfunc 69 endfunc
73 70
93 call assert_equal([10, 50], term_getsize(buf)) 90 call assert_equal([10, 50], term_getsize(buf))
94 call assert_equal(7, winheight(win)) 91 call assert_equal(7, winheight(win))
95 call assert_equal(30, winwidth(win)) 92 call assert_equal(30, winwidth(win))
96 93
97 call StopShellInTerminal(buf) 94 call StopShellInTerminal(buf)
98 call TermWait(buf)
99 exe buf . 'bwipe' 95 exe buf . 'bwipe'
100 96
101 set termwinsize=0*0 97 set termwinsize=0*0
102 let buf = Run_shell_in_terminal({}) 98 let buf = Run_shell_in_terminal({})
103 let win = bufwinid(buf) 99 let win = bufwinid(buf)
104 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf)) 100 call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
105 call StopShellInTerminal(buf) 101 call StopShellInTerminal(buf)
106 call TermWait(buf)
107 exe buf . 'bwipe' 102 exe buf . 'bwipe'
108 103
109 set termwinsize= 104 set termwinsize=
110 endfunc 105 endfunc
111 106
285 gui -f 280 gui -f
286 281
287 call assert_equal(1, winnr('$')) 282 call assert_equal(1, winnr('$'))
288 let buf = Run_shell_in_terminal({'term_finish': 'close'}) 283 let buf = Run_shell_in_terminal({'term_finish': 'close'})
289 call StopShellInTerminal(buf) 284 call StopShellInTerminal(buf)
290 call TermWait(buf)
291 285
292 " closing window wipes out the terminal buffer a with finished job 286 " closing window wipes out the terminal buffer a with finished job
293 call WaitForAssert({-> assert_equal(1, winnr('$'))}) 287 call WaitForAssert({-> assert_equal(1, winnr('$'))})
294 call assert_equal("", bufname(buf)) 288 call assert_equal("", bufname(buf))
295 289
570 call assert_fails('call term_gettty(buf, -1)', 'E475:') 564 call assert_fails('call term_gettty(buf, -1)', 'E475:')
571 565
572 call assert_equal('', term_gettty(buf + 1)) 566 call assert_equal('', term_gettty(buf + 1))
573 567
574 call StopShellInTerminal(buf) 568 call StopShellInTerminal(buf)
575 call TermWait(buf)
576 exe buf . 'bwipe' 569 exe buf . 'bwipe'
577 endfunc 570 endfunc
578 571
579 572
580 " vim: shiftwidth=2 sts=2 expandtab 573 " vim: shiftwidth=2 sts=2 expandtab