annotate src/testdir/test_mksession.vim @ 23812:84089558c5df v8.2.2447

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