annotate src/testdir/test_mksession.vim @ 29226:699fbccbeab8 v8.2.5132

patch 8.2.5132: :mkview test doesn't test much Commit: https://github.com/vim/vim/commit/c829faa8211df52997c0b9ee49cdea0c8786b177 Author: James McCoy <jamessan@jamessan.com> Date: Sun Jun 19 17:16:18 2022 +0100 patch 8.2.5132: :mkview test doesn't test much Problem: :mkview test doesn't test much. Solution: Save the view with the folds closed. (James McCoy, closes https://github.com/vim/vim/issues/10596)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 18:30:03 +0200
parents 6c67aeb82b65
children 13b02c1ea0f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for :mksession, :mkview and :loadview in latin1 encoding
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 set encoding=latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 scriptencoding latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
6 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
7 CheckFeature mksession
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
9 source shared.vim
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
10 source term_util.vim
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
11
18562
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
12 " Test for storing global and local argument list in a session file
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
13 " This one must be done first.
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
14 func Test__mksession_arglocal()
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
15 enew | only
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
16 n a b c
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
17 new
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
18 arglocal
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
19 mksession! Xtest_mks.out
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
20
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
21 %bwipe!
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
22 %argdelete
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
23 argglobal
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
24 source Xtest_mks.out
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
25 call assert_equal(2, winnr('$'))
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
26 call assert_equal(2, arglistid(1))
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
27 call assert_equal(0, arglistid(2))
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
28
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
29 %bwipe!
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
30 %argdelete
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
31 argglobal
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
32 call delete('Xtest_mks.out')
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
33 endfunc
ecbe15ce5918 patch 8.1.2275: using "seesion" looks like a mistake
Bram Moolenaar <Bram@vim.org>
parents: 18211
diff changeset
34
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 func Test_mksession()
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 tabnew
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 let wrap_save = &wrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 set sessionoptions=buffers splitbelow fileencoding=latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call setline(1, [
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ 'start:',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 \ 'no multibyte chAracter',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 \ ' one leaDing tab',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 \ ' four leadinG spaces',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 \ 'two consecutive tabs',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 \ 'two tabs in one line',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 \ 'one ä multibyteCharacter',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 \ 'aä Ä two multiByte characters',
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
48 \ 'Aäöü three mulTibyte characters',
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
49 \ 'short line',
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ ])
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
51 let tmpfile = 'Xtemp'
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 exec 'w! ' . tmpfile
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 /^start:
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 set wrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 vsplit
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 norm! j8|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 norm! j8|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 norm! j16|
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
71 split
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
72 norm! j$
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 wincmd l
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 set nowrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 /^start:
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 norm! j16|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 norm! j08|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 norm! j08|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 norm! j016|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 call wincol()
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
94 mksession! Xtest_mks.out
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
95 let li = filter(readfile('Xtest_mks.out'), 'v:val =~# "\\(^ *normal! [0$]\\|^ *exe ''normal!\\)"')
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 let expected = [
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 \ 'normal! 08|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 \ 'normal! 08|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 \ 'normal! 016|',
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
105 \ 'normal! $',
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 \ " normal! 08|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 \ " normal! 08|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 \ " normal! 016|"
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 \ ]
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call assert_equal(expected, li)
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 tabclose!
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
128 call delete('Xtest_mks.out')
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call delete(tmpfile)
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 let &wrap = wrap_save
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
131 set sessionoptions&
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 endfunc
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
134 def Test_mksession_skiprtp()
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
135 mksession! Xtest_mks.out
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
136 var found_rtp = 0
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
137 var found_pp = 0
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
138 for line in readfile('Xtest_mks.out')
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
139 if line =~ 'set runtimepath'
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
140 found_rtp += 1
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
141 endif
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
142 if line =~ 'set packpath'
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
143 found_pp += 1
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
144 endif
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
145 endfor
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
146 assert_equal(1, found_rtp)
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
147 assert_equal(1, found_pp)
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
148 delete('Xtest_mks.out')
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
149
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
150 set sessionoptions+=skiprtp
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
151 mksession! Xtest_mks.out
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
152 var found = 0
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
153 for line in readfile('Xtest_mks.out')
24476
e79d1475fc89 patch 8.2.2778: problem restoring 'packpath' in session
Bram Moolenaar <Bram@vim.org>
parents: 24473
diff changeset
154 if line =~ 'set \(runtimepath\|packpath\)'
24464
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
155 found = 1
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
156 break
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
157 endif
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
158 endfor
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
159 assert_equal(0, found)
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
160 delete('Xtest_mks.out')
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
161 set sessionoptions&
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
162 enddef
a56f9c2ba51c patch 8.2.2772: problems when restoring 'runtimepath' from a session file
Bram Moolenaar <Bram@vim.org>
parents: 24335
diff changeset
163
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
164 func Test_mksession_winheight()
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
165 new
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
166 set winheight=10
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
167 set winminheight=2
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
168 mksession! Xtest_mks.out
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
169 source Xtest_mks.out
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
170
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
171 call delete('Xtest_mks.out')
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
172 endfunc
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
173
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
174 func Test_mksession_large_winheight()
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
175 set winheight=999
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
176 mksession! Xtest_mks_winheight.out
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
177 set winheight&
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
178 source Xtest_mks_winheight.out
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
179 call delete('Xtest_mks_winheight.out')
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
180 endfunc
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
181
24561
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
182 func Test_mksession_zero_winheight()
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
183 set winminheight=0
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
184 edit SomeFile
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
185 split
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
186 wincmd _
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
187 mksession! Xtest_mks_zero
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
188 set winminheight&
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
189 let text = readfile('Xtest_mks_zero')->join()
24576
b39b56c0debc patch 8.2.2827: test file was not deleted
Bram Moolenaar <Bram@vim.org>
parents: 24561
diff changeset
190 call delete('Xtest_mks_zero')
24561
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
191 close
24576
b39b56c0debc patch 8.2.2827: test file was not deleted
Bram Moolenaar <Bram@vim.org>
parents: 24561
diff changeset
192 " check there is no divide by zero
24561
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
193 call assert_notmatch('/ 0[^0-9]', text)
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
194 endfunc
f6049d3ab81c patch 8.2.2820: session file may divide by zero
Bram Moolenaar <Bram@vim.org>
parents: 24476
diff changeset
195
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
196 func Test_mksession_rtp()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
197 " 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
198 CheckNotMSWindows
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
199
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
200 new
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
201 let _rtp=&rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
202 " 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
203 " 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
204 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
205 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
206 let &rtp=newrtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
207
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
208 " determine expected value
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
209 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
210 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
211 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
212 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
213
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
214 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
215 let &rtp=_rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
216 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
217 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
218
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
219 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
220 endfunc
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
221
10809
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
222 func Test_mksession_arglist()
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
223 %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
224 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
225 new
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
226 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
227 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
228 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
229 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
230 call assert_equal(2, argidx())
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
231 wincmd w
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
232 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
233
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
234 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
235 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
236 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
237 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
238
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
239 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
240 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
241 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
242 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
243 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
244 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
245 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
246 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
247 let count2buf = 0
28083
f1c00b8085f6 patch 8.2.4566: check for existing buffer in session file may not work
Bram Moolenaar <Bram@vim.org>
parents: 27122
diff changeset
248 let bufexists = 0
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
249 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
250 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
251 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
252 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
253 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
254 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
255 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
256 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
257 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
258 endif
28083
f1c00b8085f6 patch 8.2.4566: check for existing buffer in session file may not work
Bram Moolenaar <Bram@vim.org>
parents: 27122
diff changeset
259 if line =~ 'bufexists(fnamemodify(.*, ":p")'
f1c00b8085f6 patch 8.2.4566: check for existing buffer in session file may not work
Bram Moolenaar <Bram@vim.org>
parents: 27122
diff changeset
260 let bufexists += 1
f1c00b8085f6 patch 8.2.4566: check for existing buffer in session file may not work
Bram Moolenaar <Bram@vim.org>
parents: 27122
diff changeset
261 endif
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
262 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
263 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
264 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
265 call assert_equal(2, count2buf, 'Xtest2 buffer count')
28083
f1c00b8085f6 patch 8.2.4566: check for existing buffer in session file may not work
Bram Moolenaar <Bram@vim.org>
parents: 27122
diff changeset
266 call assert_equal(2, bufexists)
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
267
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
268 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
269 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
270 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
271 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
272
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
273 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
274 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
275 tabnew
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
276 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
277 tabfirst
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
278 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
279 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
280 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
281 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
282 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
283 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
284 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
285 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
286 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
287 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
288 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
289
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
290 " 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
291 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
292 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
293 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
294 cd Xtopdir
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
295 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
296 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
297 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
298 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
299 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
300 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
301 tcd Xtabdir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
302 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
303 wincmd t
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
304 lcd ../Xwindir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
305 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
306 tcd ../Xtabdir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
307 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
308 lcd ../Xwindir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
309 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
310 tcd ../Xtabdir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
311 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
312 lcd ../Xwindir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
313 tabfirst
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
314 1wincmd w
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
315 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
316 only | tabonly
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
317 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
318 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
319 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
320 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
321 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
322 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
323 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
324 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
325 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
326 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
327 %bwipe
c14f5d3a205d patch 8.1.2276: MS-Windows: session test leaves files behind
Bram Moolenaar <Bram@vim.org>
parents: 18562
diff changeset
328 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
329 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
330 endfunc
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
331
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
332 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
333 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
334 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
335 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
336 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
337 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
338 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
339 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
340 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
341 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
342 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
343 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
344 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
345 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
346
15643
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
347 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
348 set hidden
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
349
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
350 " 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
351 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
352 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
353 tabdo write
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
354 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
355
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
356 " 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
357 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
358 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
359 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
360
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
361 " Clean up.
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
362 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
363 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
364 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
365 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
366 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
367 set hidden&
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
368 endfunc
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
369
27122
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
370 func Test_mksession_buffer_order()
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
371 %bwipe!
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
372 e Xfoo | e Xbar | e Xbaz | e Xqux
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
373 bufdo write
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
374 mksession! Xtest_mks.out
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
375
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
376 " Verify that loading the session preserves order of buffers
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
377 %bwipe!
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
378 source Xtest_mks.out
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
379
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
380 let s:buf_info = getbufinfo()
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
381 call assert_true(s:buf_info[0]['name'] =~# 'Xfoo$')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
382 call assert_true(s:buf_info[1]['name'] =~# 'Xbar$')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
383 call assert_true(s:buf_info[2]['name'] =~# 'Xbaz$')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
384 call assert_true(s:buf_info[3]['name'] =~# 'Xqux$')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
385
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
386 " Clean up.
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
387 call delete('Xfoo')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
388 call delete('Xbar')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
389 call delete('Xbaz')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
390 call delete('Xqux')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
391 call delete('Xtest_mks.out')
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
392 %bwipe!
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
393 endfunc
4fd87205ca80 patch 8.2.4090: after restoring a session buffer order can be quite different
Bram Moolenaar <Bram@vim.org>
parents: 26956
diff changeset
394
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
395 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
396
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
397 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
398 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
399 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
400 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
401 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
402 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
403 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
404 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
405 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
406 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
407 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
408 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
409
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
410 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
411
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
412
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
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 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
422 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
423 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
424 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
425 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
426 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
427
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
428 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
429 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
430 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
431
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
432 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
433 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
434 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
435 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
436 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
437 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
438 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
439 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
440 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
441 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
442 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
443 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
444
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
445 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
446 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
447 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
448
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
449 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
450 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
451
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 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
453 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
454 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
455 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
456 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
457 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
458 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
459 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
460 endfor
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
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
466 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
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
24335
3f96a5dc0c53 patch 8.2.2708: test sometimes fails waiting for shell in terminal
Bram Moolenaar <Bram@vim.org>
parents: 24287
diff changeset
469 let buf = Run_shell_in_terminal({'norestore': 1})
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
470 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
471 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
472 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
473 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
474 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
475 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
476 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
477 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
478
24335
3f96a5dc0c53 patch 8.2.2708: test sometimes fails waiting for shell in terminal
Bram Moolenaar <Bram@vim.org>
parents: 24287
diff changeset
479 call StopShellInTerminal(buf)
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
480 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
481 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
482
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
483 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
484 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
485
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
486 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
495 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
496
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
497 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
498 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
499 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
500
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
501 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
502 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
503
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
504 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
505 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
506 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
507 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
508 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
509 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
510 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
511 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
512 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
513 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
514
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
515 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
516 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
517 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
518 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
519
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
520 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
521 CheckFeature terminal
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
522 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18564
diff changeset
523
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
524 terminal
18033
049a7481d737 patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17586
diff changeset
525 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
526 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
527 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
528 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
529 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
530 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
531 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
532 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
533 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
534 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
535
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
536 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
537 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
538 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
539
22226
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
540 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
541 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
542
22226
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
543 terminal
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
544 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
545 new
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
546 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
547 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
548
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
549 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
550 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
551 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
552
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
553 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
554 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
555 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
556 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
557 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
558 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
559 endif
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
560 endfor
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
561
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
562 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
563
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
564 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
565 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
566 endfunc
4ed106deb772 patch 8.2.1662: :mksession does not restore shared terminal buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
567
22230
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
568 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
569 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
570
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
571 " 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
572 terminal
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
573 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
574 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
575 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
576
0bbc8be90207 patch 8.2.1664: memory leak when using :mkview with a terminal buffer
Bram Moolenaar <Bram@vim.org>
parents: 22226
diff changeset
577 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
578 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
579 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
580
23812
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
581 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
582 enew!
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
583
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
584 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
585 1,3fold
29226
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
586 write! Xtestfile
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
587
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
588 call assert_notequal(-1, foldclosed(1))
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
589 call assert_notequal(-1, foldclosed(2))
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
590 call assert_notequal(-1, foldclosed(3))
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
591
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
592 " Save the view with folds closed
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
593 mkview! Xtestview
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
594
23812
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
595 " 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
596 " have been recreated.
29226
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
597 " Open folds to ensure they get closed when restoring the view
23812
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
598 normal zR
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
599
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
600 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
601 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
602 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
603
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
604 source Xtestview
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
605
29226
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
606 call assert_notequal(-1, foldclosed(1))
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
607 call assert_notequal(-1, foldclosed(2))
699fbccbeab8 patch 8.2.5132: :mkview test doesn't test much
Bram Moolenaar <Bram@vim.org>
parents: 28915
diff changeset
608 call assert_notequal(-1, foldclosed(3))
23812
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
609
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
610 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
611 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
612 %bwipe
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
613 endfunc
84089558c5df patch 8.2.2447: 'foldlevel' not applied to folds restored from session
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
614
23851
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
615 func Test_mkview_no_balt()
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
616 edit Xtestfile1
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
617 edit Xtestfile2
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
618
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
619 mkview! Xtestview
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
620 bdelete Xtestfile1
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
621
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
622 source Xtestview
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
623 call assert_equal(0, buflisted('Xtestfile1'))
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
624
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
625 call delete('Xtestview')
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
626 %bwipe
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
627 endfunc
a2f13e56b0e7 patch 8.2.2467: script generated by :mkview changes alternate file
Bram Moolenaar <Bram@vim.org>
parents: 23812
diff changeset
628
24106
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
629 func Test_mksession_no_balt()
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
630 edit Xtestfile1
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
631 edit Xtestfile2
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
632
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
633 bdelete Xtestfile1
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
634 mksession! Xtestview
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
635
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
636 source Xtestview
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
637 call assert_equal(0, buflisted('Xtestfile1'))
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
638
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
639 call delete('Xtestview')
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
640 %bwipe
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
641 endfunc
3b5d499c2bb5 patch 8.2.2594: alternate buffer added to session file even when it's hidden
Bram Moolenaar <Bram@vim.org>
parents: 23851
diff changeset
642
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
643 " 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
644 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
645 " 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
646 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
647 set number
14644
3d94bbf54530 patch 8.1.0335: mkview test fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14640
diff changeset
648 norm! V}zf0
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
649 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
650 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
651 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
652 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
653 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
654 " 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
655 " 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
656 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
657
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
658 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
659 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
660 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
661 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
662 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
663
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
664 " 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
665 " 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
666 " overwritten without error.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
667 help :loadview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
668 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
669 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
670 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
671 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
672
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
673 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
674 bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
675 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
676
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
677 " 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
678 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
679 set viewdir=Xviewdir
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
680
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
681 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
682 set number
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
683 norm! V}zf
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
684 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
685 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
686 mkview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
687 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
688 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
689
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
690 loadview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
691
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
692 " 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
693 " 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
694 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
695 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
696 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
697 \ 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
698 \ glob('Xviewdir/*'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
699 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
700 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
701 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
702 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
703
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
704 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
705 set viewdir&
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
706 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
707 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
708
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
709 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
710 new
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
711 " :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
712 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
713 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
714
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
715 " :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
716 mkview Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
717 help
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
718 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
719 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
720
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
721 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
722 %bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
723 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
724
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
725 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
726 set viewdir=Xviewdir
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
727 au BufWinLeave * silent mkview
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
728 au BufWinEnter * silent loadview
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
729
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
730 edit Xfile1
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
731 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
732 normal j3l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
733 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
734 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
735
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
736 edit Xfile2
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
737 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
738 normal j5l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
739 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
740 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
741
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
742 edit Xfile3
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
743 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
744 normal jj3l
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
745 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
746 write
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
747
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
748 edit Xfile1
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
749 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
750 edit Xfile2
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
751 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
752 edit Xfile3
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
753 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
754
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
755 exe "normal \<C-O>"
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
756 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
757 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
758 exe "normal \<C-O>"
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
759 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
760 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
761
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
762 au! BufWinLeave
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
763 au! BufWinEnter
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
764 bwipe!
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
765 call delete('Xviewdir', 'rf')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
766 call delete('Xfile1')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
767 call delete('Xfile2')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
768 call delete('Xfile3')
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
769 set viewdir&
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
770 endfunc
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
771
15563
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
772 " 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
773 " 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
774 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
775 let v:errmsg = ''
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
776 %bwipe!
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
777 mksession! Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
778 source Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
779 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
780 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
781 endfunc
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
782
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
783 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
784 " 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
785 CheckUnix
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
786
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
787 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
788 %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
789 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
790 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
791 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
792 %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
793 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
794 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
795
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
796 %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
797 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
798 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
799
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
800 " 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
801 func Test_mksession_globals()
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
802 set sessionoptions+=globals
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
803
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
804 " create different global variables
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
805 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
806 let g:Global_count = 100
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
807 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
808 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
809
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
810 mksession! Xtest_mks.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
811
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
812 unlet g:Global_string
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
813 unlet g:Global_count
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
814 unlet g:Global_pi
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
815 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
816
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
817 source Xtest_mks.out
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
818 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
819 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
820 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
821 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
822
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
823 unlet g:Global_string
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
824 unlet g:Global_count
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
825 unlet g:Global_pi
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
826 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
827 call delete('Xtest_mks.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
828 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
829 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
830
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
831 " 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
832 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
833 if exists('+shellslash')
f93c2b6f7167 patch 8.1.2098: mksession test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 18205
diff changeset
834 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
835 endif
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
836 enew
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
837 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
838 e a\\b\\c
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
839 mksession! Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
840 set sessionoptions+=slash
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
841 mksession! Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
842
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
843 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
844 source Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
845 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
846 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
847 source Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
848 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
849
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
850 %bwipe!
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
851 call delete('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
852 call delete('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
853 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
854 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
855
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
856 " 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
857 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
858 let save_cwd = getcwd()
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
859 call mkdir('Xproj')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
860 mksession! Xproj/Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
861 set sessionoptions-=curdir
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
862 set sessionoptions+=sesdir
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
863 mksession! Xproj/Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
864
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
865 source Xproj/Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
866 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
867 source Xproj/Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
868 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
869 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
870 %bwipe
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
871
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
872 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
873 call delete('Xproj', 'rf')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
874 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
875
28652
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
876 " Test for saving and restoring the tab-local working directory when there is
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
877 " only a single tab and 'tabpages' is not in 'sessionoptions'.
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
878 func Test_mksession_tcd_single_tabs()
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
879 only | tabonly
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
880
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
881 let save_cwd = getcwd()
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
882 set sessionoptions-=tabpages
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
883 set sessionoptions+=curdir
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
884 call mkdir('Xtopdir1')
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
885 call mkdir('Xtopdir2')
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
886
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
887 " There are two tab pages, the current one has local cwd set to 'Xtopdir2'.
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
888 exec 'tcd ' .. save_cwd .. '/Xtopdir1'
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
889 tabnew
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
890 exec 'tcd ' .. save_cwd .. '/Xtopdir2'
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
891 mksession! Xtest_tcd_single
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
892
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
893 source Xtest_tcd_single
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
894 call assert_equal(2, haslocaldir())
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
895 call assert_equal('Xtopdir2', fnamemodify(getcwd(-1, 0), ':t'))
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
896 %bwipe
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
897
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
898 set sessionoptions&
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
899 call chdir(save_cwd)
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
900 call delete('Xtopdir1', 'rf')
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
901 call delete('Xtopdir2', 'rf')
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
902 endfunc
27dcbe70e1f0 patch 8.2.4850: mksession mixes up "tabpages" and "curdir" arguments
Bram Moolenaar <Bram@vim.org>
parents: 28238
diff changeset
903
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
904 " 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
905 func Test_mksession_resize()
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
906 mksession! Xtest_mks1.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
907 set sessionoptions+=resize
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
908 mksession! Xtest_mks2.out
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
909
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
910 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
911 let found_resize = v:false
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
912 for line in lines
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
913 if line =~ '^set lines='
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
914 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
915 break
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
916 endif
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
917 endfor
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
918 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
919 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
920 let found_resize = v:false
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
921 for line in lines
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
922 if line =~ '^set lines='
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
923 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
924 break
18205
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
925 endif
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
926 endfor
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
927 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
928
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
929 call delete('Xtest_mks1.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
930 call delete('Xtest_mks2.out')
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
931 set sessionoptions&
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
932 endfunc
e2feda1547bd patch 8.1.2097: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18033
diff changeset
933
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
934 " 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
935 func Test_mksession_scratch()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
936 enew | only
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
937 file Xscratch
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
938 set buftype=nofile
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
939 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
940 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
941 source Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
942 call assert_equal('Xscratch', bufname(''))
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
943 call assert_equal('nofile', &buftype)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
944 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
945 call delete('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
946 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
947
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
948 " 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
949 func Test_mksession_foldopt()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
950 set sessionoptions-=options
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
951 set sessionoptions+=folds
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
952 new
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
953 setlocal foldenable
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
954 setlocal foldmethod=expr
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
955 setlocal foldmarker=<<<,>>>
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
956 setlocal foldignore=%
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
957 setlocal foldlevel=2
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
958 setlocal foldminlines=10
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
959 setlocal foldnestmax=15
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
960 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
961 close
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
962 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
963
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
964 source Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
965 call assert_true(&foldenable)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
966 call assert_equal('expr', &foldmethod)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
967 call assert_equal('<<<,>>>', &foldmarker)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
968 call assert_equal('%', &foldignore)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
969 call assert_equal(2, &foldlevel)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
970 call assert_equal(10, &foldminlines)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
971 call assert_equal(15, &foldnestmax)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
972
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
973 close
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
974 %bwipe
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
975 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
976 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
977
26956
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
978 " Test for mksession with "help" but not "options" in 'sessionoptions'
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
979 func Test_mksession_help_noopt()
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
980 set sessionoptions-=options
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
981 set sessionoptions+=help
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
982 help
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
983 let fname = expand('%')
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
984 mksession! Xtest_mks.out
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
985 bwipe
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
986
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
987 source Xtest_mks.out
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
988 call assert_equal('help', &buftype)
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
989 call assert_equal('help', &filetype)
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
990 call assert_equal(fname, expand('%'))
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
991 call assert_false(&modifiable)
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
992 call assert_true(&readonly)
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
993
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
994 helpclose
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
995 help index
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
996 let fname = expand('%')
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
997 mksession! Xtest_mks.out
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
998 bwipe
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
999
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1000 source Xtest_mks.out
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1001 call assert_equal('help', &buftype)
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1002 call assert_equal(fname, expand('%'))
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1003
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1004 call delete('Xtest_mks.out')
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1005 set sessionoptions&
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1006 endfunc
86f8718c643d patch 8.2.4007: session does not restore help buffer properly
Bram Moolenaar <Bram@vim.org>
parents: 24882
diff changeset
1007
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1008 " 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
1009 func Test_mksession_winpos()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
1010 " Only applicable in GUI Vim
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
1011 CheckGui
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
1012
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1013 set sessionoptions+=winpos
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1014 mksession! Xtest_mks.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1015 let found_winpos = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1016 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
1017 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1018 if line =~ '^winpos '
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1019 let found_winpos = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1020 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1021 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1022 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1023 call assert_true(found_winpos)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1024 call delete('Xtest_mks.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1025 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1026 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1027
24473
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1028 " Test for mksession without options restores winminheight
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1029 func Test_mksession_winminheight()
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1030 set sessionoptions-=options
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1031 split
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1032 mksession! Xtest_mks.out
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1033 let found_restore = 0
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1034 let lines = readfile('Xtest_mks.out')
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1035 for line in lines
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1036 if line =~ '= s:save_winmin\(width\|height\)'
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1037 let found_restore += 1
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1038 endif
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1039 endfor
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1040 call assert_equal(2, found_restore)
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1041 call delete('Xtest_mks.out')
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1042 close
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1043 set sessionoptions&
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1044 endfunc
b2484fa6cb02 patch 8.2.2776: :mksession uses current value of 'splitbelow' and 'splitright'
Bram Moolenaar <Bram@vim.org>
parents: 24464
diff changeset
1045
28238
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1046 " Test for mksession with and without options restores shortmess
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1047 func Test_mksession_shortmess()
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1048 " Without options
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1049 set sessionoptions-=options
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1050 split
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1051 mksession! Xtest_mks.out
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1052 let found_save = 0
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1053 let found_restore = 0
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1054 let lines = readfile('Xtest_mks.out')
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1055 for line in lines
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1056 let line = trim(line)
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1057
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1058 if line ==# 'let s:shortmess_save = &shortmess'
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1059 let found_save += 1
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1060 endif
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1061
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1062 if found_save !=# 0 && line ==# 'let &shortmess = s:shortmess_save'
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1063 let found_restore += 1
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1064 endif
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1065 endfor
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1066 call assert_equal(1, found_save)
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1067 call assert_equal(1, found_restore)
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1068 call delete('Xtest_mks.out')
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1069 close
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1070 set sessionoptions&
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1071
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1072 " With options
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1073 set sessionoptions+=options
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1074 split
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1075 mksession! Xtest_mks.out
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1076 let found_restore = 0
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1077 let lines = readfile('Xtest_mks.out')
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1078 for line in lines
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1079 if line =~# 's:shortmess_save'
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1080 let found_restore += 1
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1081 endif
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1082 endfor
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1083 call assert_equal(0, found_restore)
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1084 call delete('Xtest_mks.out')
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1085 close
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1086 set sessionoptions&
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1087 endfunc
800e7de2f96d patch 8.2.4645: 'shortmess' changed when session does not store options
Bram Moolenaar <Bram@vim.org>
parents: 28083
diff changeset
1088
28915
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1089 " Test that when Vim loading session has 'A' in 'shortmess' it does not
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1090 " complain about an existing swapfile.
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1091 func Test_mksession_shortmess_with_A()
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1092 edit Xtestfile
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1093 write
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1094 let fname = swapname('%')
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1095 let cont = readblob(fname)
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1096 set sessionoptions-=options
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1097 mksession Xtestsession
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1098 bwipe!
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1099
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1100 " Recreate the swap file to pretend the file is being edited
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1101 call writefile(cont, fname)
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1102 set shortmess+=A
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1103 source Xtestsession
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1104
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1105 set shortmess&
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1106 set sessionoptions&
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1107 call delete('Xtestsession')
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1108 call delete(fname)
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1109 endfunc
6c67aeb82b65 patch 8.2.4980: when 'shortmess' contains 'A' loading session may still warn
Bram Moolenaar <Bram@vim.org>
parents: 28652
diff changeset
1110
18211
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1111 " 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
1112 func Test_mksession_compatible()
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1113 mksession! Xtest_mks1.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1114 set compatible
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1115 mksession! Xtest_mks2.out
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1116 set nocp
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1117
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1118 let test_success = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1119 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
1120 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1121 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
1122 let test_success = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1123 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1124 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1125 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1126 call assert_true(test_success)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1127
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1128 let test_success = v:false
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1129 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
1130 for line in lines
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1131 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
1132 let test_success = v:true
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1133 break
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1134 endif
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1135 endfor
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1136 call assert_true(test_success)
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1137
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1138 call delete('Xtest_mks1.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1139 call delete('Xtest_mks2.out')
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1140 set compatible&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1141 set sessionoptions&
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1142 endfunc
a493ab8e57ab patch 8.1.2100: :mksession is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18207
diff changeset
1143
17586
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1144 func s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1145 mapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1146 omapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1147 mapclear!
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1148 lmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1149 tmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1150 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1151
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1152 func Test_mkvimrc()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1153 let entries = [
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1154 \ ['', 'nothing', '<Nop>'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1155 \ ['n', 'normal', 'NORMAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1156 \ ['v', 'visual', 'VISUAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1157 \ ['s', 'select', 'SELECT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1158 \ ['x', 'visualonly', 'VISUALONLY'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1159 \ ['o', 'operator', 'OPERATOR'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1160 \ ['i', 'insert', 'INSERT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1161 \ ['l', 'lang', 'LANG'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1162 \ ['c', 'command', 'COMMAND'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1163 \ ['t', 'terminal', 'TERMINAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1164 \ ]
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1165 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1166 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
1167 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1168
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1169 mkvimrc Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1170
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1171 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1172 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1173 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
1174 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1175
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1176 source Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1177
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1178 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1179 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
1180 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1181
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1182 call s:ClearMappings()
24882
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1183
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1184 " the 'pastetoggle', 'wildchar' and 'wildcharm' option values should be
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1185 " stored as key names in the vimrc file
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1186 set pastetoggle=<F5>
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1187 set wildchar=<F6>
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1188 set wildcharm=<F7>
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1189 call assert_fails('mkvimrc Xtestvimrc')
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1190 mkvimrc! Xtestvimrc
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1191 call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set pastetoggle=<F5>'))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1192 call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildchar=<F6>'))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1193 call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildcharm=<F7>'))
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1194 set pastetoggle& wildchar& wildcharm&
4c1b6f3eb96b patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24576
diff changeset
1195
17586
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1196 call delete('Xtestvimrc')
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1197 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
1198
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
1199 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
1200 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
1201 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
1202 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
1203 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
1204 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
1205 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
1206 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
1207 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
1208 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
1209 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
1210 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
1211
23023
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1212 func Test_altfile()
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1213 edit Xone
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1214 split Xtwo
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1215 edit Xtwoalt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1216 edit #
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1217 wincmd w
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1218 edit Xonealt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1219 edit #
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1220 mksession! Xtest_altfile
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1221 only
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1222 bwipe Xonealt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1223 bwipe Xtwoalt
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1224 bwipe!
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1225 source Xtest_altfile
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1226 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
1227 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
1228 wincmd w
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1229 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
1230 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
1231 only
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1232 bwipe!
23132
855b818aae9b patch 8.2.2112: running tests may leave some files behind
Bram Moolenaar <Bram@vim.org>
parents: 23023
diff changeset
1233 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
1234 endfunc
4384c44c031a patch 8.2.2058: using mkview/loadview changes the jumplist
Bram Moolenaar <Bram@vim.org>
parents: 22776
diff changeset
1235
24287
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1236 " Test for creating views with manual folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1237 func Test_mkview_manual_fold()
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1238 call writefile(range(1,10), 'Xfile')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1239 new Xfile
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1240 " create recursive folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1241 5,6fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1242 4,7fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1243 mkview Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1244 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1245 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1246 call assert_equal([-1, 4, 4, 4, 4, -1], [foldclosed(3), foldclosed(4),
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1247 \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1248 " open one level of fold
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1249 4foldopen
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1250 mkview! Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1251 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1252 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1253 call assert_equal([-1, -1, 5, 5, -1, -1], [foldclosed(3), foldclosed(4),
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1254 \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1255 " open all the folds
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1256 %foldopen!
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1257 mkview! Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1258 normal zE
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1259 source Xview
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1260 call assert_equal([-1, -1, -1, -1, -1, -1], [foldclosed(3), foldclosed(4),
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1261 \ foldclosed(5), foldclosed(6), foldclosed(7), foldclosed(8)])
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1262 call delete('Xfile')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1263 call delete('Xview')
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1264 bw!
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1265 endfunc
c2a234e8c896 patch 8.2.2684: not enough folding code is tested
Bram Moolenaar <Bram@vim.org>
parents: 24106
diff changeset
1266
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1267 " vim: shiftwidth=2 sts=2 expandtab