annotate src/testdir/test_viminfo.vim @ 20735:298ef749e5fb v8.2.0920

patch 8.2.0920: writing viminfo fails with a circular reference Commit: https://github.com/vim/vim/commit/5b157fe2edfdce5f77080aeac2b4a03f39eb1c1a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 7 16:08:08 2020 +0200 patch 8.2.0920: writing viminfo fails with a circular reference Problem: Writing viminfo fails with a circular reference. Solution: Use copyID to detect the cycle. (closes https://github.com/vim/vim/issues/6217)
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Jun 2020 16:15:03 +0200
parents 2c4d9ca33769
children 505d97ea54da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for reading and writing .viminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
3 source check.vim
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
4
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
5 function 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
6 " 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
7 " 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
8 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
9 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
10 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
11
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
12 call histdel(':')
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let lines = [
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 \ '# comment line',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ '*encoding=utf-8',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ '~MSle0~/asdf',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ '|copied as-is',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ '|and one more',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ ]
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call writefile(lines, 'Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 rviminfo Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal('asdf', @/)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 wviminfo Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 let lines = readfile('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let done = 0
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 for line in lines
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
28 if line[0] == '|' && line !~ '^|[234],' && line !~ '^|<'
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 if done == 0
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
30 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
31 elseif done == 1
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 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
33 elseif done == 2
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal('|and one more', line)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endif
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let done += 1
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 endif
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 endfor
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
39 call assert_equal(3, done)
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call delete('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 endfunc
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 func Test_global_vars()
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
45 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
46 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
47 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
48 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
49 let g:MY_GLOBAL_DICT = test_dict
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 " 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
51 let test_list = range(1,100)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 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
53 let test_blob = 0z00112233445566778899aabbccddeeff
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
54 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
55 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
56 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
57 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
58 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
59 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
60 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
61 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
62 let g:MY_GLOBAL_NONE = test_none
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
63
8796
fb764adba294 commit https://github.com/vim/vim/commit/e9c07270031e312082604d3505650f185aa65948
Christian Brabandt <cb@256bit.org>
parents: 7664
diff changeset
64 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
65 wv! Xviminfo
15466
435fcefd2c8e patch 8.1.0741: viminfo with Blob is not tested
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
66
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
67 unlet g:MY_GLOBAL_STRING
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
68 unlet g:MY_GLOBAL_NUM
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
69 unlet g:MY_GLOBAL_FLOAT
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 unlet g:MY_GLOBAL_DICT
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 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
72 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
73 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
74 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
75 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
76 unlet g:MY_GLOBAL_NONE
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 rv! Xviminfo
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
79 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
80 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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 call assert_equal(test_none, g:MY_GLOBAL_NONE)
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 call delete('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 set viminfo-=!
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 endfunc
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
93
20735
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
94 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
95 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
96 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
97 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
98 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
99
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
100 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
101 wv! Xviminfo
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
102 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
103
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
104 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
105 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
106
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
107 rv! Xviminfo
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
108 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
109 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
110 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
111
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
112 call delete('Xviminfo')
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
113 set viminfo-=!
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
114 endfunc
298ef749e5fb patch 8.2.0920: writing viminfo fails with a circular reference
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
115
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
116 func Test_cmdline_history()
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
117 call histdel(':')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
118 call test_settime(11)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
119 call histadd(':', "echo 'one'")
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
120 call test_settime(12)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
121 " split into two lines
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
122 let long800 = repeat(" 'eight'", 100)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
123 call histadd(':', "echo " . long800)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
124 call test_settime(13)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
125 " split into three lines
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
126 let long1400 = repeat(" 'fourteeeeen'", 100)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
127 call histadd(':', "echo " . long1400)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
128 wviminfo Xviminfo
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
129 let lines = readfile('Xviminfo')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
130 let done_colon = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
131 let done_bar = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
132 let lnum = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
133 while lnum < len(lines)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
134 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
135 if line[0] == ':'
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
136 if done_colon == 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
137 call assert_equal(":\x161408", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
138 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
139 call assert_equal('<echo ' . long1400, line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
140 elseif done_colon == 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
141 call assert_equal(":\x16808", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
142 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
143 call assert_equal("<echo " . long800, line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
144 elseif done_colon == 2
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
145 call assert_equal(":echo 'one'", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
146 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
147 let done_colon += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
148 elseif line[0:4] == '|2,0,'
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
149 if done_bar == 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
150 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
151 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
152 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
153 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
154 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
155 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
156 call assert_equal('|<' . long1400[975:] . '"', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
157 elseif done_bar == 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
158 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
159 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
160 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
161 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
162 call assert_equal('|<' . long800[485:] . '"', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
163 elseif done_bar == 2
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
164 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
165 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
166 let done_bar += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
167 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
168 endwhile
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
169 call assert_equal(3, done_colon)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
170 call assert_equal(3, done_bar)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
171
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
172 call histdel(':')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
173 rviminfo Xviminfo
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
174 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
175 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
176 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
177
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
178 call delete('Xviminfo')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
179 endfunc
9256
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
180
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
181 func Test_cmdline_history_order()
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
182 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
183 call test_settime(11)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
184 call histadd(':', "echo '11'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
185 call test_settime(22)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
186 call histadd(':', "echo '22'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
187 call test_settime(33)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
188 call histadd(':', "echo '33'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
189 wviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
190
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
191 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
192 " items go in between
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
193 call test_settime(15)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
194 call histadd(':', "echo '15'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
195 call test_settime(27)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
196 call histadd(':', "echo '27'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
197
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
198 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
199 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
200 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
201 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
202 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
203 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
204
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
205 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
206 " 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
207 eval 8->test_settime()
9256
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
208 call histadd(':', "echo '8'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
209 call test_settime(39)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
210 call histadd(':', "echo '39'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
211
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
212 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
213 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
214 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
215 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
216 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
217 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
218
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
219 " 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
220 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
221 call test_settime(8)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
222 call histadd(':', "echo '8'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
223 call test_settime(15)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
224 call histadd(':', "echo '15'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
225 call test_settime(27)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
226 call histadd(':', "echo '27'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
227 call test_settime(39)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
228 call histadd(':', "echo '39'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
229 wviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
230
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
231 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
232 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
233 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
234 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
235 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
236 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
237 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
238 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
239 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
240
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
241 call delete('Xviminfo')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
242 endfunc
9268
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
243
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
244 func Test_viminfo_registers()
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
245 call test_settime(8)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
246 call setreg('a', "eight", 'c')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
247 call test_settime(20)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
248 call setreg('b', ["twenty", "again"], 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
249 call test_settime(40)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
250 call setreg('c', ["four", "agai"], 'b4')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
251 let l = []
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
252 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
253 for i in range(500)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
254 call add(l, 'something')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
255 endfor
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
256 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
257 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
258 wviminfo Xviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
259
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
260 call test_settime(10)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
261 call setreg('a', '', 'b10')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
262 call test_settime(15)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
263 call setreg('b', 'drop')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
264 call test_settime(50)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
265 call setreg('c', 'keep', 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
266 call test_settime(30)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
267 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
268 call setreg('e', 'drop')
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
269 rviminfo Xviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
270
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
271 call assert_equal("", getreg('a'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
272 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
273 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
274 call assert_equal("V", getregtype('b'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
275 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
276 call assert_equal("V", getregtype('c'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
277 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
278 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
279 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
280
9978
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
281 " 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
282 let len = 434
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
283 while len < 445
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
284 let s = repeat('a', len)
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
285 call setreg('"', s)
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
286 wviminfo Xviminfo
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
287 call setreg('"', '')
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
288 rviminfo Xviminfo
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
289 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
290
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
291 let len += 1
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
292 endwhile
baad324e9fbc commit https://github.com/vim/vim/commit/257095760732597983bdd026e791907b7980e295
Christian Brabandt <cb@256bit.org>
parents: 9941
diff changeset
293
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
294 call delete('Xviminfo')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
295 endfunc
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
296
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
297 func Test_viminfo_marks()
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
298 sp bufa
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
299 let bufa = bufnr('%')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
300 sp bufb
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
301 let bufb = bufnr('%')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
302
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
303 call test_settime(8)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
304 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
305 call test_settime(20)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
306 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
307 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
308
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
309 delmark 0-9
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
310 call test_settime(25)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
311 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
312 call test_settime(35)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
313 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
314
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
315 call test_settime(45)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
316 wviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
317
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
318 " Writing viminfo inserts the '0 mark.
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
319 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
320 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
321 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
322
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
323 call test_settime(4)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
324 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
325 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
326 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
327 delmark C
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
328
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
329 delmark 0-9
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
330 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
331 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
332 call test_settime(55)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
333 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
334
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
335 rviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
336
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
337 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
338 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
339 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
340
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
341 " numbered marks are merged
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
342 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
343 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
344 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
345 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
346 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
347
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
348 " 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
349 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
350 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
351 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
352 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
353
de2d1820215a patch 8.2.0050: after deleting a file mark it is still in viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18277
diff changeset
354 " 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
355 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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
365 call delete('Xviminfo')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
366 exe 'bwipe ' . bufa
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
367 exe 'bwipe ' . bufb
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
368 endfunc
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
369
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
370 func Test_viminfo_jumplist()
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
371 split testbuf
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
372 clearjumps
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
373 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
374 call cursor(2, 1)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
375 call test_settime(10)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
376 exe "normal /20\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
377 call test_settime(20)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
378 exe "normal /30\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
379 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
380 exe "normal /last pos\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
381 wviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
382
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
383 clearjumps
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
384 call cursor(1, 1)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
385 call test_settime(5)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
386 exe "normal /15\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
387 call test_settime(15)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
388 exe "normal /last pos\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
389 call test_settime(40)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
390 exe "normal ?30\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
391 rviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
392
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
393 call assert_equal('time 30', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
394 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
395 call assert_equal('last pos', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
396 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
397 " duplicate for 'time 30' was removed
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
398 call assert_equal('time 20', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
399 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
400 call assert_equal('time 15', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
401 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
402 call assert_equal('time 10', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
403 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
404 call assert_equal('time 05', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
405
9299
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
406 clearjumps
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
407 call cursor(1, 1)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
408 call test_settime(5)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
409 exe "normal /15\r"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
410 call test_settime(15)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
411 exe "normal /last pos\r"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
412 call test_settime(40)
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
413 exe "normal ?30\r"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
414 " Test merge when writing
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
415 wviminfo Xviminfo
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
416 clearjumps
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
417 rviminfo Xviminfo
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
418
9313
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
419 let last_line = line('.')
9299
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
420 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
421 call assert_equal('time 30', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
422 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
423 call assert_equal('last pos', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
424 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
425 " duplicate for 'time 30' was removed
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
426 call assert_equal('time 20', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
427 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
428 call assert_equal('time 15', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
429 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
430 call assert_equal('time 10', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
431 exe "normal \<C-O>"
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
432 call assert_equal('time 05', getline('.'))
8000f0a44744 commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents: 9284
diff changeset
433
9313
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
434 " Test with jumplist full.
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
435 clearjumps
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
436 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
437 call cursor(1, 1)
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
438 call test_settime(10)
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
439 for i in range(100)
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
440 exe "normal /here\r"
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
441 endfor
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
442 rviminfo Xviminfo
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
443
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
444 " 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
445 exe "normal \<C-O>"
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
446 call assert_equal(last_line, line('.'))
c0760b25f31d commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents: 9299
diff changeset
447
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
448 bwipe!
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
449 call delete('Xviminfo')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
450 endfunc
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
451
9268
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
452 func Test_viminfo_encoding()
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
453 set enc=latin1
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
454 call histdel(':')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
455 call histadd(':', "echo '\xe9'")
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
456 wviminfo Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
457
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
458 set fencs=utf-8,latin1
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
459 set enc=utf-8
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
460 sp Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
461 call assert_equal('latin1', &fenc)
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
462 close
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
463
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
464 call histdel(':')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
465 rviminfo Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
466 call assert_equal("echo 'é'", histget(':', -1))
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
467
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
468 call delete('Xviminfo')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
469 endfunc
9270
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
470
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
471 func Test_viminfo_bad_syntax()
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
472 let lines = []
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
473 call add(lines, '|<') " empty continuation line
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
474 call add(lines, '|234234234234234324,nothing')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
475 call add(lines, '|1+"no comma"')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
476 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
477 call add(lines, '|1,"string version"')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
478 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
479 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
480 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
481 call add(lines, '|1,,,,') "trailing comma
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
482 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
483 call writefile(lines, 'Xviminfo')
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
484 rviminfo Xviminfo
9270
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
485
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
486 call delete('Xviminfo')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
487 endfunc
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
488
9414
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
489 func Test_viminfo_file_marks()
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
490 silent! bwipe test_viminfo.vim
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
491 silent! bwipe Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
492
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
493 call test_settime(10)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
494 edit ten
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
495 call test_settime(25)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
496 edit again
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
497 call test_settime(30)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
498 edit thirty
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
499 wviminfo Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
500
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
501 call test_settime(20)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
502 edit twenty
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
503 call test_settime(35)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
504 edit again
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
505 call test_settime(40)
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
506 edit fourty
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
507 wviminfo Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
508
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
509 sp Xviminfo
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
510 1
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
511 for name in ['fourty', 'again', 'thirty', 'twenty', 'ten']
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
512 /^>
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
513 call assert_equal(name, substitute(getline('.'), '.*/', '', ''))
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
514 endfor
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
515 close
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
516
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
517 call delete('Xviminfo')
1003973c99df commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents: 9313
diff changeset
518 endfunc
9875
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
519
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
520 func Test_viminfo_file_mark_tabclose()
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
521 tabnew Xtestfileintab
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
522 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
523 4
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
524 q!
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
525 wviminfo Xviminfo
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
526 sp Xviminfo
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
527 /^> .*Xtestfileintab
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
528 let lnum = line('.')
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
529 while 1
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
530 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
531 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
532 break
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
533 endif
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
534 let lnum += 1
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
535 let line = getline(lnum)
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
536 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
537 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
538 break
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
539 endif
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
540 if line =~ "^\t\""
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
541 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
542 break
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
543 endif
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
544 endwhile
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
545
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
546 call delete('Xviminfo')
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
547 silent! bwipe Xtestfileintab
42adbf172ecd commit https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Christian Brabandt <cb@256bit.org>
parents: 9414
diff changeset
548 endfunc
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
549
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
550 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
551 let lines = [
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
552 \ '# Viminfo version',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
553 \ '|1,4',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
554 \ '',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
555 \ '*encoding=utf-8',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
556 \ '',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
557 \ '# File marks:',
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
558 \ "'B 1 0 /tmp/nothing",
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
559 \ '|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
560 \ "",
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
561 \ ]
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
562 call writefile(lines, 'Xviminfo')
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
563 delmark B
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
564 rviminfo Xviminfo
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
565 call delete('Xviminfo')
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
566 call assert_equal(1, line("'B"))
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
567 delmark B
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
568 endfunc
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
569
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
570 " 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
571 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
572 let save_viminfo = &viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
573 set viminfo&vim
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
574 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
575 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
576 edit! Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
577 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
578 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
579 enew
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
580 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
581 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
582 edit Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
583 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
584 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
585 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
586 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
587 call delete('Xfile1')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
588 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
589 let &viminfo = save_viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
590 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
591
10285
cd16ef948ad1 commit https://github.com/vim/vim/commit/156919f99afd1ac11d19d4270afbc1afb7245640
Christian Brabandt <cb@256bit.org>
parents: 9978
diff changeset
592 func Test_viminfo_oldfiles()
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
593 let v:oldfiles = []
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
594 let lines = [
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
595 \ '# comment line',
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
596 \ '*encoding=utf-8',
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
597 \ '',
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
598 \ ':h viminfo',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
599 \ '?/session',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
600 \ '=myvar',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
601 \ '@123',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
602 \ '',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
603 \ "'E 2 0 /tmp/nothing",
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
604 \ '',
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
605 \ "> /tmp/file_one.txt",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
606 \ "\t\"\t11\t0",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
607 \ "",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
608 \ "> /tmp/file_two.txt",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
609 \ "\t\"\t11\t0",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
610 \ "",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
611 \ "> /tmp/another.txt",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
612 \ "\t\"\t11\t0",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
613 \ "",
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
614 \ ]
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
615 call writefile(lines, 'Xviminfo')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
616 delmark E
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
617 rviminfo! Xviminfo
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
618 call delete('Xviminfo')
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
619
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
620 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
621 call assert_equal('session', histget('/'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
622 call assert_equal('myvar', histget('='))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
623 call assert_equal('123', histget('@'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
624 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
625 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
626 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
627 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
628
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
629 new
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
630 call feedkeys("3\<CR>", 't')
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
631 browse oldfiles
24d7a7d27471 patch 8.1.1764: ":browse oldfiles" is not tested
Bram Moolenaar <Bram@vim.org>
parents: 17466
diff changeset
632 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
633 bwipe
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
634 delmark E
9915
4da1a3879100 commit https://github.com/vim/vim/commit/e11d61a3b1cdedf3144de697a2b38af62c3a78d8
Christian Brabandt <cb@256bit.org>
parents: 9875
diff changeset
635 endfunc
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
636
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
637 " 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
638 func Test_viminfo_bufferlist()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
639 " 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
640 " 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
641 %argdelete
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
642
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
643 edit Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
644 edit Xfile2
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
645 set viminfo-=%
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
646 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
647 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
648 rviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
649 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
650
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
651 edit Xfile1
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
652 edit Xfile2
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
653 set viminfo^=%
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
654 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
655 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
656 rviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
657 let l = getbufinfo()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
658 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
659 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
660 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
661
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
662 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
663 %bwipe
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
664 set viminfo-=%
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
665 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
666
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
667 " 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
668 func Test_viminfo_error()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
669 " Non-existing viminfo files
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
670 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
671
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
672 " Illegal starting character
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
673 call writefile(["a 123"], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
674 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
675
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
676 " 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
677 call writefile(['"@ LINE 0'], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
678 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
679
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
680 " Invalid file mark line
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
681 call writefile(['>', '@'], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
682 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
683
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
684 " 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
685 call writefile(repeat(["a 123"], 15), 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
686 call assert_fails('rv Xviminfo', 'E136:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
687
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
688 call writefile(['>'] + repeat(['@'], 10), 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
689 call assert_fails('rv Xviminfo', 'E136:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
690
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
691 call writefile(repeat(['"@'], 15), 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
692 call assert_fails('rv Xviminfo', 'E136:')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
693
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
694 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
695 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
696
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
697 " 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
698 func Test_viminfo_lastsub()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
699 enew
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
700 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
701 call cursor(1, 1)
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
702 s/blue/green/
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
703 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
704 s/blue/yellow/
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
705 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
706 &
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
707 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
708 enew!
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
709 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
710 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
711
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
712 " 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
713 func Test_viminfo_registers_old()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
714 let lines = [
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
715 \ '# Viminfo version',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
716 \ '|1,1',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
717 \ '',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
718 \ '*encoding=utf-8',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
719 \ '',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
720 \ '# Registers:',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
721 \ '""0 CHAR 0',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
722 \ ' Vim',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
723 \ '"a CHAR 0',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
724 \ ' red',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
725 \ '"m@ CHAR 0',
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
726 \ " :echo 'Hello'\<CR>",
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
727 \ "",
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
728 \ ]
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
729 call writefile(lines, 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
730 let @a = 'one'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
731 let @b = 'two'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
732 let @m = 'three'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
733 let @" = 'four'
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
734 let @t = ":echo 'Unix'\<CR>"
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
735 silent! normal @t
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
736 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
737 call assert_equal('red', getreg('a'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
738 call assert_equal('two', getreg('b'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
739 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
740 call assert_equal('Vim', getreg('"'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
741 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
742 call delete('Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
743 let @" = ''
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
744 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
745
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
746 " 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
747 func Test_viminfo_large_register()
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
748 let save_viminfo = &viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
749 set viminfo&vim
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
750 set viminfo-=<50
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
751 set viminfo+=<200
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
752 let lines = ['"r CHAR 0']
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
753 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
754 call writefile(lines, 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
755 let @r = ''
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
756 rviminfo! Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
757 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
758 call delete('Xviminfo')
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
759 let @r = ''
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
760 let &viminfo = save_viminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
761 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
762
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
763 " 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
764 func Test_viminfofile_none()
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
765 let save_vif = &viminfofile
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
766 set viminfofile=NONE
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
767 wviminfo Xviminfo
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
768 call assert_false(filereadable('Xviminfo'))
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
769 call writefile([''], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
770 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
771 call delete('Xviminfo')
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
772 let &viminfofile = save_vif
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
773 endfunc
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
774
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
775 " Test for an unwritable and unreadble 'viminfo' file
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
776 func Test_viminfo_perm()
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
777 CheckUnix
18277
f6dcf7eabd26 patch 8.1.2133: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents: 18263
diff changeset
778 CheckNotRoot
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
779 call writefile([''], 'Xviminfo')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
780 call setfperm('Xviminfo', 'r-x------')
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
781 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
782 call setfperm('Xviminfo', '--x------')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
783 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
784 call delete('Xviminfo')
19906
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
785
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
786 " Try to write the viminfo to a directory
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
787 call mkdir('Xdir')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
788 call assert_fails('wviminfo Xdir', 'E886:')
031184ace7c5 patch 8.2.0509: various code is not properly tested.
Bram Moolenaar <Bram@vim.org>
parents: 18979
diff changeset
789 call delete('Xdir', 'rf')
18233
7d147c191ef7 patch 8.1.2111: viminfo file not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
790 endfunc
18263
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
791
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
792 " 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
793 func XTest_viminfo_marks_merge()
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
794 let save_viminfo = &viminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
795 set viminfo&vim
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
796 set viminfo^=%
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
797 enew
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
798 %argdelete
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
799 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
800
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
801 call writefile(repeat(['editor'], 10), 'Xbufa')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
802 call writefile(repeat(['Vim'], 10), 'Xbufb')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
803
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
804 " set marks in buffers
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
805 call test_settime(10)
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
806 edit Xbufa
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
807 4mark a
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
808 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
809 edit Xbufb
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
810 4mark b
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
811 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
812 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
813
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
814 " set marks in buffers again
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
815 call test_settime(20)
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
816 edit Xbufb
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
817 6mark b
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
818 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
819 edit Xbufa
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
820 6mark a
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
821 wviminfo Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
822 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
823
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
824 " 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
825 edit Xbufa
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
826 rviminfo! Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
827 call assert_equal(6, line("'a"))
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
828 edit Xbufb
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
829 rviminfo! Xviminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
830 call assert_equal(6, line("'b"))
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
831
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
832 " cleanup
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
833 %bwipe
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
834 call delete('Xviminfo')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
835 call delete('Xbufa')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
836 call delete('Xbufb')
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
837 call test_settime(0)
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
838 let &viminfo=save_viminfo
a5de1d88590d patch 8.1.2126: viminfo not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18233
diff changeset
839 endfunc
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
840
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
841 " 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
842 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
843 " Missing number
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
844 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
845 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
846 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
847 endfor
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
848
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
849 " Missing comma
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
850 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
851 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
852 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
853 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
854 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
855
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
856 " Missing ' setting
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
857 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
858 endfunc
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
859
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19906
diff changeset
860 " vim: shiftwidth=2 sts=2 expandtab