xref: /vim-8.2.3635/src/testdir/test_startup.vim (revision dabfde04)
1" Tests for startup.
2
3source shared.vim
4source screendump.vim
5
6" Check that loading startup.vim works.
7func Test_startup_script()
8  set compatible
9  source $VIMRUNTIME/defaults.vim
10
11  call assert_equal(0, &compatible)
12endfunc
13
14" Verify the order in which plugins are loaded:
15" 1. plugins in non-after directories
16" 2. packages
17" 3. plugins in after directories
18func Test_after_comes_later()
19  if !has('packages')
20    return
21  endif
22  let before = [
23	\ 'set nocp viminfo+=nviminfo',
24	\ 'set guioptions+=M',
25	\ 'let $HOME = "/does/not/exist"',
26	\ 'set loadplugins',
27	\ 'set rtp=Xhere,Xafter,Xanother',
28	\ 'set packpath=Xhere,Xafter',
29	\ 'set nomore',
30	\ 'let g:sequence = ""',
31	\ ]
32  let after = [
33	\ 'redir! > Xtestout',
34	\ 'scriptnames',
35	\ 'redir END',
36	\ 'redir! > Xsequence',
37	\ 'echo g:sequence',
38	\ 'redir END',
39	\ 'quit',
40	\ ]
41  call mkdir('Xhere/plugin', 'p')
42  call writefile(['let g:sequence .= "here "'], 'Xhere/plugin/here.vim')
43  call mkdir('Xanother/plugin', 'p')
44  call writefile(['let g:sequence .= "another "'], 'Xanother/plugin/another.vim')
45  call mkdir('Xhere/pack/foo/start/foobar/plugin', 'p')
46  call writefile(['let g:sequence .= "pack "'], 'Xhere/pack/foo/start/foobar/plugin/foo.vim')
47
48  call mkdir('Xafter/plugin', 'p')
49  call writefile(['let g:sequence .= "after "'], 'Xafter/plugin/later.vim')
50
51  if RunVim(before, after, '')
52
53    let lines = readfile('Xtestout')
54    let expected = ['Xbefore.vim', 'here.vim', 'another.vim', 'foo.vim', 'later.vim', 'Xafter.vim']
55    let found = []
56    for line in lines
57      for one in expected
58	if line =~ one
59	  call add(found, one)
60	endif
61      endfor
62    endfor
63    call assert_equal(expected, found)
64  endif
65
66  call assert_equal('here another pack after', substitute(join(readfile('Xsequence', 1), ''), '\s\+$', '', ''))
67
68  call delete('Xtestout')
69  call delete('Xsequence')
70  call delete('Xhere', 'rf')
71  call delete('Xanother', 'rf')
72  call delete('Xafter', 'rf')
73endfunc
74
75func Test_pack_in_rtp_when_plugins_run()
76  if !has('packages')
77    return
78  endif
79  let before = [
80	\ 'set nocp viminfo+=nviminfo',
81	\ 'set guioptions+=M',
82	\ 'let $HOME = "/does/not/exist"',
83	\ 'set loadplugins',
84	\ 'set rtp=Xhere',
85	\ 'set packpath=Xhere',
86	\ 'set nomore',
87	\ ]
88  let after = [
89	\ 'quit',
90	\ ]
91  call mkdir('Xhere/plugin', 'p')
92  call writefile(['redir! > Xtestout', 'silent set runtimepath?', 'silent! call foo#Trigger()', 'redir END'], 'Xhere/plugin/here.vim')
93  call mkdir('Xhere/pack/foo/start/foobar/autoload', 'p')
94  call writefile(['function! foo#Trigger()', 'echo "autoloaded foo"', 'endfunction'], 'Xhere/pack/foo/start/foobar/autoload/foo.vim')
95
96  if RunVim(before, after, '')
97
98    let lines = filter(readfile('Xtestout'), '!empty(v:val)')
99    call assert_match('Xhere[/\\]pack[/\\]foo[/\\]start[/\\]foobar', get(lines, 0))
100    call assert_match('autoloaded foo', get(lines, 1))
101  endif
102
103  call delete('Xtestout')
104  call delete('Xhere', 'rf')
105endfunc
106
107func Test_help_arg()
108  if !has('unix') && has('gui')
109    " this doesn't work with gvim on MS-Windows
110    return
111  endif
112  if RunVim([], [], '--help >Xtestout')
113    let lines = readfile('Xtestout')
114    call assert_true(len(lines) > 20)
115    call assert_match('Vi IMproved', lines[0])
116
117    " check if  couple of lines are there
118    let found = []
119    for line in lines
120      if line =~ '-R.*Readonly mode'
121	call add(found, 'Readonly mode')
122      endif
123      " Watch out for a second --version line in the Gnome version.
124      if line =~ '--version.*Print version information and exit'
125	call add(found, "--version")
126      endif
127    endfor
128    call assert_equal(['Readonly mode', '--version'], found)
129  endif
130  call delete('Xtestout')
131endfunc
132
133func Test_compatible_args()
134  let after = [
135	\ 'call writefile([string(&compatible)], "Xtestout")',
136	\ 'set viminfo+=nviminfo',
137	\ 'quit',
138	\ ]
139  if RunVim([], after, '-C')
140    let lines = readfile('Xtestout')
141    call assert_equal('1', lines[0])
142  endif
143
144  if RunVim([], after, '-N')
145    let lines = readfile('Xtestout')
146    call assert_equal('0', lines[0])
147  endif
148
149  call delete('Xtestout')
150endfunc
151
152" Test the -o[N] and -O[N] arguments to open N windows split
153" horizontally or vertically.
154func Test_o_arg()
155  let after = [
156	\ 'call writefile([winnr("$"),
157	\		   winheight(1), winheight(2), &lines,
158	\		   winwidth(1), winwidth(2), &columns,
159	\		   bufname(winbufnr(1)), bufname(winbufnr(2))],
160	\		   "Xtestout")',
161	\ 'qall',
162	\ ]
163  if RunVim([], after, '-o2')
164    " Open 2 windows split horizontally. Expect:
165    " - 2 windows
166    " - both windows should have the same or almost the same height
167    " - sum of both windows height (+ 3 for both statusline and Ex command)
168    "   should be equal to the number of lines
169    " - both windows should have the same width which should be equal to the
170    "   number of columns
171    " - buffer of both windows should have no name
172    let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
173    call assert_equal('2', wn)
174    call assert_inrange(0, 1, wh1 - wh2)
175    call assert_equal(string(wh1 + wh2 + 3), ln)
176    call assert_equal(ww1, ww2)
177    call assert_equal(ww1, cn)
178    call assert_equal('', bn1)
179    call assert_equal('', bn2)
180  endif
181
182  if RunVim([], after, '-o foo bar')
183    " Same expectations as for -o2 but buffer names should be foo and bar
184    let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
185    call assert_equal('2', wn)
186    call assert_inrange(0, 1, wh1 - wh2)
187    call assert_equal(string(wh1 + wh2 + 3), ln)
188    call assert_equal(ww1, ww2)
189    call assert_equal(ww1, cn)
190    call assert_equal('foo', bn1)
191    call assert_equal('bar', bn2)
192  endif
193
194  if RunVim([], after, '-O2')
195    " Open 2 windows split vertically. Expect:
196    " - 2 windows
197    " - both windows should have the same or almost the same width
198    " - sum of both windows width (+ 1 for the separator) should be equal to
199    "   the number of columns
200    " - both windows should have the same height
201    " - window height (+ 2 for the statusline and Ex command) should be equal
202    "   to the number of lines
203    " - buffer of both windows should have no name
204    let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
205    call assert_equal('2', wn)
206    call assert_inrange(0, 1, ww1 - ww2)
207    call assert_equal(string(ww1 + ww2 + 1), cn)
208    call assert_equal(wh1, wh2)
209    call assert_equal(string(wh1 + 2), ln)
210    call assert_equal('', bn1)
211    call assert_equal('', bn2)
212  endif
213
214  if RunVim([], after, '-O foo bar')
215    " Same expectations as for -O2 but buffer names should be foo and bar
216    let [wn, wh1, wh2, ln, ww1, ww2, cn, bn1, bn2] = readfile('Xtestout')
217    call assert_equal('2', wn)
218    call assert_inrange(0, 1, ww1 - ww2)
219    call assert_equal(string(ww1 + ww2 + 1), cn)
220    call assert_equal(wh1, wh2)
221    call assert_equal(string(wh1 + 2), ln)
222    call assert_equal('foo', bn1)
223    call assert_equal('bar', bn2)
224  endif
225
226  call delete('Xtestout')
227endfunc
228
229" Test the -p[N] argument to open N tabpages.
230func Test_p_arg()
231  let after = [
232	\ 'call writefile(split(execute("tabs"), "\n"), "Xtestout")',
233	\ 'qall',
234	\ ]
235  if RunVim([], after, '-p2')
236    let lines = readfile('Xtestout')
237    call assert_equal(4, len(lines))
238    call assert_equal('Tab page 1',    lines[0])
239    call assert_equal('>   [No Name]', lines[1])
240    call assert_equal('Tab page 2',    lines[2])
241    call assert_equal('    [No Name]', lines[3])
242  endif
243
244  if RunVim([], after, '-p foo bar')
245    let lines = readfile('Xtestout')
246    call assert_equal(4, len(lines))
247    call assert_equal('Tab page 1', lines[0])
248    call assert_equal('>   foo',    lines[1])
249    call assert_equal('Tab page 2', lines[2])
250    call assert_equal('    bar',    lines[3])
251  endif
252
253  call delete('Xtestout')
254endfunc
255
256" Test the -V[N] argument to set the 'verbose' option to [N]
257func Test_V_arg()
258  if has('gui_running')
259    " Can't catch the output of gvim.
260    return
261  endif
262  let out = system(GetVimCommand() . ' --clean -es -X -V0 -c "set verbose?" -cq')
263  call assert_equal("  verbose=0\n", out)
264
265  let out = system(GetVimCommand() . ' --clean -es -X -V2 -c "set verbose?" -cq')
266  call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nSearching for \"filetype\.vim\".*\n", out)
267  call assert_match("  verbose=2\n", out)
268
269  let out = system(GetVimCommand() . ' --clean -es -X -V15 -c "set verbose?" -cq')
270   call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..*  verbose=15\n", out)
271endfunc
272
273" Test the '-q [errorfile]' argument.
274func Test_q_arg()
275  let source_file = has('win32') ? '..\memfile.c' : '../memfile.c'
276  let after = [
277	\ 'call writefile([&errorfile, string(getpos("."))], "Xtestout")',
278	\ 'copen',
279	\ 'w >> Xtestout',
280	\ 'qall'
281	\ ]
282
283  " Test with default argument '-q'.
284  call assert_equal('errors.err', &errorfile)
285  call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'errors.err')
286  if RunVim([], after, '-q')
287    let lines = readfile('Xtestout')
288    call assert_equal(['errors.err',
289	\              '[0, 1482, 5, 0]',
290	\              source_file . "|1482 col 5| error: expected ';' before '}' token"],
291	\             lines)
292  endif
293  call delete('Xtestout')
294  call delete('errors.err')
295
296  " Test with explicit argument '-q Xerrors' (with space).
297  call writefile(["../memfile.c:1482:5: error: expected ';' before '}' token"], 'Xerrors')
298  if RunVim([], after, '-q Xerrors')
299    let lines = readfile('Xtestout')
300    call assert_equal(['Xerrors',
301	\              '[0, 1482, 5, 0]',
302	\              source_file . "|1482 col 5| error: expected ';' before '}' token"],
303	\             lines)
304  endif
305  call delete('Xtestout')
306
307  " Test with explicit argument '-qXerrors' (without space).
308  if RunVim([], after, '-qXerrors')
309    let lines = readfile('Xtestout')
310    call assert_equal(['Xerrors',
311	\              '[0, 1482, 5, 0]',
312	\              source_file . "|1482 col 5| error: expected ';' before '}' token"],
313	\             lines)
314  endif
315
316  call delete('Xtestout')
317  call delete('Xerrors')
318endfunc
319
320" Test the -V[N]{filename} argument to set the 'verbose' option to N
321" and set 'verbosefile' to filename.
322func Test_V_file_arg()
323  if RunVim([], [], ' --clean -V2Xverbosefile -c "set verbose? verbosefile?" -cq')
324    let out = join(readfile('Xverbosefile'), "\n")
325    call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\n", out)
326    call assert_match("\n  verbose=2\n", out)
327    call assert_match("\n  verbosefile=Xverbosefile", out)
328  endif
329
330  call delete('Xverbosefile')
331endfunc
332
333" Test the -m, -M and -R arguments:
334" -m resets 'write'
335" -M resets 'modifiable' and 'write'
336" -R sets 'readonly'
337func Test_m_M_R()
338  let after = [
339	\ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")',
340	\ 'qall',
341	\ ]
342  if RunVim([], after, '')
343    let lines = readfile('Xtestout')
344    call assert_equal(['1', '1', '0', '200'], lines)
345  endif
346  if RunVim([], after, '-m')
347    let lines = readfile('Xtestout')
348    call assert_equal(['0', '1', '0', '200'], lines)
349  endif
350  if RunVim([], after, '-M')
351    let lines = readfile('Xtestout')
352    call assert_equal(['0', '0', '0', '200'], lines)
353  endif
354  if RunVim([], after, '-R')
355    let lines = readfile('Xtestout')
356    call assert_equal(['1', '1', '1', '10000'], lines)
357  endif
358
359  call delete('Xtestout')
360endfunc
361
362" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
363func Test_A_F_H_arg()
364  let after = [
365	\ 'call writefile([&rightleft, &arabic, &fkmap, &hkmap], "Xtestout")',
366	\ 'qall',
367	\ ]
368  " Use silent Ex mode to avoid the hit-Enter prompt for the warning that
369  " 'encoding' is not utf-8.
370  if has('arabic') && &encoding == 'utf-8' && RunVim([], after, '-e -s -A')
371    let lines = readfile('Xtestout')
372    call assert_equal(['1', '1', '0', '0'], lines)
373  endif
374
375  if has('farsi') && RunVim([], after, '-F')
376    let lines = readfile('Xtestout')
377    call assert_equal(['1', '0', '1', '0'], lines)
378  endif
379
380  if has('rightleft') && RunVim([], after, '-H')
381    let lines = readfile('Xtestout')
382    call assert_equal(['1', '0', '0', '1'], lines)
383  endif
384
385  call delete('Xtestout')
386endfunc
387
388func Test_invalid_args()
389  if !has('unix') || has('gui_running')
390    " can't get output of Vim.
391    return
392  endif
393
394  for opt in ['-Y', '--does-not-exist']
395    let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
396    call assert_equal(1, v:shell_error)
397    call assert_match('^VIM - Vi IMproved .* (.*)$',              out[0])
398    call assert_equal('Unknown option argument: "' .. opt .. '"', out[1])
399    call assert_equal('More info with: "vim -h"',                 out[2])
400  endfor
401
402  for opt in ['-c', '-i', '-s', '-t', '-T', '-u', '-U', '-w', '-W', '--cmd', '--startuptime']
403    let out = split(system(GetVimCommand() .. ' '  .. opt), "\n")
404    call assert_equal(1, v:shell_error)
405    call assert_match('^VIM - Vi IMproved .* (.*)$',             out[0])
406    call assert_equal('Argument missing after: "' .. opt .. '"', out[1])
407    call assert_equal('More info with: "vim -h"',                out[2])
408  endfor
409
410  if has('clientserver')
411    for opt in ['--remote', '--remote-send', '--remote-silent', '--remote-expr',
412          \     '--remote-tab', '--remote-tab-wait',
413          \     '--remote-tab-wait-silent', '--remote-tab-silent',
414          \     '--remote-wait', '--remote-wait-silent',
415          \     '--servername',
416          \    ]
417      let out = split(system(GetVimCommand() .. ' '  .. opt), "\n")
418      call assert_equal(1, v:shell_error)
419      call assert_match('^VIM - Vi IMproved .* (.*)$',             out[0])
420      call assert_equal('Argument missing after: "' .. opt .. '"', out[1])
421      call assert_equal('More info with: "vim -h"',                out[2])
422    endfor
423  endif
424
425  if has('gui_gtk')
426    let out = split(system(GetVimCommand() .. ' --display'), "\n")
427    call assert_equal(1, v:shell_error)
428    call assert_match('^VIM - Vi IMproved .* (.*)$',         out[0])
429    call assert_equal('Argument missing after: "--display"', out[1])
430    call assert_equal('More info with: "vim -h"',            out[2])
431  endif
432
433  if has('xterm_clipboard')
434    let out = split(system(GetVimCommand() .. ' -display'), "\n")
435    call assert_equal(1, v:shell_error)
436    call assert_match('^VIM - Vi IMproved .* (.*)$',         out[0])
437    call assert_equal('Argument missing after: "-display"', out[1])
438    call assert_equal('More info with: "vim -h"',            out[2])
439  endif
440
441  let out = split(system(GetVimCommand() .. ' -ix'), "\n")
442  call assert_equal(1, v:shell_error)
443  call assert_match('^VIM - Vi IMproved .* (.*)$',          out[0])
444  call assert_equal('Garbage after option argument: "-ix"', out[1])
445  call assert_equal('More info with: "vim -h"',             out[2])
446
447  let out = split(system(GetVimCommand() .. ' - xxx'), "\n")
448  call assert_equal(1, v:shell_error)
449  call assert_match('^VIM - Vi IMproved .* (.*)$',    out[0])
450  call assert_equal('Too many edit arguments: "xxx"', out[1])
451  call assert_equal('More info with: "vim -h"',       out[2])
452
453  " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
454  for opt in ['-t', '-q']
455    let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
456    call assert_equal(1, v:shell_error)
457    call assert_match('^VIM - Vi IMproved .* (.*)$',              out[0])
458    call assert_equal('Too many edit arguments: "' .. opt .. '"', out[1])
459    call assert_equal('More info with: "vim -h"',                 out[2])
460  endfor
461
462  for opt in [' -cq', ' --cmd q', ' +', ' -S foo']
463    let out = split(system(GetVimCommand() .. repeat(opt, 11)), "\n")
464    call assert_equal(1, v:shell_error)
465    " FIXME: The error message given by Vim is not ideal in case of repeated
466    " -S foo since it does not mention -S.
467    call assert_match('^VIM - Vi IMproved .* (.*)$',                                    out[0])
468    call assert_equal('Too many "+command", "-c command" or "--cmd command" arguments', out[1])
469    call assert_equal('More info with: "vim -h"',                                       out[2])
470  endfor
471
472  if has('gui_gtk')
473    for opt in ['--socketid x', '--socketid 0xg']
474      let out = split(system(GetVimCommand() .. ' ' .. opt), "\n")
475      call assert_equal(1, v:shell_error)
476      call assert_match('^VIM - Vi IMproved .* (.*)$',        out[0])
477      call assert_equal('Invalid argument for: "--socketid"', out[1])
478      call assert_equal('More info with: "vim -h"',           out[2])
479    endfor
480  endif
481endfunc
482
483func Test_file_args()
484  let after = [
485	\ 'call writefile(argv(), "Xtestout")',
486	\ 'qall',
487	\ ]
488  if RunVim([], after, '')
489    let lines = readfile('Xtestout')
490    call assert_equal(0, len(lines))
491  endif
492
493  if RunVim([], after, 'one')
494    let lines = readfile('Xtestout')
495    call assert_equal(1, len(lines))
496    call assert_equal('one', lines[0])
497  endif
498
499  if RunVim([], after, 'one two three')
500    let lines = readfile('Xtestout')
501    call assert_equal(3, len(lines))
502    call assert_equal('one', lines[0])
503    call assert_equal('two', lines[1])
504    call assert_equal('three', lines[2])
505  endif
506
507  if RunVim([], after, 'one -c echo two')
508    let lines = readfile('Xtestout')
509    call assert_equal(2, len(lines))
510    call assert_equal('one', lines[0])
511    call assert_equal('two', lines[1])
512  endif
513
514  if RunVim([], after, 'one -- -c echo two')
515    let lines = readfile('Xtestout')
516    call assert_equal(4, len(lines))
517    call assert_equal('one', lines[0])
518    call assert_equal('-c', lines[1])
519    call assert_equal('echo', lines[2])
520    call assert_equal('two', lines[3])
521  endif
522
523  call delete('Xtestout')
524endfunc
525
526func Test_startuptime()
527  if !has('startuptime')
528    return
529  endif
530  let after = ['qall']
531  if RunVim([], after, '--startuptime Xtestout one')
532    let lines = readfile('Xtestout')
533    let expected = ['--- VIM STARTING ---', 'parsing arguments',
534	  \ 'shell init', 'inits 3', 'start termcap', 'opening buffers']
535    let found = []
536    for line in lines
537      for exp in expected
538	if line =~ exp
539	  call add(found, exp)
540	endif
541      endfor
542    endfor
543    call assert_equal(expected, found)
544  endif
545  call delete('Xtestout')
546endfunc
547
548func Test_read_stdin()
549  let after = [
550	\ 'write Xtestout',
551	\ 'quit!',
552	\ ]
553  if RunVimPiped([], after, '-', 'echo something | ')
554    let lines = readfile('Xtestout')
555    " MS-Windows adds a space after the word
556    call assert_equal(['something'], split(lines[0]))
557  endif
558  call delete('Xtestout')
559endfunc
560
561func Test_set_shell()
562  let after = [
563	\ 'call writefile([&shell], "Xtestout")',
564	\ 'quit!',
565	\ ]
566  let $SHELL = '/bin/with space/sh'
567  if RunVimPiped([], after, '', '')
568    let lines = readfile('Xtestout')
569    " MS-Windows adds a space after the word
570    call assert_equal('/bin/with\ space/sh', lines[0])
571  endif
572  call delete('Xtestout')
573endfunc
574
575func Test_progpath()
576  " Tests normally run with "./vim" or "../vim", these must have been expanded
577  " to a full path.
578  if has('unix')
579    call assert_equal('/', v:progpath[0])
580  elseif has('win32')
581    call assert_equal(':', v:progpath[1])
582    call assert_match('[/\\]', v:progpath[2])
583  endif
584
585  " Only expect "vim" to appear in v:progname.
586  call assert_match('vim\c', v:progname)
587endfunc
588
589func Test_silent_ex_mode()
590  if !has('unix') || has('gui_running')
591    " can't get output of Vim.
592    return
593  endif
594
595  " This caused an ml_get error.
596  let out = system(GetVimCommand() . '-u NONE -es -c''set verbose=1|h|exe "%norm\<c-y>\<c-d>"'' -c cq')
597  call assert_notmatch('E315:', out)
598endfunc
599
600func Test_default_term()
601  if !has('unix') || has('gui_running')
602    " can't get output of Vim.
603    return
604  endif
605
606  let save_term = $TERM
607  let $TERM = 'unknownxxx'
608  let out = system(GetVimCommand() . ' -c''set term'' -c cq')
609  call assert_match("defaulting to 'ansi'", out)
610  let $TERM = save_term
611endfunc
612
613func Test_zzz_startinsert()
614  " Test :startinsert
615  call writefile(['123456'], 'Xtestout')
616  let after = [
617	\ ':startinsert',
618	\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
619	\ ]
620  if RunVim([], after, 'Xtestout')
621    let lines = readfile('Xtestout')
622    call assert_equal(['foobar123456'], lines)
623  endif
624  " Test :startinsert!
625  call writefile(['123456'], 'Xtestout')
626  let after = [
627	\ ':startinsert!',
628	\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
629	\ ]
630  if RunVim([], after, 'Xtestout')
631    let lines = readfile('Xtestout')
632    call assert_equal(['123456foobar'], lines)
633  endif
634  call delete('Xtestout')
635endfunc
636
637func Test_issue_3969()
638  if has('gui_running')
639    " Can't catch the output of gvim.
640    return
641  endif
642  " Check that message is not truncated.
643  let out = system(GetVimCommand() . ' -es -X -V1 -c "echon ''hello''" -cq')
644  call assert_equal('hello', out)
645endfunc
646
647func Test_start_with_tabs()
648  if !CanRunVimInTerminal()
649    return
650  endif
651
652  let buf = RunVimInTerminal('-p a b c', {})
653  call VerifyScreenDump(buf, 'Test_start_with_tabs', {})
654
655  " clean up
656  call StopVimInTerminal(buf)
657endfunc
658