annotate src/testdir/test_mksession.vim @ 24476:e79d1475fc89 v8.2.2778

patch 8.2.2778: problem restoring 'packpath' in session Commit: https://github.com/vim/vim/commit/d23b714d8b9ed8e16ef553098acc6da0979e94fc Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 17 21:04:34 2021 +0200 patch 8.2.2778: problem restoring 'packpath' in session Problem: Problem restoring 'packpath' in session. Solution: Let "skiprtp" also apply to 'packpath'.
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Apr 2021 21:15:03 +0200
parents b2484fa6cb02
children f6049d3ab81c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for :mksession, :mkview and :loadview in latin1 encoding
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 set encoding=latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 scriptencoding latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
6 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
7 CheckFeature mksession
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
9 source shared.vim
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
10 source term_util.vim
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
11
18562
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
12 " Test for storing global and local argument list in a session file
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
13 " This one must be done first.
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
14 func Test__mksession_arglocal()
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
15 enew | only
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
16 n a b c
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
17 new
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
18 arglocal
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
19 mksession! Xtest_mks.out
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
20
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
21 %bwipe!
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
22 %argdelete
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
23 argglobal
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
24 source Xtest_mks.out
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
25 call assert_equal(2, winnr('$'))
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
26 call assert_equal(2, arglistid(1))
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
27 call assert_equal(0, arglistid(2))
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
28
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
29 %bwipe!
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
30 %argdelete
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
31 argglobal
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
32 call delete('Xtest_mks.out')
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
33 endfunc
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
34
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 func Test_mksession()
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 tabnew
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 let wrap_save = &wrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 set sessionoptions=buffers splitbelow fileencoding=latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call setline(1, [
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ 'start:',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 \ 'no multibyte chAracter',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 \ ' one leaDing tab',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 \ ' four leadinG spaces',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 \ 'two consecutive tabs',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 \ 'two tabs in one line',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 \ 'one ä multibyteCharacter',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 \ 'aä Ä two multiByte characters',
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
48 \ 'Aäöü three mulTibyte characters',
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
49 \ 'short line',
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ ])
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
51 let tmpfile = 'Xtemp'
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 exec 'w! ' . tmpfile
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 /^start:
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 set wrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 vsplit
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 norm! j8|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 norm! j8|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 norm! j16|
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
71 split
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
72 norm! j$
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 wincmd l
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 set nowrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 /^start:
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 norm! j16|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 norm! j08|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 norm! j08|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 call wincol()
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
94 mksession! Xtest_mks.out
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
95 let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! [0$]\\|^ *exe ''normal!\\)"')
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 let expected = [
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 \ 'normal! 08|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 \ 'normal! 08|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 \ 'normal! 016|',
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
105 \ 'normal! $',
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 \ " normal! 08|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 \ " normal! 08|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 \ " normal! 016|"
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 \ ]
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call assert_equal(expected, li)
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 tabclose!
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
128 call delete('Xtest_mks.out')
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call delete(tmpfile)
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 let &wrap = wrap_save
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
131 set sessionoptions&
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 endfunc
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
134 def Test_mksession_skiprtp()
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
135 mksession! Xtest_mks.out
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
136 var found_rtp = 0
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
137 var found_pp = 0
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
138 for line in readfile('Xtest_mks.out')
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
139 if line =~ 'set runtimepath'
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
140 found_rtp += 1
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
141 endif
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
142 if line =~ 'set packpath'
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
143 found_pp += 1
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
144 endif
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
145 endfor
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
146 assert_equal(1, found_rtp)
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
147 assert_equal(1, found_pp)
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
148 delete('Xtest_mks.out')
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
149
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
150 set sessionoptions+=skiprtp
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
151 mksession! Xtest_mks.out
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
152 var found = 0
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
153 for line in readfile('Xtest_mks.out')
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
154 if line =~ 'set \(runtimepath\|packpath\)'
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
155 found = 1
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
156 break
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
157 endif
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
158 endfor
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
159 assert_equal(0, found)
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
160 delete('Xtest_mks.out')
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
161 set sessionoptions&
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
162 enddef
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
163
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
164 func Test_mksession_winheight()
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
165 new
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
166 set winheight=10
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
167 set winminheight=2
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
168 mksession! Xtest_mks.out
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
169 source Xtest_mks.out
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
170
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
171 call delete('Xtest_mks.out')
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
172 endfunc
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
173
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
174 func Test_mksession_large_winheight()
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
175 set winheight=999
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
176 mksession! Xtest_mks_winheight.out
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
177 set winheight&
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
178 source Xtest_mks_winheight.out
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
179 call delete('Xtest_mks_winheight.out')
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
180 endfunc
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
181
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
182 func Test_mksession_rtp()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
183 " TODO: fix problem with backslashes on Win32
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
184 CheckNotMSWindows
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
185
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
186 new
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
187 let _rtp=&rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
188 " Make a real long (invalid) runtimepath value,
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
189 " that should exceed PATH_MAX (hopefully)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
190 let newrtp=&rtp.',~'.repeat('/foobar', 1000)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
191 let newrtp.=",".expand("$HOME")."/.vim"
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
192 let &rtp=newrtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
193
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
194 " determine expected value
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
195 let expected=split(&rtp, ',')
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
196 let expected = map(expected, '"set runtimepath+=".v:val')
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
197 let expected = ['set runtimepath='] + expected
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
198 let expected = map(expected, {v,w -> substitute(w, $HOME, "~", "g")})
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
199
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
200 mksession! Xtest_mks.out
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
201 let &rtp=_rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
202 let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "runtimepath"')
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
203 call assert_equal(expected, li)
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
204
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
205 call delete('Xtest_mks.out')
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
206 endfunc
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
207
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
208 func Test_mksession_arglist()
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
209 %argdel
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
210 next file1 file2 file3 file4
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
211 new
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
212 next | next
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
213 mksession! Xtest_mks.out
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
214 source Xtest_mks.out
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
215 call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
216 call assert_equal(2, argidx())
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
217 wincmd w
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
218 call assert_equal(0, argidx())
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
219
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
220 call delete('Xtest_mks.out')
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
221 enew | only
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
222 argdel *
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
223 endfunc
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
224
12289
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
225 func Test_mksession_one_buffer_two_windows()
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
226 edit Xtest1
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
227 new Xtest2
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
228 split
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
229 mksession! Xtest_mks.out
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
230 let lines = readfile('Xtest_mks.out')
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
231 let count1 = 0
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
232 let count2 = 0
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
233 let count2buf = 0
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
234 for line in lines
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
235 if line =~ 'edit \f*Xtest1$'
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
236 let count1 += 1
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
237 endif
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
238 if line =~ 'edit \f\{-}Xtest2'
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
239 let count2 += 1
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
240 endif
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
241 if line =~ 'buffer \f\{-}Xtest2'
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
242 let count2buf += 1
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
243 endif
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
244 endfor
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
245 call assert_equal(1, count1, 'Xtest1 count')
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
246 call assert_equal(2, count2, 'Xtest2 count')
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
247 call assert_equal(2, count2buf, 'Xtest2 buffer count')
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
248
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
249 close
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
250 bwipe!
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
251 call delete('Xtest_mks.out')
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
252 endfunc
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
253
14266
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
254 func Test_mksession_lcd_multiple_tabs()
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
255 tabnew
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
256 tabnew
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
257 lcd .
14266
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
258 tabfirst
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
259 lcd .
14266
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
260 mksession! Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
261 tabonly
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
262 source Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
263 call assert_true(haslocaldir(), 'Tab 1 localdir')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
264 tabnext 2
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
265 call assert_true(!haslocaldir(), 'Tab 2 localdir')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
266 tabnext 3
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
267 call assert_true(haslocaldir(), 'Tab 3 localdir')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
268 call delete('Xtest_mks.out')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
269 endfunc
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
270
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
271 " Test for tabpage-local directory
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
272 func Test_mksession_tcd_multiple_tabs()
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
273 let save_cwd = getcwd()
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
274 call mkdir('Xtopdir')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
275 cd Xtopdir
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
276 call mkdir('Xtabdir1')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
277 call mkdir('Xtabdir2')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
278 call mkdir('Xtabdir3')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
279 call mkdir('Xwindir1')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
280 call mkdir('Xwindir2')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
281 call mkdir('Xwindir3')
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
282 tcd Xtabdir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
283 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
284 wincmd t
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
285 lcd ../Xwindir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
286 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
287 tcd ../Xtabdir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
288 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
289 lcd ../Xwindir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
290 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
291 tcd ../Xtabdir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
292 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
293 lcd ../Xwindir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
294 tabfirst
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
295 1wincmd w
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
296 mksession! Xtest_mks.out
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
297 only | tabonly
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
298 source Xtest_mks.out
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
299 call assert_equal('Xtabdir1', fnamemodify(getcwd(-1, 1), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
300 call assert_equal('Xwindir1', fnamemodify(getcwd(1, 1), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
301 call assert_equal('Xtabdir1', fnamemodify(getcwd(2, 1), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
302 call assert_equal('Xtabdir2', fnamemodify(getcwd(-1, 2), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
303 call assert_equal('Xtabdir2', fnamemodify(getcwd(1, 2), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
304 call assert_equal('Xwindir2', fnamemodify(getcwd(2, 2), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
305 call assert_equal('Xtabdir3', fnamemodify(getcwd(-1, 3), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
306 call assert_equal('Xtabdir3', fnamemodify(getcwd(1, 3), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
307 call assert_equal('Xwindir3', fnamemodify(getcwd(2, 3), ':t'))
18564
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
308 %bwipe
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
309 call chdir(save_cwd)
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
310 call delete("Xtopdir", "rf")
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
311 endfunc
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
312
14266
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
313 func Test_mksession_blank_tabs()
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
314 tabnew
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
315 tabnew
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
316 tabnew
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
317 tabnext 3
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
318 mksession! Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
319 tabnew
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
320 tabnew
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
321 tabnext 2
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
322 source Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
323 call assert_equal(4, tabpagenr('$'), 'session restore should restore number of tabs')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
324 call assert_equal(3, tabpagenr(), 'session restore should restore the active tab')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
325 call delete('Xtest_mks.out')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
326 endfunc
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
327
15643
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
328 func Test_mksession_buffer_count()
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
329 set hidden
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
330
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
331 " Edit exactly three files in the current session.
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
332 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
333 e Xfoo | tabe Xbar | tabe Xbaz
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
334 tabdo write
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
335 mksession! Xtest_mks.out
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
336
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
337 " Verify that loading the session does not create additional buffers.
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
338 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
339 source Xtest_mks.out
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
340 call assert_equal(3, len(getbufinfo()))
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
341
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
342 " Clean up.
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
343 call delete('Xfoo')
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
344 call delete('Xbar')
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
345 call delete('Xbaz')
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
346 call delete('Xtest_mks.out')
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
347 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
348 set hidden&
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
349 endfunc
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
350
15452
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
351 if has('extra_search')
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
352
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
353 func Test_mksession_hlsearch()
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
354 set hlsearch
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
355 mksession! Xtest_mks.out
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
356 nohlsearch
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
357 source Xtest_mks.out
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
358 call assert_equal(1, v:hlsearch, 'session should restore search highlighting state')
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
359 nohlsearch
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
360 mksession! Xtest_mks.out
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
361 source Xtest_mks.out
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
362 call assert_equal(0, v:hlsearch, 'session should restore search highlighting state')
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
363 call delete('Xtest_mks.out')
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
364 endfunc
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
365
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
366 endif
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
367
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
368
14266
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
369 func Test_mksession_blank_windows()
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
370 split
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
371 split
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
372 split
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
373 3 wincmd w
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
374 mksession! Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
375 split
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
376 split
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
377 2 wincmd w
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
378 source Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
379 call assert_equal(4, winnr('$'), 'session restore should restore number of windows')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
380 call assert_equal(3, winnr(), 'session restore should restore the active window')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
381 call delete('Xtest_mks.out')
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
382 endfunc
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
383
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
384 func Test_mksession_terminal_shell()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
385 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
386 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
387
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
388 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
389 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
390 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
391 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
392 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
393 if line =~ '^terminal'
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
394 let term_cmd = line
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
395 elseif line =~ 'badd.*' . &shell
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
396 call assert_report('unexpected shell line: ' . line)
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
397 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
398 endfor
15725
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15643
diff changeset
399 call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+\s*.*$', term_cmd)
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
400
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
401 call StopShellInTerminal(bufnr('%'))
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
402 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
403 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
404
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
405 func Test_mksession_terminal_no_restore_cmdarg()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
406 CheckFeature terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
407
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
408 terminal ++norestore
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
409 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
410 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
411 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
412 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
413 if line =~ '^terminal'
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
414 call assert_report('session must not restore terminal')
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
415 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
416 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
417
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
418 call StopShellInTerminal(bufnr('%'))
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
419 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
420 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
421
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
422 func Test_mksession_terminal_no_restore_funcarg()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
423 CheckFeature terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
424
24335
3f96a5dc0c53 patch 8.2.2708: test sometimes fails waiting for shell in terminal
Bram Moolenaar <Bram@vim.org>
parents: 24287
diff changeset
425 let buf = Run_shell_in_terminal({'norestore': 1})
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
426 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
427 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
428 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
429 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
430 if line =~ '^terminal'
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
431 call assert_report('session must not restore terminal')
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
432 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
433 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
434
24335
3f96a5dc0c53 patch 8.2.2708: test sometimes fails waiting for shell in terminal
Bram Moolenaar <Bram@vim.org>
parents: 24287
diff changeset
435 call StopShellInTerminal(buf)
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
436 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
437 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
438
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
439 func Test_mksession_terminal_no_restore_func()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
440 CheckFeature terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
441
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
442 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
443 call term_setrestore(bufnr('%'), 'NONE')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
444 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
445 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
446 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
447 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
448 if line =~ '^terminal'
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
449 call assert_report('session must not restore terminal')
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
450 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
451 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
452
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
453 call StopShellInTerminal(bufnr('%'))
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
454 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
455 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
456
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
457 func Test_mksession_terminal_no_ssop()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
458 CheckFeature terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
459
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
460 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
461 set sessionoptions-=terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
462 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
463 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
464 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
465 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
466 if line =~ '^terminal'
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
467 call assert_report('session must not restore terminal')
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
468 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
469 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
470
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
471 call StopShellInTerminal(bufnr('%'))
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
472 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
473 set sessionoptions&
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
474 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
475
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
476 func Test_mksession_terminal_restore_other()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
477 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
478 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
479
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
480 terminal
18033
049a7481d737 patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17586
diff changeset
481 eval bufnr('%')->term_setrestore('other')
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
482 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
483 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
484 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
485 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
486 if line =~ '^terminal'
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
487 let term_cmd = line
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
488 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
489 endfor
15725
a3e2e7948ee4 patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents: 15643
diff changeset
490 call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+.*other', term_cmd)
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
491
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
492 call StopShellInTerminal(bufnr('%'))
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
493 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
494 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
495
22226
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
496 func Test_mksession_terminal_shared_windows()
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
497 CheckFeature terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
498
22226
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
499 terminal
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
500 let term_buf = bufnr()
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
501 new
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
502 execute "buffer" term_buf
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
503 mksession! Xtest_mks.out
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
504
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
505 let lines = readfile('Xtest_mks.out')
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
506 let found_creation = 0
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
507 let found_use = 0
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
508
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
509 for line in lines
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
510 if line =~ '^terminal'
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
511 let found_creation = 1
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
512 call assert_match('terminal ++curwin ++cols=\d\+ ++rows=\d\+', line)
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
513 elseif line =~ "^execute 'buffer ' . s:term_buf_" . term_buf . "$"
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
514 let found_use = 1
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
515 endif
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
516 endfor
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
517
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
518 call assert_true(found_creation && found_use)
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
519
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
520 call StopShellInTerminal(term_buf)
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
521 call delete('Xtest_mks.out')
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
522 endfunc
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
523
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
524 func Test_mkview_terminal_windows()
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
525 CheckFeature terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
526
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
527 " create two window on the same terminal to check this is handled OK
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
528 terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
529 let term_buf = bufnr()
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
530 exe 'sbuf ' .. term_buf
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
531 mkview! Xtestview
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
532
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
533 call StopShellInTerminal(term_buf)
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
534 call delete('Xtestview')
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
535 endfunc
12289
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
536
23812
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
537 func Test_mkview_open_folds()
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
538 enew!
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
539
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
540 call append(0, ['a', 'b', 'c'])
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
541 1,3fold
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
542 " zR affects 'foldlevel', make sure the option is applied after the folds
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
543 " have been recreated.
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
544 normal zR
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
545 write! Xtestfile
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
546
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
547 call assert_equal(-1, foldclosed(1))
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
548 call assert_equal(-1, foldclosed(2))
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
549 call assert_equal(-1, foldclosed(3))
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
550
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
551 mkview! Xtestview
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
552 source Xtestview
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
553
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
554 call assert_equal(-1, foldclosed(1))
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
555 call assert_equal(-1, foldclosed(2))
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
556 call assert_equal(-1, foldclosed(3))
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
557
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
558 call delete('Xtestview')
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
559 call delete('Xtestfile')
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
560 %bwipe
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
561 endfunc
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
562
23851
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
563 func Test_mkview_no_balt()
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
564 edit Xtestfile1
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
565 edit Xtestfile2
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
566
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
567 mkview! Xtestview
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
568 bdelete Xtestfile1
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
569
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
570 source Xtestview
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
571 call assert_equal(0, buflisted('Xtestfile1'))
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
572
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
573 call delete('Xtestview')
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
574 %bwipe
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
575 endfunc
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
576
24106
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
577 func Test_mksession_no_balt()
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
578 edit Xtestfile1
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
579 edit Xtestfile2
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
580
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
581 bdelete Xtestfile1
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
582 mksession! Xtestview
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
583
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
584 source Xtestview
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
585 call assert_equal(0, buflisted('Xtestfile1'))
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
586
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
587 call delete('Xtestview')
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
588 %bwipe
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
589 endfunc
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
590
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
591 " Test :mkview with a file argument.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
592 func Test_mkview_file()
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
593 " Create a view with line number and a fold.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
594 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
595 set number
14644
3d94bbf54530 patch 8.1.0335: mkview test fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14640
diff changeset
596 norm! V}zf0
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
597 let pos = getpos('.')
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
598 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
599 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
600 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
601 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
602 " We can close the help window, as mkview with a file name should
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
603 " generate a command to edit the file.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
604 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
605
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
606 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
607 call assert_equal(1, &number)
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
608 call assert_match('\*:mkview\*$', getline('.'))
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
609 call assert_equal(pos, getpos('.'))
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
610 call assert_equal(linefoldclosed1, foldclosed('.'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
611
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
612 " Creating a view again with the same file name should fail (file
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
613 " already exists). But with a !, the previous view should be
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
614 " overwritten without error.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
615 help :loadview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
616 call assert_fails('mkview Xview', 'E189:')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
617 call assert_match('\*:loadview\*$', getline('.'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
618 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
619 call assert_match('\*:loadview\*$', getline('.'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
620
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
621 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
622 bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
623 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
624
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
625 " Test :mkview and :loadview with a custom 'viewdir'.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
626 func Test_mkview_loadview_with_viewdir()
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
627 set viewdir=Xviewdir
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
628
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
629 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
630 set number
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
631 norm! V}zf
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
632 let pos = getpos('.')
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
633 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
634 mkview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
635 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
636 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
637
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
638 loadview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
639
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
640 " The directory Xviewdir/ should have been created and the view
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
641 " should be stored in that directory.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
642 call assert_equal('Xviewdir/' .
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
643 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
644 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
645 \ expand('%:p'), '/', '=+', 'g'), ':', '=-', 'g') . '=1.vim',
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
646 \ glob('Xviewdir/*'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
647 call assert_equal(1, &number)
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
648 call assert_match('\*:mkview\*$', getline('.'))
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
649 call assert_equal(pos, getpos('.'))
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
650 call assert_equal(linefoldclosed1, foldclosed('.'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
651
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
652 call delete('Xviewdir', 'rf')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
653 set viewdir&
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
654 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
655 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
656
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
657 func Test_mkview_no_file_name()
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
658 new
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
659 " :mkview or :mkview {nr} should fail in a unnamed buffer.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
660 call assert_fails('mkview', 'E32:')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
661 call assert_fails('mkview 1', 'E32:')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
662
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
663 " :mkview {file} should succeed in a unnamed buffer.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
664 mkview Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
665 help
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
666 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
667 call assert_equal('', bufname('%'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
668
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
669 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
670 %bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
671 endfunc
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
672
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
673 func Test_mkview_loadview_jumplist()
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
674 set viewdir=Xviewdir
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
675 au BufWinLeave * silent mkview
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
676 au BufWinEnter * silent loadview
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
677
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
678 edit Xfile1
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
679 call setline(1, ['a', 'bbbbbbb', 'c'])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
680 normal j3l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
681 call assert_equal([2, 4], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
682 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
683
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
684 edit Xfile2
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
685 call setline(1, ['d', 'eeeeeee', 'f'])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
686 normal j5l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
687 call assert_equal([2, 6], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
688 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
689
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
690 edit Xfile3
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
691 call setline(1, ['g', 'h', 'iiiii'])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
692 normal jj3l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
693 call assert_equal([3, 4], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
694 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
695
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
696 edit Xfile1
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
697 call assert_equal([2, 4], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
698 edit Xfile2
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
699 call assert_equal([2, 6], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
700 edit Xfile3
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
701 call assert_equal([3, 4], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
702
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
703 exe "normal \<C-O>"
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
704 call assert_equal('Xfile2', expand('%'))
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
705 call assert_equal([2, 6], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
706 exe "normal \<C-O>"
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
707 call assert_equal('Xfile1', expand('%'))
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
708 call assert_equal([2, 4], getcurpos()[1:2])
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
709
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
710 au! BufWinLeave
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
711 au! BufWinEnter
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
712 bwipe!
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
713 call delete('Xviewdir', 'rf')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
714 call delete('Xfile1')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
715 call delete('Xfile2')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
716 call delete('Xfile3')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
717 set viewdir&
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
718 endfunc
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
719
15563
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
720 " A clean session (one empty buffer, one window, and one tab) should not
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
721 " set any error messages when sourced because no commands should fail.
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
722 func Test_mksession_no_errmsg()
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
723 let v:errmsg = ''
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
724 %bwipe!
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
725 mksession! Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
726 source Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
727 call assert_equal('', v:errmsg)
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
728 call delete('Xtest_mks.out')
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
729 endfunc
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
730
15591
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
731 func Test_mksession_quote_in_filename()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
732 " only Unix can handle this weird filename
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
733 CheckUnix
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
734
15591
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
735 let v:errmsg = ''
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
736 %bwipe!
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
737 split another
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
738 split x'y\"z
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
739 mksession! Xtest_mks_quoted.out
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
740 %bwipe!
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
741 source Xtest_mks_quoted.out
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
742 call assert_true(bufexists("x'y\"z"))
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
743
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
744 %bwipe!
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
745 call delete('Xtest_mks_quoted.out')
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
746 endfunc
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
747
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
748 " Test for storing global variables in a session file
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
749 func Test_mksession_globals()
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
750 set sessionoptions+=globals
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
751
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
752 " create different global variables
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
753 let g:Global_string = "Sun is shining\r\n"
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
754 let g:Global_count = 100
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
755 let g:Global_pi = 3.14
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
756 let g:Global_neg_float = -2.68
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
757
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
758 mksession! Xtest_mks.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
759
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
760 unlet g:Global_string
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
761 unlet g:Global_count
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
762 unlet g:Global_pi
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
763 unlet g:Global_neg_float
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
764
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
765 source Xtest_mks.out
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
766 call assert_equal("Sun is shining\r\n", g:Global_string)
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
767 call assert_equal(100, g:Global_count)
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
768 call assert_equal(3.14, g:Global_pi)
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
769 call assert_equal(-2.68, g:Global_neg_float)
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
770
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
771 unlet g:Global_string
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
772 unlet g:Global_count
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
773 unlet g:Global_pi
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
774 unlet g:Global_neg_float
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
775 call delete('Xtest_mks.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
776 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
777 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
778
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
779 " Test for changing backslash to forward slash in filenames
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
780 func Test_mksession_slash()
18207
f93c2b6f7167 patch 8.1.2098: mksession test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 18205
diff changeset
781 if exists('+shellslash')
f93c2b6f7167 patch 8.1.2098: mksession test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 18205
diff changeset
782 throw 'Skipped: cannot use backslash in file name'
f93c2b6f7167 patch 8.1.2098: mksession test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 18205
diff changeset
783 endif
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
784 enew
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
785 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
786 e a\\b\\c
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
787 mksession! Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
788 set sessionoptions+=slash
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
789 mksession! Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
790
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
791 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
792 source Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
793 call assert_equal('a\b\c', bufname(''))
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
794 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
795 source Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
796 call assert_equal('a/b/c', bufname(''))
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
797
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
798 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
799 call delete('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
800 call delete('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
801 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
802 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
803
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
804 " Test for changing directory to the session file directory
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
805 func Test_mksession_sesdir()
18564
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
806 let save_cwd = getcwd()
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
807 call mkdir('Xproj')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
808 mksession! Xproj/Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
809 set sessionoptions-=curdir
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
810 set sessionoptions+=sesdir
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
811 mksession! Xproj/Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
812
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
813 source Xproj/Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
814 call assert_equal('testdir', fnamemodify(getcwd(), ':t'))
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
815 source Xproj/Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
816 call assert_equal('Xproj', fnamemodify(getcwd(), ':t'))
18564
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
817 call chdir(save_cwd)
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
818 %bwipe
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
819
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
820 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
821 call delete('Xproj', 'rf')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
822 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
823
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
824 " Test for storing the 'lines' and 'columns' settings
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
825 func Test_mksession_resize()
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
826 mksession! Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
827 set sessionoptions+=resize
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
828 mksession! Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
829
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
830 let lines = readfile('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
831 let found_resize = v:false
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
832 for line in lines
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
833 if line =~ '^set lines='
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
834 let found_resize = v:true
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
835 break
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
836 endif
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
837 endfor
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
838 call assert_false(found_resize)
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
839 let lines = readfile('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
840 let found_resize = v:false
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
841 for line in lines
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
842 if line =~ '^set lines='
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
843 let found_resize = v:true
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
844 break
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
845 endif
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
846 endfor
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
847 call assert_true(found_resize)
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
848
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
849 call delete('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
850 call delete('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
851 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
852 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
853
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
854 " Test for mksession with a named scratch buffer
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
855 func Test_mksession_scratch()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
856 enew | only
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
857 file Xscratch
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
858 set buftype=nofile
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
859 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
860 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
861 source Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
862 call assert_equal('Xscratch', bufname(''))
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
863 call assert_equal('nofile', &buftype)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
864 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
865 call delete('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
866 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
867
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
868 " Test for mksession with fold options
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
869 func Test_mksession_foldopt()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
870 set sessionoptions-=options
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
871 set sessionoptions+=folds
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
872 new
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
873 setlocal foldenable
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
874 setlocal foldmethod=expr
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
875 setlocal foldmarker=<<<,>>>
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
876 setlocal foldignore=%
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
877 setlocal foldlevel=2
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
878 setlocal foldminlines=10
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
879 setlocal foldnestmax=15
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
880 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
881 close
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
882 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
883
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
884 source Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
885 call assert_true(&foldenable)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
886 call assert_equal('expr', &foldmethod)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
887 call assert_equal('<<<,>>>', &foldmarker)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
888 call assert_equal('%', &foldignore)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
889 call assert_equal(2, &foldlevel)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
890 call assert_equal(10, &foldminlines)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
891 call assert_equal(15, &foldnestmax)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
892
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
893 close
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
894 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
895 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
896 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
897
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
898 " Test for mksession with window position
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
899 func Test_mksession_winpos()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
900 " Only applicable in GUI Vim
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
901 CheckGui
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
902
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
903 set sessionoptions+=winpos
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
904 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
905 let found_winpos = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
906 let lines = readfile('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
907 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
908 if line =~ '^winpos '
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
909 let found_winpos = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
910 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
911 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
912 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
913 call assert_true(found_winpos)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
914 call delete('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
915 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
916 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
917
24473
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
918 " Test for mksession without options restores winminheight
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
919 func Test_mksession_winminheight()
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
920 set sessionoptions-=options
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
921 split
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
922 mksession! Xtest_mks.out
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
923 let found_restore = 0
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
924 let lines = readfile('Xtest_mks.out')
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
925 for line in lines
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
926 if line =~ '= s:save_winmin\(width\|height\)'
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
927 let found_restore += 1
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
928 endif
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
929 endfor
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
930 call assert_equal(2, found_restore)
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
931 call delete('Xtest_mks.out')
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
932 close
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
933 set sessionoptions&
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
934 endfunc
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
935
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
936 " Test for mksession with 'compatible' option
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
937 func Test_mksession_compatible()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
938 mksession! Xtest_mks1.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
939 set compatible
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
940 mksession! Xtest_mks2.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
941 set nocp
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
942
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
943 let test_success = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
944 let lines = readfile('Xtest_mks1.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
945 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
946 if line =~ '^if &cp | set nocp | endif'
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
947 let test_success = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
948 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
949 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
950 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
951 call assert_true(test_success)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
952
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
953 let test_success = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
954 let lines = readfile('Xtest_mks2.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
955 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
956 if line =~ '^if !&cp | set cp | endif'
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
957 let test_success = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
958 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
959 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
960 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
961 call assert_true(test_success)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
962
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
963 call delete('Xtest_mks1.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
964 call delete('Xtest_mks2.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
965 set compatible&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
966 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
967 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
968
17586
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
969 func s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
970 mapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
971 omapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
972 mapclear!
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
973 lmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
974 tmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
975 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
976
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
977 func Test_mkvimrc()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
978 let entries = [
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
979 \ ['', 'nothing', '<Nop>'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
980 \ ['n', 'normal', 'NORMAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
981 \ ['v', 'visual', 'VISUAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
982 \ ['s', 'select', 'SELECT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
983 \ ['x', 'visualonly', 'VISUALONLY'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
984 \ ['o', 'operator', 'OPERATOR'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
985 \ ['i', 'insert', 'INSERT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
986 \ ['l', 'lang', 'LANG'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
987 \ ['c', 'command', 'COMMAND'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
988 \ ['t', 'terminal', 'TERMINAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
989 \ ]
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
990 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
991 exe entry[0] .. 'map ' .. entry[1] .. ' ' .. entry[2]
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
992 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
993
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
994 mkvimrc Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
995
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
996 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
997 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
998 call assert_equal('', maparg(entry[1], entry[0]))
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
999 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1000
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1001 source Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1002
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1003 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1004 call assert_equal(entry[2], maparg(entry[1], entry[0]))
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1005 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1006
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1007 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1008 call delete('Xtestvimrc')
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1009 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1010
22776
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1011 func Test_scrolloff()
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1012 set sessionoptions+=localoptions
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1013 setlocal so=1 siso=1
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1014 mksession! Xtest_mks.out
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1015 setlocal so=-1 siso=-1
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1016 source Xtest_mks.out
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1017 call assert_equal(1, &l:so)
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1018 call assert_equal(1, &l:siso)
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1019 call delete('Xtest_mks.out')
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1020 setlocal so& siso&
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1021 set sessionoptions&
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1022 endfunc
0583f3e2c12e patch 8.2.1936: session sets the local 'scrolloff' value to the global value
Bram Moolenaar <Bram@vim.org>
parents: 22230
diff changeset
1023
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1024 func Test_altfile()
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1025 edit Xone
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1026 split Xtwo
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1027 edit Xtwoalt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1028 edit #
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1029 wincmd w
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1030 edit Xonealt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1031 edit #
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1032 mksession! Xtest_altfile
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1033 only
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1034 bwipe Xonealt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1035 bwipe Xtwoalt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1036 bwipe!
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1037 source Xtest_altfile
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1038 call assert_equal('Xone', bufname())
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1039 call assert_equal('Xonealt', bufname('#'))
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1040 wincmd w
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1041 call assert_equal('Xtwo', bufname())
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1042 call assert_equal('Xtwoalt', bufname('#'))
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1043 only
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1044 bwipe!
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
1045 call delete('Xtest_altfile')
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1046 endfunc
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1047
24287
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1048 " Test for creating views with manual folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1049 func Test_mkview_manual_fold()
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1050 call writefile(range(1,10), 'Xfile')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1051 new Xfile
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1052 " create recursive folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1053 5,6fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1054 4,7fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1055 mkview Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1056 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1057 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1058 call assert_equal([-1, 4, 4, 4, 4, -1], [foldclosed(3), foldclosed(4),
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1059 \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1060 " open one level of fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1061 4foldopen
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1062 mkview! Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1063 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1064 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1065 call assert_equal([-1, -1, 5, 5, -1, -1], [foldclosed(3), foldclosed(4),
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1066 \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1067 " open all the folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1068 %foldopen!
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1069 mkview! Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1070 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1071 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1072 call assert_equal([-1, -1, -1, -1, -1, -1], [foldclosed(3), foldclosed(4),
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1073 \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1074 call delete('Xfile')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1075 call delete('Xview')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1076 bw!
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1077 endfunc
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1078
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1079 " vim: shiftwidth=2 sts=2 expandtab