annotate src/testdir/test_viminfo.vim @ 22470:f7471450243c v8.2.1783

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