Mercurial > vim
annotate src/testdir/test_viminfo.vim @ 30207:7147c6059e80 v9.0.0439
patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Commit: https://github.com/vim/vim/commit/88b79cb7d47e2e1fee1baf4016c50b861e6b21c4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 10 22:32:14 2022 +0100
patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Problem: Cursor wrong if inserting before line with virtual text above.
Solution: Add the width of the "above" virtual text to the cursor position.
(issue #11084)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Sep 2022 23:45:02 +0200 |
parents | 008808e60963 |
children | 0913cd44fdfa |
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() |
30158
008808e60963
patch 9.0.0415: on MS-Windows some tests are flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
725 set noswapfile |
9915
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
726 let v:oldfiles = [] |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
727 let lines = [ |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
728 \ '# comment line', |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
729 \ '*encoding=utf-8', |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
730 \ '', |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
731 \ ':h viminfo', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
732 \ '?/session', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
733 \ '=myvar', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
734 \ '@123', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
735 \ '', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
736 \ "'E 2 0 /tmp/nothing", |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
737 \ '', |
9915
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
738 \ "> /tmp/file_one.txt", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
739 \ "\t\"\t11\t0", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
740 \ "", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
741 \ "> /tmp/file_two.txt", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
742 \ "\t\"\t11\t0", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
743 \ "", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
744 \ "> /tmp/another.txt", |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
745 \ "\t\"\t11\t0", |
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 \ ] |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
748 call writefile(lines, 'Xviminfo') |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
749 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
|
750 edit /tmp/file_two.txt |
9915
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
751 rviminfo! Xviminfo |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
752 call delete('Xviminfo') |
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
753 |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
754 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
|
755 call assert_equal('session', histget('/')) |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
756 call assert_equal('myvar', histget('=')) |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
757 call assert_equal('123', histget('@')) |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
758 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
|
759 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
|
760 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
|
761 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
|
762 |
24d7a7d27471
patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents:
17466
diff
changeset
|
763 new |
24d7a7d27471
patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents:
17466
diff
changeset
|
764 call feedkeys("3\<CR>", 't') |
24d7a7d27471
patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents:
17466
diff
changeset
|
765 browse oldfiles |
24d7a7d27471
patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents:
17466
diff
changeset
|
766 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
|
767 bwipe |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
768 delmark E |
30158
008808e60963
patch 9.0.0415: on MS-Windows some tests are flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
769 set swapfile& |
9915
4da1a3879100
commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents:
9875
diff
changeset
|
770 endfunc |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
771 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
772 " 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
|
773 func Test_viminfo_bufferlist() |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
774 " 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
|
775 " 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
|
776 %argdelete |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
777 set viminfo&vim |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
778 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
779 edit Xfile1 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
780 edit Xfile2 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
781 set viminfo-=% |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
782 wviminfo Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
783 %bwipe |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
784 rviminfo Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
785 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
|
786 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
787 edit Xfile1 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
788 edit Xfile2 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
789 set viminfo^=% |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
790 wviminfo Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
791 %bwipe |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
792 rviminfo Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
793 let l = getbufinfo() |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
794 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
|
795 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
|
796 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
|
797 |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
798 " 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
|
799 " viminfo file |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
800 %bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
801 edit Xfile1 |
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 setlocal nobuflisted |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
804 new |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
805 copen |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
806 if has('terminal') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
807 terminal |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
808 endif |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
809 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
810 %bwipe! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
811 rviminfo Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
812 let l = getbufinfo() |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
813 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
|
814 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
|
815 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
816 " 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
|
817 " 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
|
818 %bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
819 set viminfo&vim |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
820 new Xbuf1 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
821 new Xbuf2 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
822 set viminfo+=%1 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
823 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
824 %bwipe! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
825 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
826 let l = getbufinfo() |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
827 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
|
828 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
|
829 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
|
830 |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
831 call delete('Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
832 %bwipe |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
833 set viminfo&vim |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
834 endfunc |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
835 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
836 " 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
|
837 func Test_viminfo_error() |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
838 " Non-existing viminfo files |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
839 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
|
840 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
841 " Illegal starting character |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
842 call writefile(["a 123"], 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
843 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
|
844 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
845 " 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
|
846 call writefile(['"@ LINE 0'], 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
847 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
|
848 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
849 " Invalid file mark line |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
850 call writefile(['>', '@'], 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
851 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
|
852 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
853 " 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
|
854 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
|
855 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
|
856 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
857 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
|
858 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
|
859 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
860 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
|
861 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
|
862 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
863 call delete('Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
864 endfunc |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
865 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
866 " 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
|
867 func Test_viminfo_lastsub() |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
868 enew |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
869 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
|
870 call cursor(1, 1) |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
871 s/blue/green/ |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
872 wviminfo Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
873 s/blue/yellow/ |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
874 rviminfo! Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
875 & |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
876 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
|
877 enew! |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
878 call delete('Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
879 endfunc |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
880 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
881 " 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
|
882 func Test_viminfo_registers_old() |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
883 let lines = [ |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
884 \ '# Viminfo version', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
885 \ '|1,1', |
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 \ '*encoding=utf-8', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
888 \ '', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
889 \ '# Registers:', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
890 \ '""0 CHAR 0', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
891 \ ' Vim', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
892 \ '"a CHAR 0', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
893 \ ' red', |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
894 \ '"c BLOCK 0', |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
895 \ ' a', |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
896 \ ' d', |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
897 \ '"d LINE 0', |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
898 \ ' abc', |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
899 \ ' def', |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
900 \ '"m@ CHAR 0', |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
901 \ " :echo 'Hello'\<CR>", |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
902 \ "", |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
903 \ ] |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
904 call writefile(lines, 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
905 let @a = 'one' |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
906 let @b = 'two' |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
907 let @m = 'three' |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
908 let @" = 'four' |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
909 let @t = ":echo 'Unix'\<CR>" |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
910 silent! normal @t |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
911 rviminfo! Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
912 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
|
913 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
|
914 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
|
915 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
|
916 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
|
917 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
|
918 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
|
919 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
|
920 call assert_equal('Vim', getreg('"')) |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
921 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
|
922 call delete('Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
923 let @" = '' |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
924 endfunc |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
925 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
926 " 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
|
927 func Test_viminfo_large_register() |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
928 let save_viminfo = &viminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
929 set viminfo&vim |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
930 set viminfo-=<50 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
931 set viminfo+=<200 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
932 let lines = ['"r CHAR 0'] |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
933 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
|
934 call writefile(lines, 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
935 let @r = '' |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
936 rviminfo! Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
937 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
|
938 call delete('Xviminfo') |
18263
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
939 let @r = '' |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
940 let &viminfo = save_viminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
941 endfunc |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
942 |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
943 " 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
|
944 func Test_viminfofile_none() |
18263
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
945 let save_vif = &viminfofile |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
946 set viminfofile=NONE |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
947 wviminfo Xviminfo |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
948 call assert_false(filereadable('Xviminfo')) |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
949 call writefile([''], 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
950 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
|
951 call delete('Xviminfo') |
18263
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
952 let &viminfofile = save_vif |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
953 endfunc |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
954 |
26211
485c7c4afeb7
patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents:
24982
diff
changeset
|
955 " 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
|
956 func Test_viminfo_perm() |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
957 CheckUnix |
18277
f6dcf7eabd26
patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
18263
diff
changeset
|
958 CheckNotRoot |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
959 call writefile([''], 'Xviminfo') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
960 call setfperm('Xviminfo', 'r-x------') |
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
961 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
|
962 call setfperm('Xviminfo', '--x------') |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
963 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
|
964 call delete('Xviminfo') |
19906
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18979
diff
changeset
|
965 |
031184ace7c5
patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents:
18979
diff
changeset
|
966 " 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
|
967 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
|
968 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
|
969 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
|
970 call delete('Xvifdir', 'rf') |
18233
7d147c191ef7
patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
971 endfunc |
18263
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
972 |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
973 " 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
|
974 func XTest_viminfo_marks_merge() |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
975 let save_viminfo = &viminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
976 set viminfo&vim |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
977 set viminfo^=% |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
978 enew |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
979 %argdelete |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
980 %bwipe |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
981 |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
982 call writefile(repeat(['editor'], 10), 'Xbufa') |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
983 call writefile(repeat(['Vim'], 10), 'Xbufb') |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
984 |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
985 " set marks in buffers |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
986 call test_settime(10) |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
987 edit Xbufa |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
988 4mark a |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
989 wviminfo Xviminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
990 edit Xbufb |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
991 4mark b |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
992 wviminfo Xviminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
993 %bwipe |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
994 |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
995 " set marks in buffers again |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
996 call test_settime(20) |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
997 edit Xbufb |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
998 6mark b |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
999 wviminfo Xviminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1000 edit Xbufa |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1001 6mark a |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1002 wviminfo Xviminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1003 %bwipe |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1004 |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1005 " 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
|
1006 edit Xbufa |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1007 rviminfo! Xviminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1008 call assert_equal(6, line("'a")) |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1009 edit Xbufb |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1010 rviminfo! Xviminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1011 call assert_equal(6, line("'b")) |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1012 |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1013 " cleanup |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1014 %bwipe |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1015 call delete('Xviminfo') |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1016 call delete('Xbufa') |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1017 call delete('Xbufb') |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1018 call test_settime(0) |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1019 let &viminfo=save_viminfo |
a5de1d88590d
patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
18233
diff
changeset
|
1020 endfunc |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1021 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1022 " 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
|
1023 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
|
1024 " Missing number |
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=\"', 'E526:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1026 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
|
1027 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
|
1028 endfor |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1029 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1030 " Missing comma |
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=%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=!%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=h%10', 'E527:') |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1034 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
|
1035 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
|
1036 |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1037 " Missing ' setting |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1038 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
|
1039 endfunc |
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1040 |
22985
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1041 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
|
1042 CheckRunVimInTerminal |
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1043 |
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1044 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
|
1045 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
|
1046 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
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 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
|
1052 qall |
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1053 [CODE] |
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 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
|
1055 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
|
1056 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
|
1057 |
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 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
|
1063 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
|
1064 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
|
1065 |
6d3dee0d7de5
patch 8.2.2592: code coverage could be improved
Bram Moolenaar <Bram@vim.org>
parents:
23911
diff
changeset
|
1066 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
|
1067 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
|
1068 |
22985
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1069 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
|
1070 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
|
1071 endfunc |
d768cdd50602
patch 8.2.2039: viminfo is not written when creating a new file
Bram Moolenaar <Bram@vim.org>
parents:
21580
diff
changeset
|
1072 |
24946
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1073 " 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
|
1074 " 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
|
1075 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
|
1076 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
|
1077 wviminfo Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1078 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
|
1079 let @/ = 'abc' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1080 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1081 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
|
1082 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
|
1083 wviminfo Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1084 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
|
1085 let @/ = 'abc' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1086 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1087 call assert_equal("\n", @/) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1088 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1089 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1090 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1091 " 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
|
1092 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
|
1093 CheckUnix |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1094 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
|
1095 return |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1096 endif |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1097 let save_viminfo = &viminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1098 set viminfo+=r/tmp |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1099 edit /tmp/Xvima1b2c3 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1100 wviminfo Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1101 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
|
1102 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
|
1103 let &viminfo = save_viminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1104 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1105 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1106 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1107 " 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
|
1108 " 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
|
1109 " 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
|
1110 func Test_viminfo_hlsearch() |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1111 set viminfo&vim |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1112 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1113 new |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1114 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
|
1115 " 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
|
1116 " text for later comparison |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1117 set hlsearch |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1118 let @/ = 'three' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1119 redraw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1120 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
|
1121 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
|
1122 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1123 set viminfo-=h |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1124 let @/='two' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1125 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1126 let @/='one' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1127 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1128 redraw! |
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, 5)) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1130 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
|
1131 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
|
1132 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1133 set viminfo+=h |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1134 let @/='two' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1135 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1136 let @/='one' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1137 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1138 redraw! |
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, 5)) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1140 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
|
1141 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
|
1142 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1143 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1144 set hlsearch& viminfo&vim |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1145 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1146 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1147 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1148 " 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
|
1149 " file. |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1150 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
|
1151 set viminfo&vim |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1152 new |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1153 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
|
1154 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1155 " restore 'nomagic' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1156 set nomagic |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1157 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
|
1158 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1159 set magic |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1160 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
|
1161 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1162 exe "normal! gg/\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1163 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
|
1164 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1165 " restore 'magic' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1166 set magic |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1167 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
|
1168 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1169 set nomagic |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1170 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
|
1171 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1172 exe "normal! gg/\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1173 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
|
1174 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1175 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1176 set viminfo&vim magic& |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1177 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1178 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1179 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1180 " 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
|
1181 " file. |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1182 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
|
1183 new |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1184 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
|
1185 set ignorecase smartcase |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1186 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1187 " 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
|
1188 exe "normal! gg$b*" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1189 wviminfo! 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/one\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1191 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1192 exe "normal! gg/\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1193 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
|
1194 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1195 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1196 set ignorecase& smartcase& viminfo& |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1197 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1198 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1199 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1200 " 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
|
1201 " from the viminfo file. |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1202 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
|
1203 new |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1204 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
|
1205 " line offset |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1206 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
|
1207 wviminfo! 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/five\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1209 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1210 exe "normal! gg/\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1211 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
|
1212 " character offset |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1213 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
|
1214 wviminfo! 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/two\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1216 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1217 exe "normal! gg/\<CR>" |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1218 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
|
1219 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1220 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1221 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1222 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1223 " 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
|
1224 " from the viminfo file |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1225 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
|
1226 let g:val = 1 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1227 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
|
1228 normal! @a |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1229 wviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1230 let @b = '' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1231 normal! @b |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1232 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1233 normal @@ |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1234 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
|
1235 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1236 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1237 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1238 " 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
|
1239 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
|
1240 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
|
1241 call test_settime(t) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1242 exe 'edit ' .. f |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1243 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
|
1244 exe l . 'mark a' |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1245 wviminfo Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1246 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1247 endfor |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1248 call test_settime(30) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1249 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
|
1250 exe 'edit ' .. f |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1251 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1252 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
|
1253 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1254 endfor |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1255 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1256 call test_settime(0) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1257 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1258 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1259 " 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
|
1260 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
|
1261 let lines = [] |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1262 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
|
1263 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
|
1264 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
|
1265 call writefile(lines, 'Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1266 edit b.txt |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1267 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
|
1268 12mark b |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1269 wviminfo Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1270 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1271 edit a.txt |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1272 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1273 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
|
1274 edit b.txt |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1275 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1276 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
|
1277 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1278 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1279 |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1280 " 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
|
1281 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
|
1282 let lines = [] |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1283 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
|
1284 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
|
1285 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
|
1286 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
|
1287 call writefile(lines, 'Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1288 clearjumps |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1289 rviminfo! Xviminfo |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1290 let l = getjumplist()[0] |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1291 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
|
1292 \ l[3].lnum]) |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1293 bw! |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1294 call delete('Xviminfo') |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1295 endfunc |
dc3d45d9a4a8
patch 8.2.3010: not enough testing for viminfo code
Bram Moolenaar <Bram@vim.org>
parents:
24101
diff
changeset
|
1296 |
19932
2c4d9ca33769
patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents:
19906
diff
changeset
|
1297 " vim: shiftwidth=2 sts=2 expandtab |