" Wait for all the pending updates to terminal to complete
call TermWait(a:buf)
+ " Wait for the terminal to end.
call WaitForAssert({-> assert_equal("finished", term_getstatus(a:buf))})
- only!
+
+ " If the buffer still exists forcefully wipe it.
+ if bufexists(a:buf)
+ exe a:buf .. 'bwipe!'
+ endif
endfunc
" Open a terminal with a shell, assign the job to g:job and return the buffer
call term_sendkeys(buf, ":call Getout()\n")
call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
call term_sendkeys(buf, "y")
+ call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
+ call term_sendkeys(buf, "\<CR>")
+ call TermWait(buf)
call StopVimInTerminal(buf)
call assert_equal(['changed'], readfile('Xfile'))
call delete('Xfile')
+ call delete('.Xfile.swp') " in case Vim was killed
call delete('Xconfirmscript')
endfunc