annotate src/testdir/test_viminfo.vim @ 29970:d891115c0aea v9.0.0323

patch 9.0.0323: using common name in tests leads to flaky tests Commit: https://github.com/vim/vim/commit/3b0d70f4ff436cb144683dafd956e8a3ee485a90 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 29 22:31:20 2022 +0100 patch 9.0.0323: using common name in tests leads to flaky tests Problem: Using common name in tests leads to flaky tests. Solution: Rename files and directories to be more specific.
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Aug 2022 23:45:04 +0200
parents 485c7c4afeb7
children 008808e60963
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for reading and writing .viminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
3 source check.vim
22985
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
4 source term_util.vim
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
5 source shared.vim
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
6
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
7 func Test_viminfo_read_and_write()
17466
15de78cb9f39 patch 8.1.1731: command line history not read from viminfo on startup
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
8 " First clear 'history', so that "hislen" is zero. Then set it again,
15de78cb9f39 patch 8.1.1731: command line history not read from viminfo on startup
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
9 " simulating Vim starting up.
15de78cb9f39 patch 8.1.1731: command line history not read from viminfo on startup
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
10 set history=0
15de78cb9f39 patch 8.1.1731: command line history not read from viminfo on startup
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
11 wviminfo Xviminfo
15de78cb9f39 patch 8.1.1731: command line history not read from viminfo on startup
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
12 set history=1000
15de78cb9f39 patch 8.1.1731: command line history not read from viminfo on startup
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
13
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
14 call histdel(':')
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
15 let @/=''
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let lines = [
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ '# comment line',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ '*encoding=utf-8',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ '~MSle0~/asdf',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ '|copied as-is',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ '|and one more',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ ]
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call writefile(lines, 'Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 rviminfo Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal('asdf', @/)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 wviminfo Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let lines = readfile('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let done = 0
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 for line in lines
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
31 if line[0] == '|' && line !~ '^|[234],' && line !~ '^|<'
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 if done == 0
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
33 call assert_equal('|1,4', line)
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
34 elseif done == 1
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal('|copied as-is', line)
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
36 elseif done == 2
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal('|and one more', line)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 endif
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 let done += 1
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 endif
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 endfor
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
42 call assert_equal(3, done)
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call delete('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endfunc
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 func Test_global_vars()
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
48 let g:MY_GLOBAL_STRING = "Vim Editor"
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
49 let g:MY_GLOBAL_NUM = 345
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
50 let g:MY_GLOBAL_FLOAT = 3.14
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let test_dict = {'foo': 1, 'bar': 0, 'longvarible': 1000}
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 let g:MY_GLOBAL_DICT = test_dict
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 " store a really long list, so line wrapping will occur in viminfo file
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 let test_list = range(1,100)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 let g:MY_GLOBAL_LIST = test_list
15466
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
56 let test_blob = 0z00112233445566778899aabbccddeeff
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
57 let g:MY_GLOBAL_BLOB = test_blob
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
58 let test_false = v:false
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
59 let g:MY_GLOBAL_FALSE = test_false
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
60 let test_true = v:true
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
61 let g:MY_GLOBAL_TRUE = test_true
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
62 let test_null = v:null
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
63 let g:MY_GLOBAL_NULL = test_null
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
64 let test_none = v:none
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
65 let g:MY_GLOBAL_NONE = test_none
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
66 let g:MY_GLOBAL_FUNCREF = function('min')
15466
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
67
8796
fb764adba294 commit https://github.com/vim/vim/commit/e9c07270031e312082604d3505650f185aa65948
Christian Brabandt <cb@256bit.org>
parents: 7664
diff changeset
68 set viminfo='100,<50,s10,h,!,nviminfo
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 wv! Xviminfo
15466
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
70
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
71 unlet g:MY_GLOBAL_STRING
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
72 unlet g:MY_GLOBAL_NUM
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
73 unlet g:MY_GLOBAL_FLOAT
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 unlet g:MY_GLOBAL_DICT
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 unlet g:MY_GLOBAL_LIST
15466
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
76 unlet g:MY_GLOBAL_BLOB
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
77 unlet g:MY_GLOBAL_FALSE
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
78 unlet g:MY_GLOBAL_TRUE
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
79 unlet g:MY_GLOBAL_NULL
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
80 unlet g:MY_GLOBAL_NONE
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
81 unlet g:MY_GLOBAL_FUNCREF
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 rv! Xviminfo
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
84 call assert_equal("Vim Editor", g:MY_GLOBAL_STRING)
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
85 call assert_equal(345, g:MY_GLOBAL_NUM)
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
86 call assert_equal(3.14, g:MY_GLOBAL_FLOAT)
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(test_dict, g:MY_GLOBAL_DICT)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call assert_equal(test_list, g:MY_GLOBAL_LIST)
15466
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
89 call assert_equal(test_blob, g:MY_GLOBAL_BLOB)
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
90 call assert_equal(test_false, g:MY_GLOBAL_FALSE)
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
91 call assert_equal(test_true, g:MY_GLOBAL_TRUE)
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
92 call assert_equal(test_null, g:MY_GLOBAL_NULL)
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
93 call assert_equal(test_none, g:MY_GLOBAL_NONE)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
94 call assert_false(exists("g:MY_GLOBAL_FUNCREF"))
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
96 " When reading global variables from viminfo, if a variable cannot be
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
97 " modified, then the value should not be changed.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
98 unlet g:MY_GLOBAL_STRING
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
99 unlet g:MY_GLOBAL_NUM
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
100 unlet g:MY_GLOBAL_FLOAT
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
101 unlet g:MY_GLOBAL_DICT
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
102 unlet g:MY_GLOBAL_LIST
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
103 unlet g:MY_GLOBAL_BLOB
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
104
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
105 const g:MY_GLOBAL_STRING = 'New Value'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
106 const g:MY_GLOBAL_NUM = 987
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
107 const g:MY_GLOBAL_FLOAT = 1.16
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
108 const g:MY_GLOBAL_DICT = {'editor': 'vim'}
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
109 const g:MY_GLOBAL_LIST = [5, 7, 13]
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
110 const g:MY_GLOBAL_BLOB = 0zDEADBEEF
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
111 call assert_fails('rv! Xviminfo', 'E741:')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
112 call assert_equal('New Value', g:MY_GLOBAL_STRING)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
113 call assert_equal(987, g:MY_GLOBAL_NUM)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
114 call assert_equal(1.16, g:MY_GLOBAL_FLOAT)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
115 call assert_equal({'editor': 'vim'}, g:MY_GLOBAL_DICT)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
116 call assert_equal([5, 7 , 13], g:MY_GLOBAL_LIST)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
117 call assert_equal(0zDEADBEEF, g:MY_GLOBAL_BLOB)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
118
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
119 unlet g:MY_GLOBAL_STRING
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
120 unlet g:MY_GLOBAL_NUM
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
121 unlet g:MY_GLOBAL_FLOAT
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
122 unlet g:MY_GLOBAL_DICT
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
123 unlet g:MY_GLOBAL_LIST
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
124 unlet g:MY_GLOBAL_BLOB
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
125
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
126 " Test for invalid values for a blob, list, dict in a viminfo file
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
127 call writefile([
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
128 \ "!GLOB_BLOB_1\tBLO\t123",
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
129 \ "!GLOB_BLOB_2\tBLO\t012",
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
130 \ "!GLOB_BLOB_3\tBLO\t0z1x",
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
131 \ "!GLOB_BLOB_4\tBLO\t0z12 ab",
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
132 \ "!GLOB_LIST_1\tLIS\t1 2",
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
133 \ "!GLOB_DICT_1\tDIC\t1 2"], 'Xviminfo')
24958
21ec48d542a8 patch 8.2.3016: confusing error when expression is followed by comma
Bram Moolenaar <Bram@vim.org>
parents: 24946
diff changeset
134 call assert_fails('rv! Xviminfo', 'E488:')
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
135 call assert_equal('123', g:GLOB_BLOB_1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
136 call assert_equal(1, type(g:GLOB_BLOB_1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
137 call assert_equal('012', g:GLOB_BLOB_2)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
138 call assert_equal(1, type(g:GLOB_BLOB_2))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
139 call assert_equal('0z1x', g:GLOB_BLOB_3)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
140 call assert_equal(1, type(g:GLOB_BLOB_3))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
141 call assert_equal('0z12 ab', g:GLOB_BLOB_4)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
142 call assert_equal(1, type(g:GLOB_BLOB_4))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
143 call assert_equal('1 2', g:GLOB_LIST_1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
144 call assert_equal(1, type(g:GLOB_LIST_1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
145 call assert_equal('1 2', g:GLOB_DICT_1)
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
146 call assert_equal(1, type(g:GLOB_DICT_1))
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 20735
diff changeset
147
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 call delete('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 set viminfo-=!
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 endfunc
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
151
20735
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
152 func Test_global_vars_with_circular_reference()
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
153 let g:MY_GLOBAL_LIST = []
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
154 call add(g:MY_GLOBAL_LIST, g:MY_GLOBAL_LIST)
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
155 let g:MY_GLOBAL_DICT = {}
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
156 let g:MY_GLOBAL_DICT['self'] = g:MY_GLOBAL_DICT
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
157
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
158 set viminfo='100,<50,s10,h,!,nviminfo
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
159 wv! Xviminfo
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
160 call assert_equal(v:errmsg, '')
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
161
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
162 unlet g:MY_GLOBAL_LIST
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
163 unlet g:MY_GLOBAL_DICT
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
164
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
165 rv! Xviminfo
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
166 call assert_equal(v:errmsg, '')
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
167 call assert_true(!exists('g:MY_GLOBAL_LIST'))
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
168 call assert_true(!exists('g:MY_GLOBAL_DICT'))
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
169
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
170 call delete('Xviminfo')
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
171 set viminfo-=!
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
172 endfunc
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
173
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
174 func Test_cmdline_history()
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
175 call histdel(':')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
176 call test_settime(11)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
177 call histadd(':', "echo 'one'")
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
178 call test_settime(12)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
179 " split into two lines
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
180 let long800 = repeat(" 'eight'", 100)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
181 call histadd(':', "echo " . long800)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
182 call test_settime(13)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
183 " split into three lines
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
184 let long1400 = repeat(" 'fourteeeeen'", 100)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
185 call histadd(':', "echo " . long1400)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
186 wviminfo Xviminfo
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
187 let lines = readfile('Xviminfo')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
188 let done_colon = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
189 let done_bar = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
190 let lnum = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
191 while lnum < len(lines)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
192 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
193 if line[0] == ':'
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
194 if done_colon == 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
195 call assert_equal(":\x161408", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
196 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
197 call assert_equal('<echo ' . long1400, line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
198 elseif done_colon == 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
199 call assert_equal(":\x16808", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
200 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
201 call assert_equal("<echo " . long800, line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
202 elseif done_colon == 2
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
203 call assert_equal(":echo 'one'", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
204 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
205 let done_colon += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
206 elseif line[0:4] == '|2,0,'
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
207 if done_bar == 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
208 call assert_equal("|2,0,13,,>1407", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
209 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
210 call assert_equal('|<"echo ' . long1400[0:484], line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
211 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
212 call assert_equal('|<' . long1400[485:974], line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
213 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
214 call assert_equal('|<' . long1400[975:] . '"', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
215 elseif done_bar == 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
216 call assert_equal('|2,0,12,,>807', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
217 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
218 call assert_equal('|<"echo ' . long800[0:484], line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
219 let line = lines[lnum] | let lnum += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
220 call assert_equal('|<' . long800[485:] . '"', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
221 elseif done_bar == 2
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
222 call assert_equal("|2,0,11,,\"echo 'one'\"", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
223 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
224 let done_bar += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
225 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
226 endwhile
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
227 call assert_equal(3, done_colon)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
228 call assert_equal(3, done_bar)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
229
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
230 call histdel(':')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
231 rviminfo Xviminfo
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
232 call assert_equal("echo " . long1400, histget(':', -1))
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
233 call assert_equal("echo " . long800, histget(':', -2))
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
234 call assert_equal("echo 'one'", histget(':', -3))
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
235
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
236 " If the value for the '/' or ':' or '@' field in 'viminfo' is zero, then
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
237 " the corresponding history entries are not saved.
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
238 set viminfo='100,/0,:0,@0,<50,s10,h,!,nviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
239 call histdel('/')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
240 call histdel(':')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
241 call histdel('@')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
242 call histadd('/', 'foo')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
243 call histadd(':', 'bar')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
244 call histadd('@', 'baz')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
245 wviminfo! Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
246 call histdel('/')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
247 call histdel(':')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
248 call histdel('@')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
249 rviminfo! Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
250 call assert_equal('', histget('/'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
251 call assert_equal('', histget(':'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
252 call assert_equal('', histget('@'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
253
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
254 call delete('Xviminfo')
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
255 set viminfo&vim
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
256 endfunc
9256
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
257
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
258 func Test_cmdline_history_order()
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
259 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
260 call test_settime(11)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
261 call histadd(':', "echo '11'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
262 call test_settime(22)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
263 call histadd(':', "echo '22'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
264 call test_settime(33)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
265 call histadd(':', "echo '33'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
266 wviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
267
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
268 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
269 " items go in between
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
270 call test_settime(15)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
271 call histadd(':', "echo '15'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
272 call test_settime(27)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
273 call histadd(':', "echo '27'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
274
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
275 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
276 call assert_equal("echo '33'", histget(':', -1))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
277 call assert_equal("echo '27'", histget(':', -2))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
278 call assert_equal("echo '22'", histget(':', -3))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
279 call assert_equal("echo '15'", histget(':', -4))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
280 call assert_equal("echo '11'", histget(':', -5))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
281
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
282 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
283 " items go before and after
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17532
diff changeset
284 eval 8->test_settime()
9256
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
285 call histadd(':', "echo '8'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
286 call test_settime(39)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
287 call histadd(':', "echo '39'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
288
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
289 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
290 call assert_equal("echo '39'", histget(':', -1))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
291 call assert_equal("echo '33'", histget(':', -2))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
292 call assert_equal("echo '22'", histget(':', -3))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
293 call assert_equal("echo '11'", histget(':', -4))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
294 call assert_equal("echo '8'", histget(':', -5))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
295
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
296 " Check sorting works when writing with merge.
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
297 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
298 call test_settime(8)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
299 call histadd(':', "echo '8'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
300 call test_settime(15)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
301 call histadd(':', "echo '15'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
302 call test_settime(27)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
303 call histadd(':', "echo '27'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
304 call test_settime(39)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
305 call histadd(':', "echo '39'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
306 wviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
307
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
308 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
309 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
310 call assert_equal("echo '39'", histget(':', -1))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
311 call assert_equal("echo '33'", histget(':', -2))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
312 call assert_equal("echo '27'", histget(':', -3))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
313 call assert_equal("echo '22'", histget(':', -4))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
314 call assert_equal("echo '15'", histget(':', -5))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
315 call assert_equal("echo '11'", histget(':', -6))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
316 call assert_equal("echo '8'", histget(':', -7))
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
317
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
318 call delete('Xviminfo')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
319 endfunc
9268
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
320
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
321 func Test_viminfo_registers()
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
322 call test_settime(8)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
323 call setreg('a', "eight", 'c')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
324 call test_settime(20)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
325 call setreg('b', ["twenty", "again"], 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
326 call test_settime(40)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
327 call setreg('c', ["four", "agai"], 'b4')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
328 let l = []
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
329 set viminfo='100,<600,s10,h,!,nviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
330 for i in range(500)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
331 call add(l, 'something')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
332 endfor
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
333 call setreg('d', l, 'l')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
334 call setreg('e', "abc\<C-V>xyz")
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
335 wviminfo Xviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
336
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
337 call test_settime(10)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
338 call setreg('a', '', 'b10')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
339 call test_settime(15)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
340 call setreg('b', 'drop')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
341 call test_settime(50)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
342 call setreg('c', 'keep', 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
343 call test_settime(30)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
344 call setreg('d', 'drop', 'l')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
345 call setreg('e', 'drop')
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
346 rviminfo Xviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
347
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
348 call assert_equal("", getreg('a'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
349 call assert_equal("\<C-V>10", getregtype('a'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
350 call assert_equal("twenty\nagain\n", getreg('b'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
351 call assert_equal("V", getregtype('b'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
352 call assert_equal("keep\n", getreg('c'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
353 call assert_equal("V", getregtype('c'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
354 call assert_equal(l, getreg('d', 1, 1))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
355 call assert_equal("V", getregtype('d'))
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
356 call assert_equal("abc\<C-V>xyz", getreg('e'))
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
357
9978
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
358 " Length around 440 switches to line continuation.
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
359 let len = 434
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
360 while len < 445
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
361 let s = repeat('a', len)
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
362 call setreg('"', s)
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
363 wviminfo Xviminfo
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
364 call setreg('"', '')
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
365 rviminfo Xviminfo
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
366 call assert_equal(s, getreg('"'), 'wrong register at length: ' . len)
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
367
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
368 let len += 1
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
369 endwhile
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
370
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
371 " If the maximum number of lines saved for a register ('<' in 'viminfo') is
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
372 " zero, then register values should not be saved.
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
373 let @a = 'abc'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
374 set viminfo='100,<0,s10,h,!,nviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
375 wviminfo Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
376 let @a = 'xyz'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
377 rviminfo! Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
378 call assert_equal('xyz', @a)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
379 " repeat the test with '"' instead of '<'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
380 let @b = 'def'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
381 set viminfo='100,\"0,s10,h,!,nviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
382 wviminfo Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
383 let @b = 'rst'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
384 rviminfo! Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
385 call assert_equal('rst', @b)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
386
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
387 " If the maximum size of an item ('s' in 'viminfo') is zero, then register
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
388 " values should not be saved.
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
389 let @c = '123'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
390 set viminfo='100,<20,s0,h,!,nviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
391 wviminfo Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
392 let @c = '456'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
393 rviminfo! Xviminfo
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
394 call assert_equal('456', @c)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
395
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
396 call delete('Xviminfo')
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
397 set viminfo&vim
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
398 endfunc
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
399
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
400 func Test_viminfo_marks()
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
401 sp bufa
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
402 let bufa = bufnr('%')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
403 sp bufb
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
404 let bufb = bufnr('%')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
405
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
406 call test_settime(8)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
407 call setpos("'A", [bufa, 1, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
408 call test_settime(20)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
409 call setpos("'B", [bufb, 9, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
410 call setpos("'C", [bufa, 7, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
411
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
412 delmark 0-9
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
413 call test_settime(25)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
414 call setpos("'1", [bufb, 12, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
415 call test_settime(35)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
416 call setpos("'0", [bufa, 11, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
417
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
418 call test_settime(45)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
419 wviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
420
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
421 " Writing viminfo inserts the '0 mark.
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
422 call assert_equal([bufb, 1, 1, 0], getpos("'0"))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
423 call assert_equal([bufa, 11, 1, 0], getpos("'1"))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
424 call assert_equal([bufb, 12, 1, 0], getpos("'2"))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
425
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
426 call test_settime(4)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
427 call setpos("'A", [bufa, 9, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
428 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
429 call setpos("'B", [bufb, 2, 3, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
430 delmark C
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
431
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
432 delmark 0-9
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
433 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
434 call setpos("'1", [bufb, 22, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
435 call test_settime(55)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
436 call setpos("'0", [bufa, 21, 1, 0])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
437
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
438 rviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
439
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
440 call assert_equal([bufa, 1, 1, 0], getpos("'A"))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
441 call assert_equal([bufb, 2, 3, 0], getpos("'B"))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
442 call assert_equal([bufa, 7, 1, 0], getpos("'C"))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
443
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
444 " numbered marks are merged
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
445 call assert_equal([bufa, 21, 1, 0], getpos("'0")) " time 55
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
446 call assert_equal([bufb, 1, 1, 0], getpos("'1")) " time 45
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
447 call assert_equal([bufa, 11, 1, 0], getpos("'2")) " time 35
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
448 call assert_equal([bufb, 22, 1, 0], getpos("'3")) " time 30
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
449 call assert_equal([bufb, 12, 1, 0], getpos("'4")) " time 25
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
450
18979
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
451 " deleted file marks are removed from viminfo
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
452 delmark C
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
453 wviminfo Xviminfo
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
454 rviminfo Xviminfo
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
455 call assert_equal([0, 0, 0, 0], getpos("'C"))
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
456
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
457 " deleted file marks stay in viminfo if defined in another vim later
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
458 call test_settime(70)
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
459 call setpos("'D", [bufb, 8, 1, 0])
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
460 wviminfo Xviminfo
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
461 call test_settime(65)
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
462 delmark D
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
463 call assert_equal([0, 0, 0, 0], getpos("'D"))
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
464 call test_settime(75)
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
465 rviminfo Xviminfo
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
466 call assert_equal([bufb, 8, 1, 0], getpos("'D"))
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
467
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
468 call delete('Xviminfo')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
469 exe 'bwipe ' . bufa
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
470 exe 'bwipe ' . bufb
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
471 endfunc
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
472
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
473 func Test_viminfo_jumplist()
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
474 split testbuf
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
475 clearjumps
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
476 call setline(1, ['time 05', 'time 10', 'time 15', 'time 20', 'time 30', 'last pos'])
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
477 call cursor(2, 1)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
478 call test_settime(10)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
479 exe "normal /20\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
480 call test_settime(20)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
481 exe "normal /30\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
482 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
483 exe "normal /last pos\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
484 wviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
485
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
486 clearjumps
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
487 call cursor(1, 1)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
488 call test_settime(5)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
489 exe "normal /15\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
490 call test_settime(15)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
491 exe "normal /last pos\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
492 call test_settime(40)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
493 exe "normal ?30\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
494 rviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
495
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
496 call assert_equal('time 30', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
497 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
498 call assert_equal('last pos', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
499 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
500 " duplicate for 'time 30' was removed
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
501 call assert_equal('time 20', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
502 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
503 call assert_equal('time 15', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
504 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
505 call assert_equal('time 10', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
506 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
507 call assert_equal('time 05', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
508
9299
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
509 clearjumps
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
510 call cursor(1, 1)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
511 call test_settime(5)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
512 exe "normal /15\r"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
513 call test_settime(15)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
514 exe "normal /last pos\r"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
515 call test_settime(40)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
516 exe "normal ?30\r"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
517 " Test merge when writing
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
518 wviminfo Xviminfo
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
519 clearjumps
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
520 rviminfo Xviminfo
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
521
9313
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
522 let last_line = line('.')
9299
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
523 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
524 call assert_equal('time 30', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
525 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
526 call assert_equal('last pos', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
527 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
528 " duplicate for 'time 30' was removed
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
529 call assert_equal('time 20', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
530 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
531 call assert_equal('time 15', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
532 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
533 call assert_equal('time 10', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
534 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
535 call assert_equal('time 05', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
536
9313
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
537 " Test with jumplist full.
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
538 clearjumps
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
539 call setline(1, repeat(['match here'], 101))
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
540 call cursor(1, 1)
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
541 call test_settime(10)
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
542 for i in range(100)
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
543 exe "normal /here\r"
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
544 endfor
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
545 rviminfo Xviminfo
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
546
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
547 " must be newest mark that comes from viminfo.
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
548 exe "normal \<C-O>"
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
549 call assert_equal(last_line, line('.'))
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
550
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
551 bwipe!
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
552 call delete('Xviminfo')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
553 endfunc
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
554
9268
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
555 func Test_viminfo_encoding()
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
556 set enc=latin1
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
557 call histdel(':')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
558 call histadd(':', "echo '\xe9'")
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
559 wviminfo Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
560
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
561 set fencs=utf-8,latin1
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
562 set enc=utf-8
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
563 sp Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
564 call assert_equal('latin1', &fenc)
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
565 close
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
566
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
567 call histdel(':')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
568 rviminfo Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
569 call assert_equal("echo 'é'", histget(':', -1))
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
570
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
571 call delete('Xviminfo')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
572 endfunc
9270
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
573
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
574 func Test_viminfo_bad_syntax()
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
575 let lines = []
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
576 call add(lines, '|<') " empty continuation line
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
577 call add(lines, '|234234234234234324,nothing')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
578 call add(lines, '|1+"no comma"')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
579 call add(lines, '|1,2,3,4,5,6,7') " too many items
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
580 call add(lines, '|1,"string version"')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
581 call add(lines, '|1,>x') " bad continuation line
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
582 call add(lines, '|1,"x') " missing quote
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
583 call add(lines, '|1,"x\') " trailing backslash
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
584 call add(lines, '|1,,,,') "trailing comma
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
585 call add(lines, '|1,>234') " trailing continuation line
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
586 call writefile(lines, 'Xviminfo')
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
587 rviminfo Xviminfo
9270
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
588
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
589 call delete('Xviminfo')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
590 endfunc
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
591
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
592 func Test_viminfo_bad_syntax2()
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
593 let lines = []
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
594 call add(lines, '|1,4')
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
595
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
596 " bad viminfo syntax for history barline
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
597 call add(lines, '|2') " invalid number of fields in a history barline
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
598 call add(lines, '|2,9,1,1,"x"') " invalid value for the history type
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
599 call add(lines, '|2,0,,1,"x"') " no timestamp
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
600 call add(lines, '|2,0,1,1,10') " non-string text
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
601
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
602 " bad viminfo syntax for register barline
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
603 call add(lines, '|3') " invalid number of fields in a register barline
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
604 call add(lines, '|3,1,1,1,1,,1,"x"') " missing width field
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
605 call add(lines, '|3,0,80,1,1,1,1,"x"') " invalid register number
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
606 call add(lines, '|3,0,10,5,1,1,1,"x"') " invalid register type
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
607 call add(lines, '|3,0,10,1,20,1,1,"x"') " invalid line count
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
608 call add(lines, '|3,0,10,1,0,1,1') " zero line count
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
609
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
610 " bad viminfo syntax for mark barline
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
611 call add(lines, '|4') " invalid number of fields in a mark barline
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
612 call add(lines, '|4,1,1,1,1,1') " invalid value for file name
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
613 call add(lines, '|4,20,1,1,1,"x"') " invalid value for file name
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
614 call add(lines, '|4,49,0,1,1,"x"') " invalid value for line number
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24958
diff changeset
615
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
616 call writefile(lines, 'Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
617 rviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
618 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
619 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
620
9414
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
621 func Test_viminfo_file_marks()
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
622 silent! bwipe test_viminfo.vim
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
623 silent! bwipe Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
624
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
625 call test_settime(10)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
626 edit ten
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
627 call test_settime(25)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
628 edit again
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
629 call test_settime(30)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
630 edit thirty
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
631 wviminfo Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
632
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
633 call test_settime(20)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
634 edit twenty
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
635 call test_settime(35)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
636 edit again
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
637 call test_settime(40)
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
638 edit forty
9414
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
639 wviminfo Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
640
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
641 sp Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
642 1
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
643 for name in ['forty', 'again', 'thirty', 'twenty', 'ten']
9414
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
644 /^>
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
645 call assert_equal(name, substitute(getline('.'), '.*/', '', ''))
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
646 endfor
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
647 close
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
648
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
649 call delete('Xviminfo')
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
650 endfunc
9875
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
651
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
652 func Test_viminfo_file_mark_tabclose()
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
653 tabnew Xtestfileintab
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
654 call setline(1, ['a','b','c','d','e'])
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
655 4
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
656 q!
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
657 wviminfo Xviminfo
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
658 sp Xviminfo
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
659 /^> .*Xtestfileintab
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
660 let lnum = line('.')
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
661 while 1
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
662 if lnum == line('$')
11183
1c4ebbae41d2 patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents: 10285
diff changeset
663 call assert_report('mark not found in Xtestfileintab')
9875
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
664 break
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
665 endif
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
666 let lnum += 1
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
667 let line = getline(lnum)
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
668 if line == ''
11183
1c4ebbae41d2 patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents: 10285
diff changeset
669 call assert_report('mark not found in Xtestfileintab')
9875
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
670 break
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
671 endif
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
672 if line =~ "^\t\""
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
673 call assert_equal('4', substitute(line, ".*\"\t\\(\\d\\).*", '\1', ''))
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
674 break
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
675 endif
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
676 endwhile
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
677
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
678 call delete('Xviminfo')
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
679 silent! bwipe Xtestfileintab
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
680 endfunc
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
681
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
682 func Test_viminfo_file_mark_zero_time()
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
683 let lines = [
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
684 \ '# Viminfo version',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
685 \ '|1,4',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
686 \ '',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
687 \ '*encoding=utf-8',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
688 \ '',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
689 \ '# File marks:',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
690 \ "'B 1 0 /tmp/nothing",
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
691 \ '|4,66,1,0,0,"/tmp/nothing"',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
692 \ "",
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
693 \ ]
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
694 call writefile(lines, 'Xviminfo')
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
695 delmark B
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
696 rviminfo Xviminfo
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
697 call delete('Xviminfo')
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
698 call assert_equal(1, line("'B"))
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
699 delmark B
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
700 endfunc
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
701
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
702 " Test for saving and restoring file marks in unloaded buffers
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
703 func Test_viminfo_file_mark_unloaded_buf()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
704 let save_viminfo = &viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
705 set viminfo&vim
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
706 call writefile(repeat(['vim'], 10), 'Xfile1')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
707 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
708 edit! Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
709 call setpos("'u", [0, 3, 1, 0])
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
710 call setpos("'v", [0, 5, 1, 0])
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
711 enew
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
712 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
713 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
714 edit Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
715 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
716 call assert_equal([0, 3, 1, 0], getpos("'u"))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
717 call assert_equal([0, 5, 1, 0], getpos("'v"))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
718 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
719 call delete('Xfile1')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
720 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
721 let &viminfo = save_viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
722 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
723
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
724 func Test_viminfo_oldfiles()
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
725 let v:oldfiles = []
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
726 let lines = [
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
727 \ '# comment line',
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
728 \ '*encoding=utf-8',
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
729 \ '',
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
730 \ ':h viminfo',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
731 \ '?/session',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
732 \ '=myvar',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
733 \ '@123',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
734 \ '',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
735 \ "'E 2 0 /tmp/nothing",
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
736 \ '',
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
737 \ "> /tmp/file_one.txt",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
738 \ "\t\"\t11\t0",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
739 \ "",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
740 \ "> /tmp/file_two.txt",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
741 \ "\t\"\t11\t0",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
742 \ "",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
743 \ "> /tmp/another.txt",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
744 \ "\t\"\t11\t0",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
745 \ "",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
746 \ ]
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
747 call writefile(lines, 'Xviminfo')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
748 delmark E
23911
30e3a7a33b66 patch 8.2.2498: no test for what 8.2.2494 fixes
Bram Moolenaar <Bram@vim.org>
parents: 22985
diff changeset
749 edit /tmp/file_two.txt
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
750 rviminfo! Xviminfo
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
751 call delete('Xviminfo')
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
752
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
753 call assert_equal('h viminfo', histget(':'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
754 call assert_equal('session', histget('/'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
755 call assert_equal('myvar', histget('='))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
756 call assert_equal('123', histget('@'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
757 call assert_equal(2, line("'E"))
9941
e975914c17e9 commit https://github.com/vim/vim/commit/7b668e83d0635d082b7ec90d7d2aa30a9d7d8928
Christian Brabandt <cb@256bit.org>
parents: 9915
diff changeset
758 call assert_equal(['1: /tmp/file_one.txt', '2: /tmp/file_two.txt', '3: /tmp/another.txt'], filter(split(execute('oldfiles'), "\n"), {i, v -> v =~ '/tmp/'}))
e975914c17e9 commit https://github.com/vim/vim/commit/7b668e83d0635d082b7ec90d7d2aa30a9d7d8928
Christian Brabandt <cb@256bit.org>
parents: 9915
diff changeset
759 call assert_equal(['1: /tmp/file_one.txt', '2: /tmp/file_two.txt'], filter(split(execute('filter file_ oldfiles'), "\n"), {i, v -> v =~ '/tmp/'}))
e975914c17e9 commit https://github.com/vim/vim/commit/7b668e83d0635d082b7ec90d7d2aa30a9d7d8928
Christian Brabandt <cb@256bit.org>
parents: 9915
diff changeset
760 call assert_equal(['3: /tmp/another.txt'], filter(split(execute('filter /another/ oldfiles'), "\n"), {i, v -> v =~ '/tmp/'}))
17532
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
761
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
762 new
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
763 call feedkeys("3\<CR>", 't')
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
764 browse oldfiles
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
765 call assert_equal("/tmp/another.txt", expand("%"))
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
766 bwipe
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
767 delmark E
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
768 endfunc
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
769
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
770 " Test for storing and restoring buffer list in 'viminfo'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
771 func Test_viminfo_bufferlist()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
772 " If there are arguments, then :rviminfo doesn't read the buffer list.
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
773 " Need to delete all the arguments for :rviminfo to work.
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
774 %argdelete
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
775 set viminfo&vim
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
776
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
777 edit Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
778 edit Xfile2
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
779 set viminfo-=%
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
780 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
781 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
782 rviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
783 call assert_equal(1, len(getbufinfo()))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
784
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
785 edit Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
786 edit Xfile2
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
787 set viminfo^=%
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
788 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
789 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
790 rviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
791 let l = getbufinfo()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
792 call assert_equal(3, len(l))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
793 call assert_equal('Xfile1', bufname(l[1].bufnr))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
794 call assert_equal('Xfile2', bufname(l[2].bufnr))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
795
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
796 " The quickfix, terminal, unlisted, unnamed buffers are not stored in the
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
797 " viminfo file
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
798 %bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
799 edit Xfile1
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
800 new
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
801 setlocal nobuflisted
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
802 new
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
803 copen
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
804 if has('terminal')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
805 terminal
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
806 endif
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
807 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
808 %bwipe!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
809 rviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
810 let l = getbufinfo()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
811 call assert_equal(2, len(l))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
812 call assert_true(bufexists('Xfile1'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
813
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
814 " If a count is specified for '%', then only that many buffers should be
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
815 " stored in the viminfo file.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
816 %bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
817 set viminfo&vim
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
818 new Xbuf1
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
819 new Xbuf2
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
820 set viminfo+=%1
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
821 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
822 %bwipe!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
823 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
824 let l = getbufinfo()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
825 call assert_equal(2, len(l))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
826 call assert_true(bufexists('Xbuf1'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
827 call assert_false(bufexists('Xbuf2'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
828
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
829 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
830 %bwipe
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
831 set viminfo&vim
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
832 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
833
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
834 " Test for errors in a viminfo file
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
835 func Test_viminfo_error()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
836 " Non-existing viminfo files
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
837 call assert_fails('rviminfo xyz', 'E195:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
838
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
839 " Illegal starting character
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
840 call writefile(["a 123"], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
841 call assert_fails('rv Xviminfo', 'E575:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
842
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
843 " Illegal register name in the viminfo file
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
844 call writefile(['"@ LINE 0'], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
845 call assert_fails('rv Xviminfo', 'E577:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
846
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
847 " Invalid file mark line
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
848 call writefile(['>', '@'], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
849 call assert_fails('rv Xviminfo', 'E576:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
850
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
851 " Too many errors in viminfo file
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
852 call writefile(repeat(["a 123"], 15), 'Xviminfo')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
853 call assert_fails('rv Xviminfo', 'E575:')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
854
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
855 call writefile(['>'] + repeat(['@'], 10), 'Xviminfo')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
856 call assert_fails('rv Xviminfo', 'E576:')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
857
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
858 call writefile(repeat(['"@'], 15), 'Xviminfo')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
859 call assert_fails('rv Xviminfo', 'E577:')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
860
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
861 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
862 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
863
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
864 " Test for saving and restoring last substitute string in viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
865 func Test_viminfo_lastsub()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
866 enew
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
867 call append(0, "blue blue blue")
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
868 call cursor(1, 1)
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
869 s/blue/green/
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
870 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
871 s/blue/yellow/
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
872 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
873 &
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
874 call assert_equal("green yellow green", getline(1))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
875 enew!
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
876 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
877 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
878
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
879 " Test saving and restoring the register values using the older method
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
880 func Test_viminfo_registers_old()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
881 let lines = [
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
882 \ '# Viminfo version',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
883 \ '|1,1',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
884 \ '',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
885 \ '*encoding=utf-8',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
886 \ '',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
887 \ '# Registers:',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
888 \ '""0 CHAR 0',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
889 \ ' Vim',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
890 \ '"a CHAR 0',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
891 \ ' red',
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
892 \ '"c BLOCK 0',
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
893 \ ' a',
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
894 \ ' d',
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
895 \ '"d LINE 0',
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
896 \ ' abc',
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
897 \ ' def',
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
898 \ '"m@ CHAR 0',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
899 \ " :echo 'Hello'\<CR>",
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
900 \ "",
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
901 \ ]
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
902 call writefile(lines, 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
903 let @a = 'one'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
904 let @b = 'two'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
905 let @m = 'three'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
906 let @" = 'four'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
907 let @t = ":echo 'Unix'\<CR>"
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
908 silent! normal @t
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
909 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
910 call assert_equal('red', getreg('a'))
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
911 call assert_equal("v", getregtype('a'))
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
912 call assert_equal('two', getreg('b'))
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
913 call assert_equal("a\nd", getreg('c'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
914 call assert_equal("\<C-V>1", getregtype('c'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
915 call assert_equal("abc\ndef\n", getreg('d'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
916 call assert_equal("V", getregtype('d'))
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
917 call assert_equal(":echo 'Hello'\<CR>", getreg('m'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
918 call assert_equal('Vim', getreg('"'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
919 call assert_equal("\nHello", execute('normal @@'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
920 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
921 let @" = ''
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
922 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
923
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
924 " Test for saving and restoring large number of lines in a register
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
925 func Test_viminfo_large_register()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
926 let save_viminfo = &viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
927 set viminfo&vim
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
928 set viminfo-=<50
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
929 set viminfo+=<200
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
930 let lines = ['"r CHAR 0']
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
931 call extend(lines, repeat(["\tsun is rising"], 200))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
932 call writefile(lines, 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
933 let @r = ''
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
934 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
935 call assert_equal(join(repeat(["sun is rising"], 200), "\n"), @r)
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
936 call delete('Xviminfo')
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
937 let @r = ''
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
938 let &viminfo = save_viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
939 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
940
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
941 " Test for setting 'viminfofile' to NONE
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
942 func Test_viminfofile_none()
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
943 let save_vif = &viminfofile
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
944 set viminfofile=NONE
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
945 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
946 call assert_false(filereadable('Xviminfo'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
947 call writefile([''], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
948 call assert_fails('rviminfo Xviminfo', 'E195:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
949 call delete('Xviminfo')
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
950 let &viminfofile = save_vif
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
951 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
952
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
953 " Test for an unwritable and unreadable 'viminfo' file
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
954 func Test_viminfo_perm()
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
955 CheckUnix
18277
f6dcf7eabd26 patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 18263
diff changeset
956 CheckNotRoot
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
957 call writefile([''], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
958 call setfperm('Xviminfo', 'r-x------')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
959 call assert_fails('wviminfo Xviminfo', 'E137:')
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
960 call setfperm('Xviminfo', '--x------')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
961 call assert_fails('rviminfo Xviminfo', 'E195:')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
962 call delete('Xviminfo')
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
963
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
964 " Try to write the viminfo to a directory
29970
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
965 call mkdir('Xvifdir')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
966 call assert_fails('wviminfo Xvifdir', 'E137:')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
967 call assert_fails('rviminfo Xvifdir', 'E195:')
d891115c0aea patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
968 call delete('Xvifdir', 'rf')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
969 endfunc
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
970
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
971 " Test for writing to an existing viminfo file merges the file marks
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
972 func XTest_viminfo_marks_merge()
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
973 let save_viminfo = &viminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
974 set viminfo&vim
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
975 set viminfo^=%
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
976 enew
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
977 %argdelete
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
978 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
979
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
980 call writefile(repeat(['editor'], 10), 'Xbufa')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
981 call writefile(repeat(['Vim'], 10), 'Xbufb')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
982
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
983 " set marks in buffers
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
984 call test_settime(10)
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
985 edit Xbufa
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
986 4mark a
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
987 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
988 edit Xbufb
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
989 4mark b
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
990 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
991 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
992
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
993 " set marks in buffers again
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
994 call test_settime(20)
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
995 edit Xbufb
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
996 6mark b
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
997 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
998 edit Xbufa
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
999 6mark a
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1000 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1001 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1002
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1003 " Load the buffer and check the marks
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1004 edit Xbufa
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1005 rviminfo! Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1006 call assert_equal(6, line("'a"))
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1007 edit Xbufb
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1008 rviminfo! Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1009 call assert_equal(6, line("'b"))
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1010
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1011 " cleanup
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1012 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1013 call delete('Xviminfo')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1014 call delete('Xbufa')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1015 call delete('Xbufb')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1016 call test_settime(0)
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1017 let &viminfo=save_viminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
1018 endfunc
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1019
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1020 " Test for errors in setting 'viminfo'
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1021 func Test_viminfo_option_error()
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1022 " Missing number
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1023 call assert_fails('set viminfo=\"', 'E526:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1024 for c in split("'/:<@s", '\zs')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1025 call assert_fails('set viminfo=' .. c, 'E526:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1026 endfor
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1027
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1028 " Missing comma
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1029 call assert_fails('set viminfo=%10!', 'E527:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1030 call assert_fails('set viminfo=!%10', 'E527:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1031 call assert_fails('set viminfo=h%10', 'E527:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1032 call assert_fails('set viminfo=c%10', 'E527:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1033 call assert_fails('set viminfo=:10%10', 'E527:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1034
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1035 " Missing ' setting
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1036 call assert_fails('set viminfo=%10', 'E528:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1037 endfunc
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1038
22985
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1039 func Test_viminfo_oldfiles_newfile()
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1040 CheckRunVimInTerminal
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1041
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1042 let save_viminfo = &viminfo
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1043 let save_viminfofile = &viminfofile
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1044 set viminfo&vim
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1045 let v:oldfiles = []
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1046 let commands =<< trim [CODE]
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1047 set viminfofile=Xviminfofile
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1048 set viminfo&vim
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1049 w! Xnew-file.txt
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1050 qall
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1051 [CODE]
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1052 call writefile(commands, 'Xviminfotest')
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1053 let buf = RunVimInTerminal('-S Xviminfotest', #{wait_for_ruler: 0})
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1054 call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1055
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1056 let &viminfofile = 'Xviminfofile'
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1057 rviminfo! Xviminfofile
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1058 call assert_match('Xnew-file.txt$', v:oldfiles[0])
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1059 call assert_equal(1, len(v:oldfiles))
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1060 call delete('Xviminfofile')
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1061 call delete('Xviminfotest')
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1062 call delete('Xnew-file.txt')
24101
6d3dee0d7de5 patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents: 23911
diff changeset
1063
6d3dee0d7de5 patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents: 23911
diff changeset
1064 let v:oldfiles = test_null_list()
6d3dee0d7de5 patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents: 23911
diff changeset
1065 call assert_equal("\nNo old files", execute('oldfiles'))
6d3dee0d7de5 patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents: 23911
diff changeset
1066
22985
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1067 let &viminfo = save_viminfo
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1068 let &viminfofile = save_viminfofile
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1069 endfunc
d768cdd50602 patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents: 21580
diff changeset
1070
24946
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1071 " When writing CTRL-V or "\n" to a viminfo file, it is converted to CTRL-V
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1072 " CTRL-V and CTRL-V n respectively.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1073 func Test_viminfo_with_Ctrl_V()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1074 silent! exe "normal! /\<C-V>\<C-V>\n"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1075 wviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1076 call assert_notequal(-1, readfile('Xviminfo')->index("?/\<C-V>\<C-V>"))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1077 let @/ = 'abc'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1078 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1079 call assert_equal("\<C-V>", @/)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1080 silent! exe "normal! /\<C-V>\<C-J>\n"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1081 wviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1082 call assert_notequal(-1, readfile('Xviminfo')->index("?/\<C-V>n"))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1083 let @/ = 'abc'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1084 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1085 call assert_equal("\n", @/)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1086 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1087 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1088
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1089 " Test for the 'r' field in 'viminfo' (removal media)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1090 func Test_viminfo_removable_media()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1091 CheckUnix
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1092 if !isdirectory('/tmp') || getftype('/tmp') != 'dir'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1093 return
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1094 endif
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1095 let save_viminfo = &viminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1096 set viminfo+=r/tmp
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1097 edit /tmp/Xvima1b2c3
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1098 wviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1099 let matches = readfile('Xviminfo')->filter("v:val =~ 'Xvima1b2c3'")
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1100 call assert_equal(0, matches->len())
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1101 let &viminfo = save_viminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1102 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1103 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1104
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1105 " Test for the 'h' flag in 'viminfo'. If 'h' is not present, then the last
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1106 " search pattern read from 'viminfo' should be highlighted with 'hlsearch'.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1107 " If 'h' is present, then the last search pattern should not be highlighted.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1108 func Test_viminfo_hlsearch()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1109 set viminfo&vim
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1110
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1111 new
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1112 call setline(1, ['one two three'])
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1113 " save the screen attribute for the Search highlighted text and the normal
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1114 " text for later comparison
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1115 set hlsearch
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1116 let @/ = 'three'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1117 redraw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1118 let hiSearch = screenattr(1, 9)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1119 let hiNormal = screenattr(1, 1)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1120
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1121 set viminfo-=h
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1122 let @/='two'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1123 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1124 let @/='one'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1125 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1126 redraw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1127 call assert_equal(hiSearch, screenattr(1, 5))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1128 call assert_equal(hiSearch, screenattr(1, 6))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1129 call assert_equal(hiSearch, screenattr(1, 7))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1130
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1131 set viminfo+=h
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1132 let @/='two'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1133 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1134 let @/='one'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1135 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1136 redraw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1137 call assert_equal(hiNormal, screenattr(1, 5))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1138 call assert_equal(hiNormal, screenattr(1, 6))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1139 call assert_equal(hiNormal, screenattr(1, 7))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1140
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1141 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1142 set hlsearch& viminfo&vim
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1143 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1144 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1145
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1146 " Test for restoring the magicness of the last search pattern from the viminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1147 " file.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1148 func Test_viminfo_last_spat_magic()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1149 set viminfo&vim
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1150 new
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1151 call setline(1, ' one abc a.c')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1152
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1153 " restore 'nomagic'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1154 set nomagic
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1155 exe "normal gg/a.c\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1156 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1157 set magic
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1158 exe "normal gg/one\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1159 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1160 exe "normal! gg/\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1161 call assert_equal(10, col('.'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1162
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1163 " restore 'magic'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1164 set magic
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1165 exe "normal gg/a.c\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1166 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1167 set nomagic
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1168 exe "normal gg/one\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1169 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1170 exe "normal! gg/\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1171 call assert_equal(6, col('.'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1172
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1173 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1174 set viminfo&vim magic&
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1175 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1176 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1177
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1178 " Test for restoring the smartcase of the last search pattern from the viminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1179 " file.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1180 func Test_viminfo_last_spat_smartcase()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1181 new
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1182 call setline(1, ' one abc Abc')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1183 set ignorecase smartcase
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1184
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1185 " Searching with * should disable smartcase
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1186 exe "normal! gg$b*"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1187 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1188 exe "normal gg/one\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1189 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1190 exe "normal! gg/\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1191 call assert_equal(6, col('.'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1192
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1193 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1194 set ignorecase& smartcase& viminfo&
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1195 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1196 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1197
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1198 " Test for restoring the last search pattern with a line or character offset
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1199 " from the viminfo file.
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1200 func Test_viminfo_last_spat_offset()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1201 new
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1202 call setline(1, ['one', 'two', 'three', 'four', 'five'])
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1203 " line offset
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1204 exe "normal! /two/+2\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1205 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1206 exe "normal gg/five\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1207 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1208 exe "normal! gg/\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1209 call assert_equal(4, line('.'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1210 " character offset
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1211 exe "normal! gg/^th/e+2\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1212 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1213 exe "normal gg/two\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1214 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1215 exe "normal! gg/\<CR>"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1216 call assert_equal([3, 4], [line('.'), col('.')])
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1217 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1218 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1219 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1220
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1221 " Test for saving and restoring the last executed register (@ command)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1222 " from the viminfo file
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1223 func Test_viminfo_last_exec_reg()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1224 let g:val = 1
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1225 let @a = ":let g:val += 1\n"
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1226 normal! @a
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1227 wviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1228 let @b = ''
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1229 normal! @b
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1230 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1231 normal @@
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1232 call assert_equal(3, g:val)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1233 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1234 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1235
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1236 " Test for merging file marks in a viminfo file
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1237 func Test_viminfo_merge_file_marks()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1238 for [f, l, t] in [['a.txt', 5, 10], ['b.txt', 10, 20]]
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1239 call test_settime(t)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1240 exe 'edit ' .. f
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1241 call setline(1, range(1, 20))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1242 exe l . 'mark a'
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1243 wviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1244 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1245 endfor
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1246 call test_settime(30)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1247 for [f, l] in [['a.txt', 5], ['b.txt', 10]]
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1248 exe 'edit ' .. f
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1249 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1250 call assert_equal(l, line("'a"))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1251 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1252 endfor
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1253 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1254 call test_settime(0)
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1255 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1256
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1257 " Test for merging file marks from a old viminfo file
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1258 func Test_viminfo_merge_old_filemarks()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1259 let lines = []
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1260 call add(lines, '|1,4')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1261 call add(lines, '> ' .. fnamemodify('a.txt', ':p:~'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1262 call add(lines, "\tb\t7\t0\n")
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1263 call writefile(lines, 'Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1264 edit b.txt
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1265 call setline(1, range(1, 20))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1266 12mark b
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1267 wviminfo Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1268 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1269 edit a.txt
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1270 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1271 call assert_equal(7, line("'b"))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1272 edit b.txt
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1273 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1274 call assert_equal(12, line("'b"))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1275 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1276 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1277
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1278 " Test for merging the jump list from a old viminfo file
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1279 func Test_viminfo_merge_old_jumplist()
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1280 let lines = []
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1281 call add(lines, "-' 10 1 " .. fnamemodify('a.txt', ':p:~'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1282 call add(lines, "-' 20 1 " .. fnamemodify('a.txt', ':p:~'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1283 call add(lines, "-' 30 1 " .. fnamemodify('b.txt', ':p:~'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1284 call add(lines, "-' 40 1 " .. fnamemodify('b.txt', ':p:~'))
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1285 call writefile(lines, 'Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1286 clearjumps
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1287 rviminfo! Xviminfo
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1288 let l = getjumplist()[0]
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1289 call assert_equal([40, 30, 20, 10], [l[0].lnum, l[1].lnum, l[2].lnum,
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1290 \ l[3].lnum])
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1291 bw!
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1292 call delete('Xviminfo')
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1293 endfunc
dc3d45d9a4a8 patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents: 24101
diff changeset
1294
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
1295 " vim: shiftwidth=2 sts=2 expandtab