1" Test for :mksession, :mkview and :loadview in latin1 encoding
2
3set encoding=latin1
4scriptencoding latin1
5
6source check.vim
7CheckFeature mksession
8
9source shared.vim
10source term_util.vim
11
12" Test for storing global and local argument list in a session file
13" This one must be done first.
14func Test__mksession_arglocal()
15  enew | only
16  n a b c
17  new
18  arglocal
19  mksession! Xtest_mks.out
20
21  %bwipe!
22  %argdelete
23  argglobal
24  source Xtest_mks.out
25  call assert_equal(2, winnr('$'))
26  call assert_equal(2, arglistid(1))
27  call assert_equal(0, arglistid(2))
28
29  %bwipe!
30  %argdelete
31  argglobal
32  call delete('Xtest_mks.out')
33endfunc
34
35func Test_mksession()
36  tabnew
37  let wrap_save = &wrap
38  set sessionoptions=buffers splitbelow fileencoding=latin1
39  call setline(1, [
40    \   'start:',
41    \   'no multibyte chAracter',
42    \   '	one leaDing tab',
43    \   '    four leadinG spaces',
44    \   'two		consecutive tabs',
45    \   'two	tabs	in one line',
46    \   'one � multibyteCharacter',
47    \   'a� �  two multiByte characters',
48    \   'A���  three mulTibyte characters',
49    \   'short line',
50    \ ])
51  let tmpfile = 'Xtemp'
52  exec 'w! ' . tmpfile
53  /^start:
54  set wrap
55  vsplit
56  norm! j16|
57  split
58  norm! j16|
59  split
60  norm! j16|
61  split
62  norm! j8|
63  split
64  norm! j8|
65  split
66  norm! j16|
67  split
68  norm! j16|
69  split
70  norm! j16|
71  split
72  norm! j$
73  wincmd l
74
75  set nowrap
76  /^start:
77  norm! j16|3zl
78  split
79  norm! j016|3zl
80  split
81  norm! j016|3zl
82  split
83  norm! j08|3zl
84  split
85  norm! j08|3zl
86  split
87  norm! j016|3zl
88  split
89  norm! j016|3zl
90  split
91  norm! j016|3zl
92  split
93  call wincol()
94  mksession! Xtest_mks.out
95  let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! [0$]\\|^ *exe ''normal!\\)"')
96  let expected = [
97    \   'normal! 016|',
98    \   'normal! 016|',
99    \   'normal! 016|',
100    \   'normal! 08|',
101    \   'normal! 08|',
102    \   'normal! 016|',
103    \   'normal! 016|',
104    \   'normal! 016|',
105    \   'normal! $',
106    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
107    \   "  normal! 016|",
108    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
109    \   "  normal! 016|",
110    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
111    \   "  normal! 016|",
112    \   "  exe 'normal! ' . s:c . '|zs' . 8 . '|'",
113    \   "  normal! 08|",
114    \   "  exe 'normal! ' . s:c . '|zs' . 8 . '|'",
115    \   "  normal! 08|",
116    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
117    \   "  normal! 016|",
118    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
119    \   "  normal! 016|",
120    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
121    \   "  normal! 016|",
122    \   "  exe 'normal! ' . s:c . '|zs' . 16 . '|'",
123    \   "  normal! 016|"
124    \ ]
125  call assert_equal(expected, li)
126  tabclose!
127
128  call delete('Xtest_mks.out')
129  call delete(tmpfile)
130  let &wrap = wrap_save
131  set sessionoptions&
132endfunc
133
134func Test_mksession_winheight()
135  new
136  set winheight=10
137  set winminheight=2
138  mksession! Xtest_mks.out
139  source Xtest_mks.out
140
141  call delete('Xtest_mks.out')
142endfunc
143
144func Test_mksession_large_winheight()
145  set winheight=999
146  mksession! Xtest_mks_winheight.out
147  set winheight&
148  source Xtest_mks_winheight.out
149  call delete('Xtest_mks_winheight.out')
150endfunc
151
152func Test_mksession_rtp()
153  if has('win32')
154    " TODO: fix problem with backslashes
155    return
156  endif
157  new
158  let _rtp=&rtp
159  " Make a real long (invalid) runtimepath value,
160  " that should exceed PATH_MAX (hopefully)
161  let newrtp=&rtp.',~'.repeat('/foobar', 1000)
162  let newrtp.=",".expand("$HOME")."/.vim"
163  let &rtp=newrtp
164
165  " determine expected value
166  let expected=split(&rtp, ',')
167  let expected = map(expected, '"set runtimepath+=".v:val')
168  let expected = ['set runtimepath='] + expected
169  let expected = map(expected, {v,w -> substitute(w, $HOME, "~", "g")})
170
171  mksession! Xtest_mks.out
172  let &rtp=_rtp
173  let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "runtimepath"')
174  call assert_equal(expected, li)
175
176  call delete('Xtest_mks.out')
177endfunc
178
179func Test_mksession_arglist()
180  %argdel
181  next file1 file2 file3 file4
182  new
183  next | next
184  mksession! Xtest_mks.out
185  source Xtest_mks.out
186  call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
187  call assert_equal(2, argidx())
188  wincmd w
189  call assert_equal(0, argidx())
190
191  call delete('Xtest_mks.out')
192  enew | only
193  argdel *
194endfunc
195
196func Test_mksession_one_buffer_two_windows()
197  edit Xtest1
198  new Xtest2
199  split
200  mksession! Xtest_mks.out
201  let lines = readfile('Xtest_mks.out')
202  let count1 = 0
203  let count2 = 0
204  let count2buf = 0
205  for line in lines
206    if line =~ 'edit \f*Xtest1$'
207      let count1 += 1
208    endif
209    if line =~ 'edit \f\{-}Xtest2'
210      let count2 += 1
211    endif
212    if line =~ 'buffer \f\{-}Xtest2'
213      let count2buf += 1
214    endif
215  endfor
216  call assert_equal(1, count1, 'Xtest1 count')
217  call assert_equal(2, count2, 'Xtest2 count')
218  call assert_equal(2, count2buf, 'Xtest2 buffer count')
219
220  close
221  bwipe!
222  call delete('Xtest_mks.out')
223endfunc
224
225func Test_mksession_lcd_multiple_tabs()
226  tabnew
227  tabnew
228  lcd .
229  tabfirst
230  lcd .
231  mksession! Xtest_mks.out
232  tabonly
233  source Xtest_mks.out
234  call assert_true(haslocaldir(), 'Tab 1 localdir')
235  tabnext 2
236  call assert_true(!haslocaldir(), 'Tab 2 localdir')
237  tabnext 3
238  call assert_true(haslocaldir(), 'Tab 3 localdir')
239  call delete('Xtest_mks.out')
240endfunc
241
242" Test for tabpage-local directory
243func Test_mksession_tcd_multiple_tabs()
244  let save_cwd = getcwd()
245  call mkdir('Xtopdir')
246  cd Xtopdir
247  call mkdir('Xtabdir1')
248  call mkdir('Xtabdir2')
249  call mkdir('Xtabdir3')
250  call mkdir('Xwindir1')
251  call mkdir('Xwindir2')
252  call mkdir('Xwindir3')
253  tcd Xtabdir1
254  botright new
255  wincmd t
256  lcd ../Xwindir1
257  tabnew
258  tcd ../Xtabdir2
259  botright new
260  lcd ../Xwindir2
261  tabnew
262  tcd ../Xtabdir3
263  botright new
264  lcd ../Xwindir3
265  tabfirst
266  1wincmd w
267  mksession! Xtest_mks.out
268  only | tabonly
269  source Xtest_mks.out
270  call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 1), ':t'))
271  call assert_equal('Xwindir1', fnamemodify(getcwd(1, 1), ':t'))
272  call assert_equal('Xtabdir1', fnamemodify(getcwd(2, 1), ':t'))
273  call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 2), ':t'))
274  call assert_equal('Xtabdir2', fnamemodify(getcwd(1, 2), ':t'))
275  call assert_equal('Xwindir2', fnamemodify(getcwd(2, 2), ':t'))
276  call assert_equal('Xtabdir3', fnamemodify(getcwd(-1, 3), ':t'))
277  call assert_equal('Xtabdir3', fnamemodify(getcwd(1, 3), ':t'))
278  call assert_equal('Xwindir3', fnamemodify(getcwd(2, 3), ':t'))
279  %bwipe
280  call chdir(save_cwd)
281  call delete("Xtopdir", "rf")
282endfunc
283
284func Test_mksession_blank_tabs()
285  tabnew
286  tabnew
287  tabnew
288  tabnext 3
289  mksession! Xtest_mks.out
290  tabnew
291  tabnew
292  tabnext 2
293  source Xtest_mks.out
294  call assert_equal(4, tabpagenr('$'), 'session restore should restore number of tabs')
295  call assert_equal(3, tabpagenr(), 'session restore should restore the active tab')
296  call delete('Xtest_mks.out')
297endfunc
298
299func Test_mksession_buffer_count()
300  set hidden
301
302  " Edit exactly three files in the current session.
303  %bwipe!
304  e Xfoo | tabe Xbar | tabe Xbaz
305  tabdo write
306  mksession! Xtest_mks.out
307
308  " Verify that loading the session does not create additional buffers.
309  %bwipe!
310  source Xtest_mks.out
311  call assert_equal(3, len(getbufinfo()))
312
313  " Clean up.
314  call delete('Xfoo')
315  call delete('Xbar')
316  call delete('Xbaz')
317  call delete('Xtest_mks.out')
318  %bwipe!
319  set hidden&
320endfunc
321
322if has('extra_search')
323
324func Test_mksession_hlsearch()
325  set hlsearch
326  mksession! Xtest_mks.out
327  nohlsearch
328  source Xtest_mks.out
329  call assert_equal(1, v:hlsearch, 'session should restore search highlighting state')
330  nohlsearch
331  mksession! Xtest_mks.out
332  source Xtest_mks.out
333  call assert_equal(0, v:hlsearch, 'session should restore search highlighting state')
334  call delete('Xtest_mks.out')
335endfunc
336
337endif
338
339
340func Test_mksession_blank_windows()
341  split
342  split
343  split
344  3 wincmd w
345  mksession! Xtest_mks.out
346  split
347  split
348  2 wincmd w
349  source Xtest_mks.out
350  call assert_equal(4, winnr('$'), 'session restore should restore number of windows')
351  call assert_equal(3, winnr(), 'session restore should restore the active window')
352  call delete('Xtest_mks.out')
353endfunc
354
355if has('terminal')
356
357func Test_mksession_terminal_shell()
358  CheckFeature quickfix
359
360  terminal
361  mksession! Xtest_mks.out
362  let lines = readfile('Xtest_mks.out')
363  let term_cmd = ''
364  for line in lines
365    if line =~ '^terminal'
366      let term_cmd = line
367    elseif line =~ 'badd.*' . &shell
368      call assert_report('unexpected shell line: ' . line)
369    endif
370  endfor
371  call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+\s*.*$', term_cmd)
372
373  call StopShellInTerminal(bufnr('%'))
374  call delete('Xtest_mks.out')
375endfunc
376
377func Test_mksession_terminal_no_restore_cmdarg()
378  terminal ++norestore
379  mksession! Xtest_mks.out
380  let lines = readfile('Xtest_mks.out')
381  let term_cmd = ''
382  for line in lines
383    if line =~ '^terminal'
384      call assert_report('session must not restore teminal')
385    endif
386  endfor
387
388  call StopShellInTerminal(bufnr('%'))
389  call delete('Xtest_mks.out')
390endfunc
391
392func Test_mksession_terminal_no_restore_funcarg()
393  call term_start(&shell, {'norestore': 1})
394  mksession! Xtest_mks.out
395  let lines = readfile('Xtest_mks.out')
396  let term_cmd = ''
397  for line in lines
398    if line =~ '^terminal'
399      call assert_report('session must not restore teminal')
400    endif
401  endfor
402
403  call StopShellInTerminal(bufnr('%'))
404  call delete('Xtest_mks.out')
405endfunc
406
407func Test_mksession_terminal_no_restore_func()
408  terminal
409  call term_setrestore(bufnr('%'), 'NONE')
410  mksession! Xtest_mks.out
411  let lines = readfile('Xtest_mks.out')
412  let term_cmd = ''
413  for line in lines
414    if line =~ '^terminal'
415      call assert_report('session must not restore teminal')
416    endif
417  endfor
418
419  call StopShellInTerminal(bufnr('%'))
420  call delete('Xtest_mks.out')
421endfunc
422
423func Test_mksession_terminal_no_ssop()
424  terminal
425  set sessionoptions-=terminal
426  mksession! Xtest_mks.out
427  let lines = readfile('Xtest_mks.out')
428  let term_cmd = ''
429  for line in lines
430    if line =~ '^terminal'
431      call assert_report('session must not restore teminal')
432    endif
433  endfor
434
435  call StopShellInTerminal(bufnr('%'))
436  call delete('Xtest_mks.out')
437  set sessionoptions&
438endfunc
439
440func Test_mksession_terminal_restore_other()
441  CheckFeature quickfix
442
443  terminal
444  eval bufnr('%')->term_setrestore('other')
445  mksession! Xtest_mks.out
446  let lines = readfile('Xtest_mks.out')
447  let term_cmd = ''
448  for line in lines
449    if line =~ '^terminal'
450      let term_cmd = line
451    endif
452  endfor
453  call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+.*other', term_cmd)
454
455  call StopShellInTerminal(bufnr('%'))
456  call delete('Xtest_mks.out')
457endfunc
458
459endif " has('terminal')
460
461" Test :mkview with a file argument.
462func Test_mkview_file()
463  " Create a view with line number and a fold.
464  help :mkview
465  set number
466  norm! V}zf0
467  let pos = getpos('.')
468  let linefoldclosed1 = foldclosed('.')
469  mkview! Xview
470  set nonumber
471  norm! zrj
472  " We can close the help window, as mkview with a file name should
473  " generate a command to edit the file.
474  helpclose
475
476  source Xview
477  call assert_equal(1, &number)
478  call assert_match('\*:mkview\*$', getline('.'))
479  call assert_equal(pos, getpos('.'))
480  call assert_equal(linefoldclosed1, foldclosed('.'))
481
482  " Creating a view again with the same file name should fail (file
483  " already exists). But with a !, the previous view should be
484  " overwritten without error.
485  help :loadview
486  call assert_fails('mkview Xview', 'E189:')
487  call assert_match('\*:loadview\*$', getline('.'))
488  mkview! Xview
489  call assert_match('\*:loadview\*$', getline('.'))
490
491  call delete('Xview')
492  bwipe
493endfunc
494
495" Test :mkview and :loadview with a custom 'viewdir'.
496func Test_mkview_loadview_with_viewdir()
497  set viewdir=Xviewdir
498
499  help :mkview
500  set number
501  norm! V}zf
502  let pos = getpos('.')
503  let linefoldclosed1 = foldclosed('.')
504  mkview 1
505  set nonumber
506  norm! zrj
507
508  loadview 1
509
510  " The directory Xviewdir/ should have been created and the view
511  " should be stored in that directory.
512  call assert_equal('Xviewdir/' .
513        \           substitute(
514        \             substitute(
515        \               expand('%:p'), '/', '=+', 'g'), ':', '=-', 'g') . '=1.vim',
516        \           glob('Xviewdir/*'))
517  call assert_equal(1, &number)
518  call assert_match('\*:mkview\*$', getline('.'))
519  call assert_equal(pos, getpos('.'))
520  call assert_equal(linefoldclosed1, foldclosed('.'))
521
522  call delete('Xviewdir', 'rf')
523  set viewdir&
524  helpclose
525endfunc
526
527func Test_mkview_no_file_name()
528  new
529  " :mkview or :mkview {nr} should fail in a unnamed buffer.
530  call assert_fails('mkview', 'E32:')
531  call assert_fails('mkview 1', 'E32:')
532
533  " :mkview {file} should succeed in a unnamed buffer.
534  mkview Xview
535  help
536  source Xview
537  call assert_equal('', bufname('%'))
538
539  call delete('Xview')
540  %bwipe
541endfunc
542
543" A clean session (one empty buffer, one window, and one tab) should not
544" set any error messages when sourced because no commands should fail.
545func Test_mksession_no_errmsg()
546  let v:errmsg = ''
547  %bwipe!
548  mksession! Xtest_mks.out
549  source Xtest_mks.out
550  call assert_equal('', v:errmsg)
551  call delete('Xtest_mks.out')
552endfunc
553
554func Test_mksession_quote_in_filename()
555  if !has('unix')
556    " only Unix can handle this weird filename
557    return
558  endif
559  let v:errmsg = ''
560  %bwipe!
561  split another
562  split x'y\"z
563  mksession! Xtest_mks_quoted.out
564  %bwipe!
565  source Xtest_mks_quoted.out
566  call assert_true(bufexists("x'y\"z"))
567
568  %bwipe!
569  call delete('Xtest_mks_quoted.out')
570endfunc
571
572" Test for storing global variables in a session file
573func Test_mksession_globals()
574  set sessionoptions+=globals
575
576  " create different global variables
577  let g:Global_string = "Sun is shining\r\n"
578  let g:Global_count = 100
579  let g:Global_pi = 3.14
580  let g:Global_neg_float = -2.68
581
582  mksession! Xtest_mks.out
583
584  unlet g:Global_string
585  unlet g:Global_count
586  unlet g:Global_pi
587  unlet g:Global_neg_float
588
589  source Xtest_mks.out
590  call assert_equal("Sun is shining\r\n", g:Global_string)
591  call assert_equal(100, g:Global_count)
592  call assert_equal(3.14, g:Global_pi)
593  call assert_equal(-2.68, g:Global_neg_float)
594
595  unlet g:Global_string
596  unlet g:Global_count
597  unlet g:Global_pi
598  unlet g:Global_neg_float
599  call delete('Xtest_mks.out')
600  set sessionoptions&
601endfunc
602
603" Test for changing backslash to forward slash in filenames
604func Test_mksession_slash()
605  if exists('+shellslash')
606    throw 'Skipped: cannot use backslash in file name'
607  endif
608  enew
609  %bwipe!
610  e a\\b\\c
611  mksession! Xtest_mks1.out
612  set sessionoptions+=slash
613  mksession! Xtest_mks2.out
614
615  %bwipe!
616  source Xtest_mks1.out
617  call assert_equal('a\b\c', bufname(''))
618  %bwipe!
619  source Xtest_mks2.out
620  call assert_equal('a/b/c', bufname(''))
621
622  %bwipe!
623  call delete('Xtest_mks1.out')
624  call delete('Xtest_mks2.out')
625  set sessionoptions&
626endfunc
627
628" Test for changing directory to the session file directory
629func Test_mksession_sesdir()
630  let save_cwd = getcwd()
631  call mkdir('Xproj')
632  mksession! Xproj/Xtest_mks1.out
633  set sessionoptions-=curdir
634  set sessionoptions+=sesdir
635  mksession! Xproj/Xtest_mks2.out
636
637  source Xproj/Xtest_mks1.out
638  call assert_equal('testdir', fnamemodify(getcwd(), ':t'))
639  source Xproj/Xtest_mks2.out
640  call assert_equal('Xproj', fnamemodify(getcwd(), ':t'))
641  call chdir(save_cwd)
642  %bwipe
643
644  set sessionoptions&
645  call delete('Xproj', 'rf')
646endfunc
647
648" Test for storing the 'lines' and 'columns' settings
649func Test_mksession_resize()
650  mksession! Xtest_mks1.out
651  set sessionoptions+=resize
652  mksession! Xtest_mks2.out
653
654  let lines = readfile('Xtest_mks1.out')
655  let found_resize = v:false
656  for line in lines
657    if line =~ '^set lines='
658      let found_resize = v:true
659      break
660    endif
661  endfor
662  call assert_false(found_resize)
663  let lines = readfile('Xtest_mks2.out')
664  let found_resize = v:false
665  for line in lines
666    if line =~ '^set lines='
667      let found_resize = v:true
668      break
669    endif
670  endfor
671  call assert_true(found_resize)
672
673  call delete('Xtest_mks1.out')
674  call delete('Xtest_mks2.out')
675  set sessionoptions&
676endfunc
677
678" Test for mksession with a named scratch buffer
679func Test_mksession_scratch()
680  enew | only
681  file Xscratch
682  set buftype=nofile
683  mksession! Xtest_mks.out
684  %bwipe
685  source Xtest_mks.out
686  call assert_equal('Xscratch', bufname(''))
687  call assert_equal('nofile', &buftype)
688  %bwipe
689  call delete('Xtest_mks.out')
690endfunc
691
692" Test for mksession with fold options
693func Test_mksession_foldopt()
694  set sessionoptions-=options
695  set sessionoptions+=folds
696  new
697  setlocal foldenable
698  setlocal foldmethod=expr
699  setlocal foldmarker=<<<,>>>
700  setlocal foldignore=%
701  setlocal foldlevel=2
702  setlocal foldminlines=10
703  setlocal foldnestmax=15
704  mksession! Xtest_mks.out
705  close
706  %bwipe
707
708  source Xtest_mks.out
709  call assert_true(&foldenable)
710  call assert_equal('expr', &foldmethod)
711  call assert_equal('<<<,>>>', &foldmarker)
712  call assert_equal('%', &foldignore)
713  call assert_equal(2, &foldlevel)
714  call assert_equal(10, &foldminlines)
715  call assert_equal(15, &foldnestmax)
716
717  close
718  %bwipe
719  set sessionoptions&
720endfunc
721
722" Test for mksession with window position
723func Test_mksession_winpos()
724  if !has('gui_running')
725    " Only applicable in GUI Vim
726    return
727  endif
728  set sessionoptions+=winpos
729  mksession! Xtest_mks.out
730  let found_winpos = v:false
731  let lines = readfile('Xtest_mks.out')
732  for line in lines
733    if line =~ '^winpos '
734      let found_winpos = v:true
735      break
736    endif
737  endfor
738  call assert_true(found_winpos)
739  call delete('Xtest_mks.out')
740  set sessionoptions&
741endfunc
742
743" Test for mksession with 'compatible' option
744func Test_mksession_compatible()
745  mksession! Xtest_mks1.out
746  set compatible
747  mksession! Xtest_mks2.out
748  set nocp
749
750  let test_success = v:false
751  let lines = readfile('Xtest_mks1.out')
752  for line in lines
753    if line =~ '^if &cp | set nocp | endif'
754      let test_success = v:true
755      break
756    endif
757  endfor
758  call assert_true(test_success)
759
760  let test_success = v:false
761  let lines = readfile('Xtest_mks2.out')
762  for line in lines
763    if line =~ '^if !&cp | set cp | endif'
764      let test_success = v:true
765      break
766    endif
767  endfor
768  call assert_true(test_success)
769
770  call delete('Xtest_mks1.out')
771  call delete('Xtest_mks2.out')
772  set compatible&
773  set sessionoptions&
774endfunc
775
776func s:ClearMappings()
777  mapclear
778  omapclear
779  mapclear!
780  lmapclear
781  tmapclear
782endfunc
783
784func Test_mkvimrc()
785  let entries = [
786        \ ['', 'nothing', '<Nop>'],
787        \ ['n', 'normal', 'NORMAL'],
788        \ ['v', 'visual', 'VISUAL'],
789        \ ['s', 'select', 'SELECT'],
790        \ ['x', 'visualonly', 'VISUALONLY'],
791        \ ['o', 'operator', 'OPERATOR'],
792        \ ['i', 'insert', 'INSERT'],
793        \ ['l', 'lang', 'LANG'],
794        \ ['c', 'command', 'COMMAND'],
795        \ ['t', 'terminal', 'TERMINAL'],
796        \ ]
797  for entry in entries
798    exe entry[0] .. 'map ' .. entry[1] .. ' ' .. entry[2]
799  endfor
800
801  mkvimrc Xtestvimrc
802
803  call s:ClearMappings()
804  for entry in entries
805    call assert_equal('', maparg(entry[1], entry[0]))
806  endfor
807
808  source Xtestvimrc
809
810  for entry in entries
811    call assert_equal(entry[2], maparg(entry[1], entry[0]))
812  endfor
813
814  call s:ClearMappings()
815  call delete('Xtestvimrc')
816endfunc
817
818" vim: shiftwidth=2 sts=2 expandtab
819