annotate src/testdir/test_mksession.vim @ 17586:ea5d6716b82e v8.1.1790

patch 8.1.1790: :mkvimrc is not tested commit https://github.com/vim/vim/commit/8750026a7f6b445c43adc990141a3fe92d680b62 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 1 23:05:49 2019 +0200 patch 8.1.1790: :mkvimrc is not tested Problem: :mkvimrc is not tested. Solution: Add a test.
author Bram Moolenaar <Bram@vim.org>
date Thu, 01 Aug 2019 23:15:04 +0200
parents 7927cf327396
children 049a7481d737
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
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 func Test_mksession()
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 tabnew
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let wrap_save = &wrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 set sessionoptions=buffers splitbelow fileencoding=latin1
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call setline(1, [
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ 'start:',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ 'no multibyte chAracter',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ ' one leaDing tab',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ ' four leadinG spaces',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ 'two consecutive tabs',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ 'two tabs in one line',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ 'one ä multibyteCharacter',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ '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
25 \ '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
26 \ 'short line',
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 \ ])
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
28 let tmpfile = 'Xtemp'
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 exec 'w! ' . tmpfile
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 /^start:
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 set wrap
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 vsplit
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 norm! j8|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 norm! j8|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 norm! j16|
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 norm! j16|
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
48 split
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
49 norm! j$
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 wincmd l
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 set nowrap
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 norm! j16|3zl
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 split
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 norm! j016|3zl
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! j016|3zl
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! j08|3zl
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! j08|3zl
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! j016|3zl
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! j016|3zl
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! j016|3zl
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 call wincol()
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
71 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
72 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
73 let expected = [
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 \ 'normal! 08|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 \ 'normal! 08|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 \ 'normal! 016|',
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 \ 'normal! 016|',
14640
22248c686b32 patch 8.1.0333: :mkview does not restore cursor properly after "$"
Christian Brabandt <cb@256bit.org>
parents: 14635
diff changeset
82 \ 'normal! $',
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 \ " normal! 08|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 \ " exe 'normal! ' . s:c . '|zs' . 8 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 \ " normal! 08|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 \ " normal! 016|",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
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 \ " exe 'normal! ' . s:c . '|zs' . 16 . '|'",
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 \ " normal! 016|"
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 \ ]
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(expected, li)
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 tabclose!
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
105 call delete('Xtest_mks.out')
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 call delete(tmpfile)
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 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
108 set sessionoptions&
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 endfunc
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110
10726
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
111 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
112 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
113 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
114 set winminheight=2
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
115 mksession! Xtest_mks.out
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
116 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
117
10737
52c96cc9a794 patch 8.0.0258: mksession test leaves file behind
Christian Brabandt <cb@256bit.org>
parents: 10726
diff changeset
118 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
119 endfunc
78927b31c73a patch 8.0.0253: error when loading session if winminheight is 2
Christian Brabandt <cb@256bit.org>
parents: 10436
diff changeset
120
14057
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
121 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
122 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
123 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
124 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
125 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
126 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
127 endfunc
be8fb2fd51fc patch 8.1.0046: loading a session file fails if 'winheight' is big
Christian Brabandt <cb@256bit.org>
parents: 13435
diff changeset
128
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
129 func Test_mksession_rtp()
15617
c91618229f99 patch 8.1.0816: test for 'runtimepath' in session fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15613
diff changeset
130 if has('win32')
c91618229f99 patch 8.1.0816: test for 'runtimepath' in session fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15613
diff changeset
131 " TODO: fix problem with backslashes
c91618229f99 patch 8.1.0816: test for 'runtimepath' in session fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15613
diff changeset
132 return
c91618229f99 patch 8.1.0816: test for 'runtimepath' in session fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15613
diff changeset
133 endif
15613
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
134 new
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
135 let _rtp=&rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
136 " 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
137 " 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
138 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
139 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
140 let &rtp=newrtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
141
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
142 " determine expected value
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
143 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
144 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
145 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
146 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
147
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
148 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
149 let &rtp=_rtp
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
150 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
151 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
152
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
153 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
154 endfunc
90f01701ecad patch 8.1.0814: :mksession cannot handle a very long 'runtimepath'
Bram Moolenaar <Bram@vim.org>
parents: 15599
diff changeset
155
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
156 func Test_mksession_arglist()
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
157 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
158 next file1 file2 file3 file4
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
159 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
160 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
161 call assert_equal(['file1', 'file2', 'file3', 'file4'], argv())
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
162
3adae5c1b1cd patch 8.0.0294: argument list is not stored correctly in a session file
Christian Brabandt <cb@256bit.org>
parents: 10737
diff changeset
163 call delete('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
164 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
165 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
166
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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 let count2buf = 0
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187 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
188 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
189 call assert_equal(2, count2buf, 'Xtest2 buffer count')
294f510f6d35 patch 8.0.1024: folds lost when session file has a buffer in two windows
Christian Brabandt <cb@256bit.org>
parents: 10809
diff changeset
190
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
191 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
192 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
193 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
194 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
195
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
196 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
197 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
198 tabnew
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
199 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
200 tabfirst
14270
5ad78e7f5b01 patch 8.1.0151: mksession test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14266
diff changeset
201 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 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
211 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
212
16427
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
213 " 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
214 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
215 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
216 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
217 cd Xtopdir
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
218 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
219 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
220 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
221 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
222 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
223 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
224 tcd Xtabdir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
225 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
226 wincmd t
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
227 lcd ../Xwindir1
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
228 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
229 tcd ../Xtabdir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
230 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
231 lcd ../Xwindir2
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
232 tabnew
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
233 tcd ../Xtabdir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
234 botright new
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
235 lcd ../Xwindir3
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
236 tabfirst
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
237 1wincmd w
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
238 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
239 only | tabonly
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
240 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
241 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
242 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
243 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
244 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
245 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
246 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
247 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
248 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
249 call assert_equal('Xwindir3', fnamemodify(getcwd(2, 3), ':t'))
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
250 only | tabonly
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
251 exe 'cd ' . save_cwd
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
252 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
253 endfunc
8c3a1bd270bb patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents: 15725
diff changeset
254
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
255 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
256 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
257 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
258 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
259 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
260 mksession! Xtest_mks.out
7346b2ea80d8 patch 8.1.0149: session is wrong with multiple tabs when :lcd was used
Christian Brabandt <cb@256bit.org>
parents: 14057
diff changeset
261 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
262 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
263 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
264 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
265 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
266 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
267 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
268 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
269
15643
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
270 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
271 set hidden
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
272
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
273 " 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
274 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
275 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
276 tabdo write
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
277 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
278
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
279 " 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
280 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
281 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
282 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
283
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
284 " Clean up.
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
285 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
286 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
287 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
288 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
289 %bwipe!
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
290 set hidden&
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
291 endfunc
dc2bfda59f95 patch 8.1.0829: when 'hidden' is set session creates extra buffers
Bram Moolenaar <Bram@vim.org>
parents: 15617
diff changeset
292
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
293 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
294
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
295 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
296 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
297 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
298 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
299 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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
308 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
309
1c6a708a5fee patch 8.1.0734: the hlsearch state is not stored in a session file
Bram Moolenaar <Bram@vim.org>
parents: 14646
diff changeset
310
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
311 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
312 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 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
322 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
323 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
324 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
325
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
326 if has('terminal')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
327
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
328 func Test_mksession_terminal_shell()
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
329 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
330 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
331 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
332 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
333 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
334 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
335 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
336 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
337 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
338 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
339 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
340 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
341
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
342 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
343 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
344 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
345
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
346 func Test_mksession_terminal_no_restore_cmdarg()
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
347 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
348 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
349 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
350 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
351 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
352 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
353 call assert_report('session must not restore teminal')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
354 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
355 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
356
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
357 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
358 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
359 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
360
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
361 func Test_mksession_terminal_no_restore_funcarg()
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
362 call term_start(&shell, {'norestore': 1})
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
363 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
364 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
365 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
366 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
367 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
368 call assert_report('session must not restore teminal')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
369 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
370 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
371
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
372 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
373 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
374 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
375
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
376 func Test_mksession_terminal_no_restore_func()
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
377 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
378 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
379 mksession! Xtest_mks.out
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
380 let lines = readfile('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
381 let term_cmd = ''
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
382 for line in lines
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
383 if line =~ '^terminal'
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
384 call assert_report('session must not restore teminal')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
385 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
386 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
387
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
388 call StopShellInTerminal(bufnr('%'))
13435
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
389 call delete('Xtest_mks.out')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
390 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
391
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
392 func Test_mksession_terminal_no_ssop()
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
393 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
394 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
395 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
396 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
397 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
398 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
399 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
400 call assert_report('session must not restore teminal')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
401 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
402 endfor
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
403
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
404 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
405 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
406 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
407 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
408
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
409 func Test_mksession_terminal_restore_other()
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
410 terminal
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
411 call term_setrestore(bufnr('%'), 'other')
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
412 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
413 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
414 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
415 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
416 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
417 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
418 endif
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
419 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
420 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
421
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
422 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
423 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
424 endfunc
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
425
fa198b71bab2 patch 8.0.1592: terminal windows in a session are not properly restored
Christian Brabandt <cb@256bit.org>
parents: 12291
diff changeset
426 endif " has('terminal')
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
427
14635
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
428 " 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
429 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
430 " 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
431 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
432 set number
14644
3d94bbf54530 patch 8.1.0335: mkview test fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14640
diff changeset
433 norm! V}zf0
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
434 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
435 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
436 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
437 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
438 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
439 " 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
440 " 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
441 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
442
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
443 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
444 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
445 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
446 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
447 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
448
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
449 " 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
450 " 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
451 " overwritten without error.
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
452 help :loadview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
453 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
454 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
455 mkview! Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
456 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
457
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
458 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
459 bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
460 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
461
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
462 " 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
463 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
464 set viewdir=Xviewdir
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
465
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
466 help :mkview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
467 set number
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
468 norm! V}zf
14646
aa48ee3d3d12 patch 8.1.0336: mkview test still fails on CI
Christian Brabandt <cb@256bit.org>
parents: 14644
diff changeset
469 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
470 let linefoldclosed1 = foldclosed('.')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
471 mkview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
472 set nonumber
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
473 norm! zrj
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
474
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
475 loadview 1
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
476
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
477 " 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
478 " 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
479 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
480 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
481 \ substitute(
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
482 \ 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
483 \ glob('Xviewdir/*'))
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
484 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
485 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
486 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
487 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
488
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
489 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
490 set viewdir&
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
491 helpclose
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
492 endfunc
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
493
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
494 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
495 new
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
496 " :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
497 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
498 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
499
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
500 " :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
501 mkview Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
502 help
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
503 source Xview
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
504 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
505
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
506 call delete('Xview')
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
507 %bwipe
4f61eb88127c patch 8.1.0331: insufficient test coverage for :mkview and :loadview
Christian Brabandt <cb@256bit.org>
parents: 14270
diff changeset
508 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
509
15563
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
510 " 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
511 " 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
512 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
513 let v:errmsg = ''
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
514 %bwipe!
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
515 mksession! Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
516 source Xtest_mks.out
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
517 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
518 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
519 endfunc
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
520
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
521 func Test_mksession_quote_in_filename()
15599
9da8ae285a02 patch 8.1.0807: session test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15591
diff changeset
522 if !has('unix')
9da8ae285a02 patch 8.1.0807: session test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15591
diff changeset
523 " only Unix can handle this weird filename
9da8ae285a02 patch 8.1.0807: session test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15591
diff changeset
524 return
9da8ae285a02 patch 8.1.0807: session test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15591
diff changeset
525 endif
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
526 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
527 %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
528 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
529 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
530 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
531 %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
532 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
533 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
534
3a2bf24d2655 patch 8.1.0803: session file has problem with single quote in file name
Bram Moolenaar <Bram@vim.org>
parents: 15563
diff changeset
535 %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
536 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
537 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
538
17586
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
539 func s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
540 mapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
541 omapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
542 mapclear!
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
543 lmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
544 tmapclear
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
545 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
546
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
547 func Test_mkvimrc()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
548 let entries = [
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
549 \ ['', 'nothing', '<Nop>'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
550 \ ['n', 'normal', 'NORMAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
551 \ ['v', 'visual', 'VISUAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
552 \ ['s', 'select', 'SELECT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
553 \ ['x', 'visualonly', 'VISUALONLY'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
554 \ ['o', 'operator', 'OPERATOR'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
555 \ ['i', 'insert', 'INSERT'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
556 \ ['l', 'lang', 'LANG'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
557 \ ['c', 'command', 'COMMAND'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
558 \ ['t', 'terminal', 'TERMINAL'],
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
559 \ ]
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
560 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
561 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
562 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
563
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
564 mkvimrc Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
565
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
566 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
567 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
568 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
569 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
570
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
571 source Xtestvimrc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
572
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
573 for entry in entries
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
574 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
575 endfor
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
576
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
577 call s:ClearMappings()
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
578 call delete('Xtestvimrc')
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
579 endfunc
ea5d6716b82e patch 8.1.1790: :mkvimrc is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
580
15563
e6d2e41669b8 patch 8.1.0789: sourcing a session sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 15452
diff changeset
581
10436
cb856404d060 commit https://github.com/vim/vim/commit/eca626fcdb73d480660c78b9f84cc043fa561922
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
582 " vim: shiftwidth=2 sts=2 expandtab