annotate src/testdir/test_mksession.vim @ 24464:a56f9c2ba51c v8.2.2772

patch 8.2.2772: problems when restoring 'runtimepath' from a session file Commit: https://github.com/vim/vim/commit/635bd60804966803490287e97460ecdc91d5fe0a Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 16 19:58:22 2021 +0200 patch 8.2.2772: problems when restoring 'runtimepath' from a session file Problem: Problems when restoring 'runtimepath' from a session file. Solution: Add the "skiprtp" item in 'sessionoptions'.
author Bram Moolenaar <Bram@vim.org>
date Fri, 16 Apr 2021 20:00:05 +0200
parents 3f96a5dc0c53
children b2484fa6cb02
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
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
136 var found = 0
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
137 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
138 if line =~ 'set runtimepath'
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
139 found = 1
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
140 break
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
141 endif
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
142 endfor
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
143 assert_equal(1, found)
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
144 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
145
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
146 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
147 mksession! 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
148 found = 0
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
149 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
150 if line =~ 'set runtimepath'
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
151 found = 1
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
152 break
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
153 endif
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
154 endfor
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
155 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
156 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
157 set sessionoptions&
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
158 enddef
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
159
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
160 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
161 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
162 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
163 set winminheight=2
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
164 mksession! Xtest_mks.out
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
165 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
166
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
167 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
168 endfunc
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
169
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
170 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
171 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
172 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
173 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
174 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
175 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
176 endfunc
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
177
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
178 func Test_mksession_rtp()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
179 " 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
180 CheckNotMSWindows
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
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 new
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
183 let _rtp=&rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
184 " 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
185 " 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
186 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
187 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
188 let &rtp=newrtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
189
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
190 " determine expected value
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
191 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
192 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
193 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
194 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
195
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
196 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
197 let &rtp=_rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
198 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
199 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
200
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
201 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
202 endfunc
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
203
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
204 func Test_mksession_arglist()
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
205 %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
206 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
207 new
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
208 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
209 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
210 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
211 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
212 call assert_equal(2, argidx())
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
213 wincmd w
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
214 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
215
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
216 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
217 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
218 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
219 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
220
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
221 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
222 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
223 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
224 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
225 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
226 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
227 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
228 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
229 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
230 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
231 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
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 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
240 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
241 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
242 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
243 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
244
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 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
246 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
247 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
248 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
249
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
250 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
251 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
252 tabnew
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
253 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
254 tabfirst
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
255 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
256 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
257 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
258 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
259 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
260 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
261 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
262 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
263 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
264 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
265 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
266
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
267 " 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
268 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
269 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
270 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
271 cd Xtopdir
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
272 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
273 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
274 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
275 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
276 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
277 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
278 tcd Xtabdir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
279 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
280 wincmd t
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
281 lcd ../Xwindir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
282 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
283 tcd ../Xtabdir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
284 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
285 lcd ../Xwindir2
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 ../Xtabdir3
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 ../Xwindir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
290 tabfirst
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
291 1wincmd w
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
292 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
293 only | tabonly
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
294 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
295 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
296 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
297 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
298 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
299 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
300 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
301 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
302 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
303 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
304 %bwipe
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
305 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
306 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
307 endfunc
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
308
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
309 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
310 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
311 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
312 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
313 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
314 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
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 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
318 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
319 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
320 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
321 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
322 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
323
15643
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
324 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
325 set hidden
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
326
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
327 " 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
328 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
329 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
330 tabdo write
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
331 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
332
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
333 " 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
334 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
335 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
336 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
337
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
338 " Clean up.
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
339 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
340 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
341 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
342 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
343 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
344 set hidden&
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
345 endfunc
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
346
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
347 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
348
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
349 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
350 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
351 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
352 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
353 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
354 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
355 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
356 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
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(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
359 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
360 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
361
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 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
363
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
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
365 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
366 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
367 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
368 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
369 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
370 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
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 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
374 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
375 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
376 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
377 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
378 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
379
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
380 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
381 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
382 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
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 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
385 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
386 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
387 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
388 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
389 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
390 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
391 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
392 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
393 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
394 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
395 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
396
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
397 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
398 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
399 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
400
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
401 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
402 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
403
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
412 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
413
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
414 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
415 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
416 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
417
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
418 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
419 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
420
24335
3f96a5dc0c53 patch 8.2.2708: test sometimes fails waiting for shell in terminal
Bram Moolenaar <Bram@vim.org>
parents: 24287
diff changeset
421 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
422 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
423 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
424 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
425 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
426 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
427 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
428 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
429 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
430
24335
3f96a5dc0c53 patch 8.2.2708: test sometimes fails waiting for shell in terminal
Bram Moolenaar <Bram@vim.org>
parents: 24287
diff changeset
431 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
432 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
433 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
434
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
435 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
436 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
437
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
438 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
439 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
440 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
441 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
442 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
443 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
444 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
445 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
446 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
447 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
448
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
449 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
450 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
451 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
452
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
453 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
454 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
455
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
456 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
465 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
466
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
467 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
468 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
469 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
470 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
471
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
472 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
473 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
474 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
475
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
476 terminal
18033
049a7481d737 patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17586
diff changeset
477 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
478 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
479 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
480 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
481 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
482 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
483 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
484 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
485 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
486 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
487
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
488 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
489 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
490 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
491
22226
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
492 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
493 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
494
22226
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
495 terminal
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
496 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
497 new
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
498 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
499 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
500
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
501 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
502 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
503 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
504
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
505 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
506 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
507 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
508 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
509 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
510 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
511 endif
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
512 endfor
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
513
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
514 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
515
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
516 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
517 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
518 endfunc
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
519
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
520 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
521 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
522
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
523 " 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
524 terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
525 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
526 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
527 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
528
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
529 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
530 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
531 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
532
23812
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
533 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
534 enew!
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
535
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
536 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
537 1,3fold
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
538 " 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
539 " 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
540 normal zR
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
541 write! Xtestfile
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
542
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
543 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
544 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
545 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
546
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
547 mkview! Xtestview
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
548 source Xtestview
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
549
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
550 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
551 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
552 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
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 delete('Xtestview')
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
555 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
556 %bwipe
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
557 endfunc
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
558
23851
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
559 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
560 edit Xtestfile1
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
561 edit Xtestfile2
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
562
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
563 mkview! Xtestview
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
564 bdelete Xtestfile1
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
565
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
566 source Xtestview
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
567 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
568
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
569 call delete('Xtestview')
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
570 %bwipe
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
571 endfunc
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
572
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
573 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
574 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
575 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
576
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 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
578 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
579
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 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
581 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
582
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 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
584 %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
585 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
586
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
587 " 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
588 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
589 " 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
590 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
591 set number
14644
3d94bbf54530 patch 8.1.0335: mkview test fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14640
diff changeset
592 norm! V}zf0
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
593 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
594 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
595 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
596 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
597 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
598 " 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
599 " 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
600 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
601
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
602 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
603 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
604 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
605 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
606 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
607
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
608 " 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
609 " 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
610 " overwritten without error.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
611 help :loadview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
612 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
613 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
614 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
615 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
616
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
617 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
618 bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
619 endfunc
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 " 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
622 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
623 set viewdir=Xviewdir
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 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
626 set number
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
627 norm! V}zf
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
628 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
629 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
630 mkview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
631 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
632 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
633
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
634 loadview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
636 " 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
637 " 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
638 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
639 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
640 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
641 \ 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
642 \ glob('Xviewdir/*'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
643 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
644 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
645 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
646 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
647
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
648 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
649 set viewdir&
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
650 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
651 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
652
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
653 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
654 new
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
655 " :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
656 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
657 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
658
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
659 " :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
660 mkview Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
661 help
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
662 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
663 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
664
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
665 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
666 %bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
667 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
668
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
669 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
670 set viewdir=Xviewdir
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
671 au BufWinLeave * silent mkview
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
672 au BufWinEnter * silent loadview
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
673
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
674 edit Xfile1
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
675 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
676 normal j3l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
677 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
678 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
679
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
680 edit Xfile2
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
681 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
682 normal j5l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
683 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
684 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
685
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
686 edit Xfile3
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
687 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
688 normal jj3l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
689 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
690 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
691
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
692 edit Xfile1
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
693 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
694 edit Xfile2
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
695 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
696 edit Xfile3
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
697 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
698
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
699 exe "normal \<C-O>"
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
700 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
701 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
702 exe "normal \<C-O>"
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
703 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
704 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
705
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
706 au! BufWinLeave
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
707 au! BufWinEnter
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
708 bwipe!
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
709 call delete('Xviewdir', 'rf')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
710 call delete('Xfile1')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
711 call delete('Xfile2')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
712 call delete('Xfile3')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
713 set viewdir&
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
714 endfunc
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
715
15563
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
716 " 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
717 " 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
718 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
719 let v:errmsg = ''
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
720 %bwipe!
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
721 mksession! Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
722 source Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
723 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
724 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
725 endfunc
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
726
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
727 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
728 " 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
729 CheckUnix
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
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 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
732 %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
733 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
734 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
735 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
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 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
738 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
739
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 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
742 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
743
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
744 " 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
745 func Test_mksession_globals()
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
746 set sessionoptions+=globals
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
747
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
748 " create different global variables
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
749 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
750 let g:Global_count = 100
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
751 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
752 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
753
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
754 mksession! Xtest_mks.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
755
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
756 unlet g:Global_string
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
757 unlet g:Global_count
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
758 unlet g:Global_pi
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
759 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
760
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
761 source Xtest_mks.out
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
762 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
763 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
764 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
765 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
766
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
767 unlet g:Global_string
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
768 unlet g:Global_count
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
769 unlet g:Global_pi
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
770 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
771 call delete('Xtest_mks.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
772 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
773 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
774
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
775 " 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
776 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
777 if exists('+shellslash')
f93c2b6f7167 patch 8.1.2098: mksession test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 18205
diff changeset
778 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
779 endif
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
780 enew
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
781 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
782 e a\\b\\c
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
783 mksession! Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
784 set sessionoptions+=slash
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
785 mksession! Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
786
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
787 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
788 source Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
789 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
790 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
791 source Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
792 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
793
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 call delete('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
796 call delete('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
797 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
798 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
799
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
800 " 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
801 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
802 let save_cwd = getcwd()
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
803 call mkdir('Xproj')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
804 mksession! Xproj/Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
805 set sessionoptions-=curdir
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
806 set sessionoptions+=sesdir
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
807 mksession! Xproj/Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
808
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
809 source Xproj/Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
810 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
811 source Xproj/Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
812 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
813 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
814 %bwipe
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
815
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
816 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
817 call delete('Xproj', 'rf')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
818 endfunc
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 " 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
821 func Test_mksession_resize()
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
822 mksession! Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
823 set sessionoptions+=resize
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
824 mksession! Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
825
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
826 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
827 let found_resize = v:false
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
828 for line in lines
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
829 if line =~ '^set lines='
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
830 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
831 break
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
832 endif
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
833 endfor
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
834 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
835 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
836 let found_resize = v:false
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
837 for line in lines
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
838 if line =~ '^set lines='
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
839 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
840 break
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
841 endif
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
842 endfor
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
843 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
844
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
845 call delete('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
846 call delete('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
847 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
848 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
849
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
850 " 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
851 func Test_mksession_scratch()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
852 enew | only
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
853 file Xscratch
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
854 set buftype=nofile
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
855 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
856 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
857 source Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
858 call assert_equal('Xscratch', bufname(''))
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
859 call assert_equal('nofile', &buftype)
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 call delete('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
862 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
863
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
864 " 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
865 func Test_mksession_foldopt()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
866 set sessionoptions-=options
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
867 set sessionoptions+=folds
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
868 new
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
869 setlocal foldenable
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
870 setlocal foldmethod=expr
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
871 setlocal foldmarker=<<<,>>>
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
872 setlocal foldignore=%
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
873 setlocal foldlevel=2
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
874 setlocal foldminlines=10
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
875 setlocal foldnestmax=15
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
876 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
877 close
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
878 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
879
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
880 source Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
881 call assert_true(&foldenable)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
882 call assert_equal('expr', &foldmethod)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
883 call assert_equal('<<<,>>>', &foldmarker)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
884 call assert_equal('%', &foldignore)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
885 call assert_equal(2, &foldlevel)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
886 call assert_equal(10, &foldminlines)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
887 call assert_equal(15, &foldnestmax)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
888
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
889 close
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
890 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
891 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
892 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
893
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
894 " 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
895 func Test_mksession_winpos()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
896 " Only applicable in GUI Vim
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
897 CheckGui
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
898
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
899 set sessionoptions+=winpos
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
900 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
901 let found_winpos = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
902 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
903 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
904 if line =~ '^winpos '
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
905 let found_winpos = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
906 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
907 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
908 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
909 call assert_true(found_winpos)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
910 call delete('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
911 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
912 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
913
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
914 " 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
915 func Test_mksession_compatible()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
916 mksession! Xtest_mks1.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
917 set compatible
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
918 mksession! Xtest_mks2.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
919 set nocp
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
920
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
921 let test_success = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
922 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
923 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
924 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
925 let test_success = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
926 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
927 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
928 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
929 call assert_true(test_success)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
930
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
931 let test_success = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
932 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
933 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
934 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
935 let test_success = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
936 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
937 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
938 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
939 call assert_true(test_success)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
940
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
941 call delete('Xtest_mks1.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
942 call delete('Xtest_mks2.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
943 set compatible&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
944 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
945 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
946
17586
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
947 func s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
948 mapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
949 omapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
950 mapclear!
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
951 lmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
952 tmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
953 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
954
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
955 func Test_mkvimrc()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
956 let entries = [
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
957 \ ['', 'nothing', '<Nop>'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
958 \ ['n', 'normal', 'NORMAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
959 \ ['v', 'visual', 'VISUAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
960 \ ['s', 'select', 'SELECT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
961 \ ['x', 'visualonly', 'VISUALONLY'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
962 \ ['o', 'operator', 'OPERATOR'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
963 \ ['i', 'insert', 'INSERT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
964 \ ['l', 'lang', 'LANG'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
965 \ ['c', 'command', 'COMMAND'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
966 \ ['t', 'terminal', 'TERMINAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
967 \ ]
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
968 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
969 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
970 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
971
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
972 mkvimrc Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
973
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
974 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
975 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
976 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
977 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
978
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
979 source Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
980
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
981 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
982 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
983 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
984
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
985 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
986 call delete('Xtestvimrc')
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
987 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
988
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
989 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
990 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
991 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
992 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
993 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
994 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
995 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
996 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
997 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
998 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
999 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
1000 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
1001
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1002 func Test_altfile()
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1003 edit Xone
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1004 split Xtwo
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1005 edit Xtwoalt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1006 edit #
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1007 wincmd w
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1008 edit Xonealt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1009 edit #
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1010 mksession! Xtest_altfile
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1011 only
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1012 bwipe Xonealt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1013 bwipe Xtwoalt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1014 bwipe!
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1015 source Xtest_altfile
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1016 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
1017 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
1018 wincmd w
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1019 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
1020 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
1021 only
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1022 bwipe!
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
1023 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
1024 endfunc
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1025
24287
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1026 " 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
1027 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
1028 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
1029 new Xfile
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1030 " create recursive folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1031 5,6fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1032 4,7fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1033 mkview Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1034 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1035 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1036 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
1037 \ 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
1038 " 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
1039 4foldopen
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1040 mkview! Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1041 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1042 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1043 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
1044 \ 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
1045 " open all the folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1046 %foldopen!
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1047 mkview! Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1048 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1049 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1050 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
1051 \ 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
1052 call delete('Xfile')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1053 call delete('Xview')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1054 bw!
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1055 endfunc
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1056
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1057 " vim: shiftwidth=2 sts=2 expandtab