annotate src/testdir/test_viminfo.vim @ 9284:78712a2f687a v7.4.1925

commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 12 21:20:54 2016 +0200 patch 7.4.1925 Problem: Viminfo does not merge file marks properly. Solution: Use a timestamp. Add the :clearjumps command.
author Christian Brabandt <cb@256bit.org>
date Sun, 12 Jun 2016 21:30:06 +0200
parents 083113d751ff
children 8000f0a44744
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
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 function Test_read_and_write()
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
4 call histdel(':')
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 let lines = [
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 \ '# comment line',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ '*encoding=utf-8',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 \ '~MSle0~/asdf',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 \ '|copied as-is',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 \ '|and one more',
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 \ ]
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call writefile(lines, 'Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 rviminfo Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal('asdf', @/)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 wviminfo Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 let lines = readfile('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let done = 0
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 for line in lines
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
20 if line[0] == '|' && line !~ '^|[234],'
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 if done == 0
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
22 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
23 elseif done == 1
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 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
25 elseif done == 2
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal('|and one more', line)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 endif
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let done += 1
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endif
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 endfor
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
31 call assert_equal(3, done)
7664
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call delete('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 endfunc
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 func Test_global_vars()
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 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
38 let g:MY_GLOBAL_DICT = test_dict
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " 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
40 let test_list = range(1,100)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 let g:MY_GLOBAL_LIST = test_list
8796
fb764adba294 commit https://github.com/vim/vim/commit/e9c07270031e312082604d3505650f185aa65948
Christian Brabandt <cb@256bit.org>
parents: 7664
diff changeset
42 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
43 wv! Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 unlet g:MY_GLOBAL_DICT
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 unlet g:MY_GLOBAL_LIST
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 rv! Xviminfo
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 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
49 call assert_equal(test_list, g:MY_GLOBAL_LIST)
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call delete('Xviminfo')
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 set viminfo-=!
1fded31d9e04 commit https://github.com/vim/vim/commit/b20e334859334be35de4b295023a2b49bdabbfa9
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 endfunc
9240
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
54
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
55 func Test_cmdline_history()
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
56 call histdel(':')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
57 call test_settime(11)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
58 call histadd(':', "echo 'one'")
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
59 call test_settime(12)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
60 " split into two lines
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
61 let long800 = repeat(" 'eight'", 100)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
62 call histadd(':', "echo " . long800)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
63 call test_settime(13)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
64 " split into three lines
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
65 let long1400 = repeat(" 'fourteeeeen'", 100)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
66 call histadd(':', "echo " . long1400)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
67 wviminfo Xviminfo
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
68 let lines = readfile('Xviminfo')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
69 let done_colon = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
70 let done_bar = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
71 let lnum = 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
72 while lnum < len(lines)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
73 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
74 if line[0] == ':'
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
75 if done_colon == 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
76 call assert_equal(":\x161408", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
77 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
78 call assert_equal('<echo ' . long1400, line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
79 elseif done_colon == 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
80 call assert_equal(":\x16808", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
81 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
82 call assert_equal("<echo " . long800, line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
83 elseif done_colon == 2
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
84 call assert_equal(":echo 'one'", line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
85 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
86 let done_colon += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
87 elseif line[0:4] == '|2,0,'
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
88 if done_bar == 0
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
89 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
90 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
91 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
92 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
93 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
94 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
95 call assert_equal('|<' . long1400[975:] . '"', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
96 elseif done_bar == 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
97 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
98 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
99 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
100 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
101 call assert_equal('|<' . long800[485:] . '"', line)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
102 elseif done_bar == 2
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
103 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
104 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
105 let done_bar += 1
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
106 endif
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
107 endwhile
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
108 call assert_equal(3, done_colon)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
109 call assert_equal(3, done_bar)
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
110
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
111 call histdel(':')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
112 rviminfo Xviminfo
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
113 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
114 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
115 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
116
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
117 call delete('Xviminfo')
636cfa97200e commit https://github.com/vim/vim/commit/45d2eeaad66939348893b9254171067b0457cd9d
Christian Brabandt <cb@256bit.org>
parents: 8796
diff changeset
118 endfunc
9256
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
119
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
120 func Test_cmdline_history_order()
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
121 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
122 call test_settime(11)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
123 call histadd(':', "echo '11'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
124 call test_settime(22)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
125 call histadd(':', "echo '22'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
126 call test_settime(33)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
127 call histadd(':', "echo '33'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
128 wviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
129
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
130 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
131 " items go in between
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
132 call test_settime(15)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
133 call histadd(':', "echo '15'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
134 call test_settime(27)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
135 call histadd(':', "echo '27'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
136
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
137 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
138 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
139 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
140 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
141 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
142 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
143
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
144 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
145 " items go before and after
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
146 call test_settime(8)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
147 call histadd(':', "echo '8'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
148 call test_settime(39)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
149 call histadd(':', "echo '39'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
150
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
151 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
152 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
153 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
154 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
155 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
156 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
157
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
158 " 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
159 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
160 call test_settime(8)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
161 call histadd(':', "echo '8'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
162 call test_settime(15)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
163 call histadd(':', "echo '15'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
164 call test_settime(27)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
165 call histadd(':', "echo '27'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
166 call test_settime(39)
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
167 call histadd(':', "echo '39'")
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
168 wviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
169
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
170 call histdel(':')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
171 rviminfo Xviminfo
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
180 call delete('Xviminfo')
26c7bf23ec1d commit https://github.com/vim/vim/commit/1fd99c1ca89a3d13bb53aff4a5a8f5ee740713e5
Christian Brabandt <cb@256bit.org>
parents: 9240
diff changeset
181 endfunc
9268
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
182
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
183 func Test_viminfo_registers()
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
184 call test_settime(8)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
185 call setreg('a', "eight", 'c')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
186 call test_settime(20)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
187 call setreg('b', ["twenty", "again"], 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
188 call test_settime(40)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
189 call setreg('c', ["four", "agai"], 'b4')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
190 let l = []
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
191 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
192 for i in range(500)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
193 call add(l, 'something')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
194 endfor
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
195 call setreg('d', l, 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
196 wviminfo Xviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
197
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
198 call test_settime(10)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
199 call setreg('a', '', 'b10')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
200 call test_settime(15)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
201 call setreg('b', 'drop')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
202 call test_settime(50)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
203 call setreg('c', 'keep', 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
204 call test_settime(30)
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
205 call setreg('d', 'drop', 'l')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
206 rviminfo Xviminfo
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
207
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
208 call assert_equal("", getreg('a'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
209 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
210 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
211 call assert_equal("V", getregtype('b'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
212 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
213 call assert_equal("V", getregtype('c'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
214 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
215 call assert_equal("V", getregtype('d'))
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
216
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
217 call delete('Xviminfo')
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
218 endfunc
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
219
9284
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
220 func Test_viminfo_marks()
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
221 sp bufa
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
222 let bufa = bufnr('%')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
223 sp bufb
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
224 let bufb = bufnr('%')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
225
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
226 call test_settime(8)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
227 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
228 call test_settime(20)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
229 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
230 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
231
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
232 delmark 0-9
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
233 call test_settime(25)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
234 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
235 call test_settime(35)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
236 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
237
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
238 call test_settime(45)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
239 wviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
240
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
241 " Writing viminfo inserts the '0 mark.
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
242 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
243 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
244 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
245
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
246 call test_settime(4)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
247 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
248 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
249 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
250 delmark C
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
251
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
252 delmark 0-9
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
253 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
254 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
255 call test_settime(55)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
256 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
257
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
258 rviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
259
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
260 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
261 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
262 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
263
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
264 " numbered marks are merged
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
265 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
266 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
267 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
268 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
269 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
270
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
271 call delete('Xviminfo')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
272 exe 'bwipe ' . bufa
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
273 exe 'bwipe ' . bufb
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
274 endfunc
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
275
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
276 func Test_viminfo_jumplist()
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
277 split testbuf
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
278 clearjumps
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
279 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
280 call cursor(2, 1)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
281 call test_settime(10)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
282 exe "normal /20\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
283 call test_settime(20)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
284 exe "normal /30\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
285 call test_settime(30)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
286 exe "normal /last pos\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
287 wviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
288
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
289 clearjumps
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
290 call cursor(1, 1)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
291 call test_settime(5)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
292 exe "normal /15\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
293 call test_settime(15)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
294 exe "normal /last pos\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
295 call test_settime(40)
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
296 exe "normal ?30\r"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
297 rviminfo Xviminfo
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
298
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
299 call assert_equal('time 30', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
300 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
301 call assert_equal('last pos', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
302 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
303 " duplicate for 'time 30' was removed
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
304 call assert_equal('time 20', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
305 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
306 call assert_equal('time 15', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
307 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
308 call assert_equal('time 10', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
309 exe "normal \<C-O>"
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
310 call assert_equal('time 05', getline('.'))
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
311
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
312 bwipe!
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
313 call delete('Xviminfo')
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
314 endfunc
78712a2f687a commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents: 9274
diff changeset
315
9268
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
316 func Test_viminfo_encoding()
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
317 if !has('multi_byte')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
318 return
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
319 endif
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
320 set enc=latin1
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
321 call histdel(':')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
322 call histadd(':', "echo '\xe9'")
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
323 wviminfo Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
324
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
325 set fencs=utf-8,latin1
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
326 set enc=utf-8
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
327 sp Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
328 call assert_equal('latin1', &fenc)
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
329 close
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
330
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
331 call histdel(':')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
332 rviminfo Xviminfo
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
333 call assert_equal("echo 'é'", histget(':', -1))
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
334
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
335 call delete('Xviminfo')
a00e32b5bb39 commit https://github.com/vim/vim/commit/012270936c3c7df3bba45ad2b48938c23a2fd43a
Christian Brabandt <cb@256bit.org>
parents: 9256
diff changeset
336 endfunc
9270
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
337
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
338 func Test_viminfo_bad_syntax()
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
339 let lines = []
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
340 call add(lines, '|<') " empty continuation line
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
341 call add(lines, '|234234234234234324,nothing')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
342 call add(lines, '|1+"no comma"')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
343 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
344 call add(lines, '|1,"string version"')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
345 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
346 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
347 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
348 call add(lines, '|1,,,,') "trailing comma
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
349 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
350 call writefile(lines, 'Xviminfo')
9274
083113d751ff commit https://github.com/vim/vim/commit/e80ff7448d886805b459250b090aaa20d96e8c2b
Christian Brabandt <cb@256bit.org>
parents: 9270
diff changeset
351 rviminfo Xviminfo
9270
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
352
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
353 call delete('Xviminfo')
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
354 endfunc
79cb08f0d812 commit https://github.com/vim/vim/commit/62f8b4e18014b259bcde4a2845c602b0a44a3714
Christian Brabandt <cb@256bit.org>
parents: 9268
diff changeset
355