1461a7fcfSBram Moolenaar" Tests for :messages, :echomsg, :echoerr
2451f849fSBram Moolenaar
3494e9069SBram Moolenaarsource check.vim
4abc7c7fcSBram Moolenaarsource shared.vim
5c6d539b6SBram Moolenaarsource term_util.vim
6b42c0d54SBram Moolenaarsource view_util.vim
73d30af87SBram Moolenaarsource screendump.vim
8abc7c7fcSBram Moolenaar
949b2fb36SBram Moolenaarfunc Test_messages()
10451f849fSBram Moolenaar  let oldmore = &more
11451f849fSBram Moolenaar  try
12451f849fSBram Moolenaar    set nomore
13451f849fSBram Moolenaar
14451f849fSBram Moolenaar    let arr = map(range(10), '"hello" . v:val')
15451f849fSBram Moolenaar    for s in arr
16451f849fSBram Moolenaar      echomsg s | redraw
17451f849fSBram Moolenaar    endfor
18451f849fSBram Moolenaar
19bea1ede1SBram Moolenaar    " get last two messages
20451f849fSBram Moolenaar    redir => result
21451f849fSBram Moolenaar    2messages | redraw
22451f849fSBram Moolenaar    redir END
23bea1ede1SBram Moolenaar    let msg_list = split(result, "\n")
24bea1ede1SBram Moolenaar    call assert_equal(["hello8", "hello9"], msg_list)
25451f849fSBram Moolenaar
26451f849fSBram Moolenaar    " clear messages without last one
27451f849fSBram Moolenaar    1messages clear
2849b2fb36SBram Moolenaar    let msg_list = GetMessages()
29bea1ede1SBram Moolenaar    call assert_equal(['hello9'], msg_list)
30451f849fSBram Moolenaar
31451f849fSBram Moolenaar    " clear all messages
32451f849fSBram Moolenaar    messages clear
3349b2fb36SBram Moolenaar    let msg_list = GetMessages()
3449b2fb36SBram Moolenaar    call assert_equal([], msg_list)
35451f849fSBram Moolenaar  finally
36451f849fSBram Moolenaar    let &more = oldmore
37451f849fSBram Moolenaar  endtry
38067297e1SBram Moolenaar
39067297e1SBram Moolenaar  call assert_fails('message 1', 'E474:')
4049b2fb36SBram Moolenaarendfunc
412abad54cSBram Moolenaar
42f52f9ea8SBram Moolenaar" Patch 7.4.1696 defined the "clearmode()" function for clearing the mode
432abad54cSBram Moolenaar" indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked.  Message
442abad54cSBram Moolenaar" output could then be disturbed when 'cmdheight' was greater than one.
452abad54cSBram Moolenaar" This test ensures that the bugfix for this issue remains in place.
461e115360SBram Moolenaarfunc Test_stopinsert_does_not_break_message_output()
472abad54cSBram Moolenaar  set cmdheight=2
482abad54cSBram Moolenaar  redraw!
492abad54cSBram Moolenaar
502abad54cSBram Moolenaar  stopinsert | echo 'test echo'
512abad54cSBram Moolenaar  call assert_equal(116, screenchar(&lines - 1, 1))
522abad54cSBram Moolenaar  call assert_equal(32, screenchar(&lines, 1))
532abad54cSBram Moolenaar  redraw!
542abad54cSBram Moolenaar
552abad54cSBram Moolenaar  stopinsert | echomsg 'test echomsg'
562abad54cSBram Moolenaar  call assert_equal(116, screenchar(&lines - 1, 1))
572abad54cSBram Moolenaar  call assert_equal(32, screenchar(&lines, 1))
582abad54cSBram Moolenaar  redraw!
592abad54cSBram Moolenaar
602abad54cSBram Moolenaar  set cmdheight&
611e115360SBram Moolenaarendfunc
62b513d307SBram Moolenaar
63b513d307SBram Moolenaarfunc Test_message_completion()
64b513d307SBram Moolenaar  call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx')
65b513d307SBram Moolenaar  call assert_equal('"message clear', @:)
66b513d307SBram Moolenaarendfunc
67461a7fcfSBram Moolenaar
68461a7fcfSBram Moolenaarfunc Test_echomsg()
69461a7fcfSBram Moolenaar  call assert_equal("\nhello", execute(':echomsg "hello"'))
70461a7fcfSBram Moolenaar  call assert_equal("\n", execute(':echomsg ""'))
71461a7fcfSBram Moolenaar  call assert_equal("\n12345", execute(':echomsg 12345'))
72461a7fcfSBram Moolenaar  call assert_equal("\n[]", execute(':echomsg []'))
73461a7fcfSBram Moolenaar  call assert_equal("\n[1, 2, 3]", execute(':echomsg [1, 2, 3]'))
74db950e4cSBram Moolenaar  call assert_equal("\n[1, 2, []]", execute(':echomsg [1, 2, test_null_list()]'))
75461a7fcfSBram Moolenaar  call assert_equal("\n{}", execute(':echomsg {}'))
76461a7fcfSBram Moolenaar  call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}'))
77461a7fcfSBram Moolenaar  if has('float')
78461a7fcfSBram Moolenaar    call assert_equal("\n1.23", execute(':echomsg 1.23'))
79461a7fcfSBram Moolenaar  endif
80461a7fcfSBram Moolenaar  call assert_match("function('<lambda>\\d*')", execute(':echomsg {-> 1234}'))
81461a7fcfSBram Moolenaarendfunc
82461a7fcfSBram Moolenaar
83461a7fcfSBram Moolenaarfunc Test_echoerr()
84461a7fcfSBram Moolenaar  call test_ignore_error('IgNoRe')
85461a7fcfSBram Moolenaar  call assert_equal("\nIgNoRe hello", execute(':echoerr "IgNoRe hello"'))
86461a7fcfSBram Moolenaar  call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"'))
87461a7fcfSBram Moolenaar  call assert_equal("\n[1, 2, 'IgNoRe']", execute(':echoerr [1, 2, "IgNoRe"]'))
88461a7fcfSBram Moolenaar  call assert_equal("\n{'IgNoRe': 2, 'a': 1}", execute(':echoerr {"a": 1, "IgNoRe": 2}'))
89461a7fcfSBram Moolenaar  if has('float')
90461a7fcfSBram Moolenaar    call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"'))
91461a7fcfSBram Moolenaar  endif
92ce90e36fSBram Moolenaar  eval '<lambda>'->test_ignore_error()
93461a7fcfSBram Moolenaar  call assert_match("function('<lambda>\\d*')", execute(':echoerr {-> 1234}'))
94461a7fcfSBram Moolenaar  call test_ignore_error('RESET')
95461a7fcfSBram Moolenaarendfunc
96abc7c7fcSBram Moolenaar
97abc7c7fcSBram Moolenaarfunc Test_mode_message_at_leaving_insert_by_ctrl_c()
986d91bcb4SBram Moolenaar  CheckFeature terminal
996d91bcb4SBram Moolenaar  CheckNotGui
100abc7c7fcSBram Moolenaar
101abc7c7fcSBram Moolenaar  " Set custom statusline built by user-defined function.
102abc7c7fcSBram Moolenaar  let testfile = 'Xtest.vim'
103e7eb9270SBram Moolenaar  let lines =<< trim END
104e7eb9270SBram Moolenaar        func StatusLine() abort
105e7eb9270SBram Moolenaar          return ""
106e7eb9270SBram Moolenaar        endfunc
107e7eb9270SBram Moolenaar        set statusline=%!StatusLine()
108e7eb9270SBram Moolenaar        set laststatus=2
109e7eb9270SBram Moolenaar  END
110e7eb9270SBram Moolenaar  call writefile(lines, testfile)
111abc7c7fcSBram Moolenaar
112abc7c7fcSBram Moolenaar  let rows = 10
113abc7c7fcSBram Moolenaar  let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
1146a2c5a7dSBram Moolenaar  call TermWait(buf, 100)
115abc7c7fcSBram Moolenaar  call assert_equal('run', job_status(term_getjob(buf)))
116abc7c7fcSBram Moolenaar
117abc7c7fcSBram Moolenaar  call term_sendkeys(buf, "i")
118abc7c7fcSBram Moolenaar  call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))})
119abc7c7fcSBram Moolenaar  call term_sendkeys(buf, "\<C-C>")
120abc7c7fcSBram Moolenaar  call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))})
121abc7c7fcSBram Moolenaar
122abc7c7fcSBram Moolenaar  call term_sendkeys(buf, ":qall!\<CR>")
123abc7c7fcSBram Moolenaar  call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
124abc7c7fcSBram Moolenaar  exe buf . 'bwipe!'
125abc7c7fcSBram Moolenaar  call delete(testfile)
126abc7c7fcSBram Moolenaarendfunc
1274c25bd78SBram Moolenaar
1284c25bd78SBram Moolenaarfunc Test_mode_message_at_leaving_insert_with_esc_mapped()
1296d91bcb4SBram Moolenaar  CheckFeature terminal
1306d91bcb4SBram Moolenaar  CheckNotGui
1314c25bd78SBram Moolenaar
1324c25bd78SBram Moolenaar  " Set custom statusline built by user-defined function.
1334c25bd78SBram Moolenaar  let testfile = 'Xtest.vim'
134e7eb9270SBram Moolenaar  let lines =<< trim END
135e7eb9270SBram Moolenaar        set laststatus=2
136e7eb9270SBram Moolenaar        inoremap <Esc> <Esc>00
137e7eb9270SBram Moolenaar  END
138e7eb9270SBram Moolenaar  call writefile(lines, testfile)
1394c25bd78SBram Moolenaar
1404c25bd78SBram Moolenaar  let rows = 10
1414c25bd78SBram Moolenaar  let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
1426a2c5a7dSBram Moolenaar  call WaitForAssert({-> assert_match('0,0-1\s*All$', term_getline(buf, rows - 1))})
1434c25bd78SBram Moolenaar  call assert_equal('run', job_status(term_getjob(buf)))
1444c25bd78SBram Moolenaar
1454c25bd78SBram Moolenaar  call term_sendkeys(buf, "i")
1464c25bd78SBram Moolenaar  call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))})
1474c25bd78SBram Moolenaar  call term_sendkeys(buf, "\<Esc>")
1484c25bd78SBram Moolenaar  call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))})
1494c25bd78SBram Moolenaar
1504c25bd78SBram Moolenaar  call term_sendkeys(buf, ":qall!\<CR>")
1514c25bd78SBram Moolenaar  call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
1524c25bd78SBram Moolenaar  exe buf . 'bwipe!'
1534c25bd78SBram Moolenaar  call delete(testfile)
1544c25bd78SBram Moolenaarendfunc
15537f4cbd4SBram Moolenaar
15637f4cbd4SBram Moolenaarfunc Test_echospace()
15737f4cbd4SBram Moolenaar  set noruler noshowcmd laststatus=1
15837f4cbd4SBram Moolenaar  call assert_equal(&columns - 1, v:echospace)
15937f4cbd4SBram Moolenaar  split
16037f4cbd4SBram Moolenaar  call assert_equal(&columns - 1, v:echospace)
16137f4cbd4SBram Moolenaar  set ruler
16237f4cbd4SBram Moolenaar  call assert_equal(&columns - 1, v:echospace)
16337f4cbd4SBram Moolenaar  close
16437f4cbd4SBram Moolenaar  call assert_equal(&columns - 19, v:echospace)
16537f4cbd4SBram Moolenaar  set showcmd noruler
16637f4cbd4SBram Moolenaar  call assert_equal(&columns - 12, v:echospace)
16737f4cbd4SBram Moolenaar  set showcmd ruler
16837f4cbd4SBram Moolenaar  call assert_equal(&columns - 29, v:echospace)
16937f4cbd4SBram Moolenaar
17037f4cbd4SBram Moolenaar  set ruler& showcmd&
17137f4cbd4SBram Moolenaarendfunc
172c6d539b6SBram Moolenaar
173c6d539b6SBram Moolenaar" Test more-prompt (see :help more-prompt).
174c6d539b6SBram Moolenaarfunc Test_message_more()
175494e9069SBram Moolenaar  CheckRunVimInTerminal
176c6d539b6SBram Moolenaar  let buf = RunVimInTerminal('', {'rows': 6})
177c6d539b6SBram Moolenaar  call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
178c6d539b6SBram Moolenaar
179c6d539b6SBram Moolenaar  call term_sendkeys(buf, ":%p#\n")
180c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  5 5', term_getline(buf, 5))})
181c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
182c6d539b6SBram Moolenaar
183c6d539b6SBram Moolenaar  call term_sendkeys(buf, '?')
184c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  5 5', term_getline(buf, 5))})
185c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit ', term_getline(buf, 6))})
186c6d539b6SBram Moolenaar
187c6d539b6SBram Moolenaar  " Down a line with j, <CR>, <NL> or <Down>.
188c6d539b6SBram Moolenaar  call term_sendkeys(buf, "j")
189c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  6 6', term_getline(buf, 5))})
190c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
191c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<NL>")
192c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  7 7', term_getline(buf, 5))})
193c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<CR>")
194c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  8 8', term_getline(buf, 5))})
195c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<Down>")
196c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  9 9', term_getline(buf, 5))})
197c6d539b6SBram Moolenaar
198c6d539b6SBram Moolenaar  " Down a screen with <Space>, f, or <PageDown>.
199c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'f')
200c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 14 14', term_getline(buf, 5))})
201c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
202c6d539b6SBram Moolenaar  call term_sendkeys(buf, ' ')
203c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 19 19', term_getline(buf, 5))})
204c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<PageDown>")
205c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 24 24', term_getline(buf, 5))})
206c6d539b6SBram Moolenaar
207c6d539b6SBram Moolenaar  " Down a page (half a screen) with d.
208c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'd')
209c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 27 27', term_getline(buf, 5))})
210c6d539b6SBram Moolenaar
211c6d539b6SBram Moolenaar  " Down all the way with 'G'.
212c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'G')
213c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
214c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
215c6d539b6SBram Moolenaar
216c6d539b6SBram Moolenaar  " Up a line k, <BS> or <Up>.
217c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'k')
218c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 99 99', term_getline(buf, 5))})
219c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<BS>")
220c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 98 98', term_getline(buf, 5))})
221c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<Up>")
222c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 97 97', term_getline(buf, 5))})
223c6d539b6SBram Moolenaar
224c6d539b6SBram Moolenaar  " Up a screen with b or <PageUp>.
225c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'b')
226c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 92 92', term_getline(buf, 5))})
227c6d539b6SBram Moolenaar  call term_sendkeys(buf, "\<PageUp>")
228c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 87 87', term_getline(buf, 5))})
229c6d539b6SBram Moolenaar
230c6d539b6SBram Moolenaar  " Up a page (half a screen) with u.
231c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'u')
232c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal(' 84 84', term_getline(buf, 5))})
233c6d539b6SBram Moolenaar
234c6d539b6SBram Moolenaar  " Up all the way with 'g'.
235c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'g')
236c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  5 5', term_getline(buf, 5))})
237c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
238c6d539b6SBram Moolenaar
239c6d539b6SBram Moolenaar  " All the way down. Pressing f should do nothing but pressing
240c6d539b6SBram Moolenaar  " space should end the more prompt.
241c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'G')
242c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
243c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
244c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'f')
245c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
246c6d539b6SBram Moolenaar  call term_sendkeys(buf, ' ')
247c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
248c6d539b6SBram Moolenaar
249c6d539b6SBram Moolenaar  " Pressing g< shows the previous command output.
250c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'g<')
251c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
252c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
253c6d539b6SBram Moolenaar
254c6d539b6SBram Moolenaar  call term_sendkeys(buf, ":%p#\n")
255c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('  5 5', term_getline(buf, 5))})
256c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
257c6d539b6SBram Moolenaar
258c6d539b6SBram Moolenaar  " Stop command output with q, <Esc> or CTRL-C.
259c6d539b6SBram Moolenaar  call term_sendkeys(buf, 'q')
260c6d539b6SBram Moolenaar  call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
261c6d539b6SBram Moolenaar
262*f4fcedc5SBram Moolenaar  " Execute a : command from the more prompt
263*f4fcedc5SBram Moolenaar  call term_sendkeys(buf, ":%p#\n")
264*f4fcedc5SBram Moolenaar  call term_wait(buf)
265*f4fcedc5SBram Moolenaar  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
266*f4fcedc5SBram Moolenaar  call term_sendkeys(buf, ":")
267*f4fcedc5SBram Moolenaar  call term_wait(buf)
268*f4fcedc5SBram Moolenaar  call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))})
269*f4fcedc5SBram Moolenaar  call term_sendkeys(buf, "echo 'Hello'\n")
270*f4fcedc5SBram Moolenaar  call term_wait(buf)
271*f4fcedc5SBram Moolenaar  call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))})
272*f4fcedc5SBram Moolenaar
27343c60edaSBram Moolenaar  call StopVimInTerminal(buf)
27443c60edaSBram Moolenaarendfunc
27543c60edaSBram Moolenaar
27643c60edaSBram Moolenaarfunc Test_ask_yesno()
277494e9069SBram Moolenaar  CheckRunVimInTerminal
27843c60edaSBram Moolenaar  let buf = RunVimInTerminal('', {'rows': 6})
27943c60edaSBram Moolenaar  call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
28043c60edaSBram Moolenaar
28143c60edaSBram Moolenaar  call term_sendkeys(buf, ":2,1s/^/n/\n")
28243c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
28343c60edaSBram Moolenaar  call term_sendkeys(buf, "n")
28443c60edaSBram Moolenaar  call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
28543c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
28643c60edaSBram Moolenaar
28743c60edaSBram Moolenaar  call term_sendkeys(buf, ":2,1s/^/Esc/\n")
28843c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
28943c60edaSBram Moolenaar  call term_sendkeys(buf, "\<Esc>")
29043c60edaSBram Moolenaar  call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
29143c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
29243c60edaSBram Moolenaar
29343c60edaSBram Moolenaar  call term_sendkeys(buf, ":2,1s/^/y/\n")
29443c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
29543c60edaSBram Moolenaar  call term_sendkeys(buf, "y")
29643c60edaSBram Moolenaar  call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?y *2,1 *All$', term_getline(buf, 6))})
29743c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
29843c60edaSBram Moolenaar  call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
29943c60edaSBram Moolenaar
300c6d539b6SBram Moolenaar  call StopVimInTerminal(buf)
301c6d539b6SBram Moolenaarendfunc
3029db2afe4SBram Moolenaar
3039db2afe4SBram Moolenaarfunc Test_null()
3049db2afe4SBram Moolenaar  echom test_null_list()
3059db2afe4SBram Moolenaar  echom test_null_dict()
3069db2afe4SBram Moolenaar  echom test_null_blob()
3079db2afe4SBram Moolenaar  echom test_null_string()
30892b83ccfSBram Moolenaar  echom test_null_function()
3099db2afe4SBram Moolenaar  echom test_null_partial()
310da292b07SBram Moolenaar  if has('job')
311da292b07SBram Moolenaar    echom test_null_job()
312da292b07SBram Moolenaar    echom test_null_channel()
313da292b07SBram Moolenaar  endif
3149db2afe4SBram Moolenaarendfunc
31592b83ccfSBram Moolenaar
316b42c0d54SBram Moolenaarfunc Test_mapping_at_hit_return_prompt()
317b42c0d54SBram Moolenaar  nnoremap <C-B> :echo "hit ctrl-b"<CR>
318b42c0d54SBram Moolenaar  call feedkeys(":ls\<CR>", "xt")
319fccd93f0SBram Moolenaar  call feedkeys("\<*C-B>", "xt")
320b42c0d54SBram Moolenaar  call assert_match('hit ctrl-b', Screenline(&lines - 1))
321b42c0d54SBram Moolenaar  nunmap <C-B>
322b42c0d54SBram Moolenaarendfunc
323b42c0d54SBram Moolenaar
3243d30af87SBram Moolenaarfunc Test_quit_long_message()
3253d30af87SBram Moolenaar  CheckScreendump
3263d30af87SBram Moolenaar
3273d30af87SBram Moolenaar  let content =<< trim END
3283d30af87SBram Moolenaar    echom range(9999)->join("\x01")
3293d30af87SBram Moolenaar  END
3303d30af87SBram Moolenaar  call writefile(content, 'Xtest_quit_message')
3313d30af87SBram Moolenaar  let buf = RunVimInTerminal('-S Xtest_quit_message', #{rows: 6})
3323d30af87SBram Moolenaar  call term_sendkeys(buf, "q")
3333d30af87SBram Moolenaar  call VerifyScreenDump(buf, 'Test_quit_long_message', {})
3343d30af87SBram Moolenaar
3353d30af87SBram Moolenaar  " clean up
3363d30af87SBram Moolenaar  call StopVimInTerminal(buf)
337ac665c24SBram Moolenaar  call delete('Xtest_quit_message')
3383d30af87SBram Moolenaarendfunc
3393d30af87SBram Moolenaar
34092b83ccfSBram Moolenaar" vim: shiftwidth=2 sts=2 expandtab
341