annotate src/testdir/test_registers.vim @ 32669:448aef880252

normalize line endings
author Christian Brabandt <cb@256bit.org>
date Mon, 26 Jun 2023 09:54:34 +0200
parents 66c70cf4387c
children 695b50472e85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32669
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
1 " Tests for register operations
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
3 source check.vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
4 source view_util.vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
5
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
6 " This test must be executed first to check for empty and unset registers.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
7 func Test_aaa_empty_reg_test()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
8 call assert_fails('normal @@', 'E748:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
9 call assert_fails('normal @%', 'E354:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
10 call assert_fails('normal @#', 'E354:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
11 call assert_fails('normal @!', 'E354:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
12 call assert_fails('normal @:', 'E30:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
13 call assert_fails('normal @.', 'E29:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
14 call assert_fails('put /', 'E35:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
15 call assert_fails('put .', 'E29:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
16 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
17
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
18 func Test_yank_shows_register()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
19 enew
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
20 set report=0
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
21 call setline(1, ['foo', 'bar'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
22 " Line-wise
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
23 exe 'norm! yy'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
24 call assert_equal('1 line yanked', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
25 exe 'norm! "zyy'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
26 call assert_equal('1 line yanked into "z', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
27 exe 'norm! yj'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
28 call assert_equal('2 lines yanked', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
29 exe 'norm! "zyj'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
30 call assert_equal('2 lines yanked into "z', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
31
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
32 " Block-wise
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
33 exe "norm! \<C-V>y"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
34 call assert_equal('block of 1 line yanked', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
35 exe "norm! \<C-V>\"zy"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
36 call assert_equal('block of 1 line yanked into "z', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
37 exe "norm! \<C-V>jy"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
38 call assert_equal('block of 2 lines yanked', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
39 exe "norm! \<C-V>j\"zy"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
40 call assert_equal('block of 2 lines yanked into "z', v:statusmsg)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
41
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
42 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
43 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
44
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
45 func Test_display_registers()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
46 e file1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
47 e file2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
48 call setline(1, ['foo', 'bar'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
49 /bar
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
50 exe 'norm! y2l"axx'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
51 call feedkeys("i\<C-R>=2*4\n\<esc>")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
52 call feedkeys(":ls\n", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
53
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
54 " these commands work in the sandbox
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
55 let a = execute('sandbox display')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
56 let b = execute('sandbox registers')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
57
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
58 call assert_equal(a, b)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
59 call assert_match('^\nType Name Content\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
60 \ . ' c "" a\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
61 \ . ' c "0 ba\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
62 \ . ' c "a b\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
63 \ . '.*'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
64 \ . ' c "- a\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
65 \ . '.*'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
66 \ . ' c ": ls\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
67 \ . ' c "% file2\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
68 \ . ' c "# file1\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
69 \ . ' c "/ bar\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
70 \ . ' c "= 2\*4', a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
71
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
72 let a = execute('registers a')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
73 call assert_match('^\nType Name Content\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
74 \ . ' c "a b', a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
75
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
76 let a = execute('registers :')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
77 call assert_match('^\nType Name Content\n'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
78 \ . ' c ": ls', a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
79
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
80 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
81 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
82
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
83 func Test_register_one()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
84 " delete a line goes into register one
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
85 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
86 call setline(1, "one")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
87 normal dd
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
88 call assert_equal("one\n", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
89
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
90 " delete a word does not change register one, does change "-
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
91 call setline(1, "two")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
92 normal de
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
93 call assert_equal("one\n", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
94 call assert_equal("two", @-)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
95
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
96 " delete a word with a register does not change register one
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
97 call setline(1, "three")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
98 normal "ade
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
99 call assert_equal("three", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
100 call assert_equal("one\n", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
101
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
102 " delete a word with register DOES change register one with one of a list of
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
103 " operators
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
104 " %
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
105 call setline(1, ["(12)3"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
106 normal "ad%
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
107 call assert_equal("(12)", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
108 call assert_equal("(12)", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
109
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
110 " (
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
111 call setline(1, ["first second"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
112 normal $"ad(
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
113 call assert_equal("first secon", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
114 call assert_equal("first secon", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
115
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
116 " )
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
117 call setline(1, ["First Second."])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
118 normal gg0"ad)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
119 call assert_equal("First Second.", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
120 call assert_equal("First Second.", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
121
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
122 " `
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
123 call setline(1, ["start here."])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
124 normal gg0fhmx0"ad`x
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
125 call assert_equal("start ", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
126 call assert_equal("start ", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
127
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
128 " /
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
129 call setline(1, ["searchX"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
130 exe "normal gg0\"ad/X\<CR>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
131 call assert_equal("search", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
132 call assert_equal("search", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
133
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
134 " ?
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
135 call setline(1, ["Ysearch"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
136 exe "normal gg$\"ad?Y\<CR>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
137 call assert_equal("Ysearc", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
138 call assert_equal("Ysearc", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
139
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
140 " n
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
141 call setline(1, ["Ynext"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
142 normal gg$"adn
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
143 call assert_equal("Ynex", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
144 call assert_equal("Ynex", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
145
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
146 " N
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
147 call setline(1, ["prevY"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
148 normal gg0"adN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
149 call assert_equal("prev", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
150 call assert_equal("prev", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
151
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
152 " }
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
153 call setline(1, ["one", ""])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
154 normal gg0"ad}
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
155 call assert_equal("one\n", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
156 call assert_equal("one\n", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
157
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
158 " {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
159 call setline(1, ["", "two"])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
160 normal 2G$"ad{
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
161 call assert_equal("\ntw", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
162 call assert_equal("\ntw", @1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
163
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
164 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
165 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
166
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
167 func Test_recording_status_in_ex_line()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
168 norm qx
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
169 redraw!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
170 call assert_equal('recording @x', Screenline(&lines))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
171 set shortmess=q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
172 redraw!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
173 call assert_equal('recording', Screenline(&lines))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
174 set shortmess&
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
175 norm q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
176 redraw!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
177 call assert_equal('', Screenline(&lines))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
178 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
179
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
180 " Check that replaying a typed sequence does not use an Esc and following
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
181 " characters as an escape sequence.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
182 func Test_recording_esc_sequence()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
183 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
184 try
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
185 let save_F2 = &t_F2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
186 catch
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
187 endtry
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
188 let t_F2 = "\<Esc>OQ"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
189 call feedkeys("qqiTest\<Esc>", "xt")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
190 call feedkeys("OQuirk\<Esc>q", "xt")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
191 call feedkeys("Go\<Esc>@q", "xt")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
192 call assert_equal(['Quirk', 'Test', 'Quirk', 'Test'], getline(1, 4))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
193 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
194 if exists('save_F2')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
195 let &t_F2 = save_F2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
196 else
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
197 set t_F2=
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
198 endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
199 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
200
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
201 func Test_recording_with_select_mode()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
202 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
203 call feedkeys("qacc12345\<Esc>gH98765\<Esc>q", "tx")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
204 call assert_equal("98765", getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
205 call assert_equal("cc12345\<Esc>gH98765\<Esc>", @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
206 call setline(1, 'asdf')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
207 normal! @a
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
208 call assert_equal("98765", getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
209 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
210 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
211
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
212 " Test for executing the last used register (@)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
213 func Test_last_used_exec_reg()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
214 " Test for the @: command
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
215 let a = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
216 call feedkeys(":let a ..= 'Vim'\<CR>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
217 normal @:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
218 call assert_equal('VimVim', a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
219
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
220 " Test for the @= command
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
221 let x = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
222 let a = ":let x ..= 'Vim'\<CR>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
223 exe "normal @=a\<CR>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
224 normal @@
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
225 call assert_equal('VimVim', x)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
226
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
227 " Test for the @. command
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
228 let a = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
229 call feedkeys("i:let a ..= 'Edit'\<CR>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
230 normal @.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
231 normal @@
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
232 call assert_equal('EditEdit', a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
233
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
234 " Test for repeating the last command-line in visual mode
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
235 call append(0, 'register')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
236 normal gg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
237 let @r = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
238 call feedkeys("v:yank R\<CR>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
239 call feedkeys("v@:", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
240 call assert_equal("\nregister\nregister\n", @r)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
241
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
242 enew!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
243 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
244
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
245 func Test_get_register()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
246 enew
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
247 edit Xfile1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
248 edit Xfile2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
249 call assert_equal('Xfile2', getreg('%'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
250 call assert_equal('Xfile1', getreg('#'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
251
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
252 call feedkeys("iTwo\<Esc>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
253 call assert_equal('Two', getreg('.'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
254 call assert_equal('', getreg('_'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
255 call assert_beeps('normal ":yy')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
256 call assert_beeps('normal "%yy')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
257 call assert_beeps('normal ".yy')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
258
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
259 call assert_equal('', getreg("\<C-F>"))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
260 call assert_equal('', getreg("\<C-W>"))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
261 call assert_equal('', getreg("\<C-L>"))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
262 " Change the last used register to '"' for the next test
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
263 normal! ""yy
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
264 let @" = 'happy'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
265 call assert_equal('happy', getreg())
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
266 call assert_equal('happy', getreg(''))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
267
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
268 call assert_equal('', getregtype('!'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
269 call assert_fails('echo getregtype([])', 'E730:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
270 call assert_equal('v', getregtype())
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
271 call assert_equal('v', getregtype(''))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
272
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
273 " Test for inserting an invalid register content
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
274 call assert_beeps('exe "normal i\<C-R>!"')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
275
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
276 " Test for inserting a register with multiple lines
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
277 call deletebufline('', 1, '$')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
278 call setreg('r', ['a', 'b'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
279 exe "normal i\<C-R>r"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
280 call assert_equal(['a', 'b', ''], getline(1, '$'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
281
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
282 " Test for inserting a multi-line register in the command line
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
283 call feedkeys(":\<C-R>r\<Esc>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
284 call assert_equal("a\rb\r", histget(':', -1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
285
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
286 call assert_fails('let r = getreg("=", [])', 'E745:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
287 call assert_fails('let r = getreg("=", 1, [])', 'E745:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
288 enew!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
289
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
290 " Using a register in operator-pending mode should fail
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
291 call assert_beeps('norm! c"')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
292 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
293
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
294 func Test_set_register()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
295 call assert_fails("call setreg('#', 200)", 'E86:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
296 call assert_fails("call setreg('a', test_unknown())", 'E908:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
297
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
298 edit Xfile_alt_1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
299 let b1 = bufnr('')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
300 edit Xfile_alt_2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
301 let b2 = bufnr('')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
302 edit Xfile_alt_3
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
303 let b3 = bufnr('')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
304 call setreg('#', 'alt_1')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
305 call assert_equal('Xfile_alt_1', getreg('#'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
306 call setreg('#', b2)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
307 call assert_equal('Xfile_alt_2', getreg('#'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
308
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
309 let ab = 'regwrite'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
310 call setreg('=', '')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
311 call setreg('=', 'a', 'a')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
312 call setreg('=', 'b', 'a')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
313 call assert_equal('regwrite', getreg('='))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
314
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
315 " Test for setting a list of lines to special registers
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
316 call setreg('/', [])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
317 call assert_equal('', @/)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
318 call setreg('=', [])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
319 call assert_equal('', @=)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
320 call assert_fails("call setreg('/', ['a', 'b'])", 'E883:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
321 call assert_fails("call setreg('=', ['a', 'b'])", 'E883:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
322 call assert_equal(0, setreg('_', ['a', 'b']))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
323
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
324 " Test for recording to a invalid register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
325 call assert_beeps('normal q$')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
326
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
327 " Appending to a register when recording
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
328 call append(0, "text for clipboard test")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
329 normal gg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
330 call feedkeys('qrllq', 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
331 call feedkeys('qRhhq', 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
332 call assert_equal('llhh', getreg('r'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
333
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
334 " Appending a list of characters to a register from different lines
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
335 let @r = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
336 call append(0, ['abcdef', '123456'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
337 normal gg"ry3l
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
338 call cursor(2, 4)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
339 normal "Ry3l
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
340 call assert_equal('abc456', @r)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
341
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
342 " Test for gP with multiple lines selected using characterwise motion
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
343 %delete
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
344 call append(0, ['vim editor', 'vim editor'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
345 let @r = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
346 exe "normal ggwy/vim /e\<CR>gP"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
347 call assert_equal(['vim editor', 'vim editor', 'vim editor'], getline(1, 3))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
348
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
349 " Test for gP with . register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
350 %delete
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
351 normal iabc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
352 normal ".gp
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
353 call assert_equal('abcabc', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
354 normal 0".gP
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
355 call assert_equal('abcabcabc', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
356
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
357 let @"=''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
358 call setreg('', '1')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
359 call assert_equal('1', @")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
360 call setreg('@', '2')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
361 call assert_equal('2', @")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
362
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
363 enew!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
364 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
365
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
366 " Test for clipboard registers (* and +)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
367 func Test_clipboard_regs()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
368 CheckNotGui
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
369 CheckFeature clipboard_working
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
370
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
371 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
372 call append(0, "text for clipboard test")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
373 normal gg"*yiw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
374 call assert_equal('text', getreg('*'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
375 normal gg2w"+yiw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
376 call assert_equal('clipboard', getreg('+'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
377
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
378 " Test for replacing the clipboard register contents
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
379 set clipboard=unnamed
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
380 let @* = 'food'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
381 normal ggviw"*p
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
382 call assert_equal('text', getreg('*'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
383 call assert_equal('food for clipboard test', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
384 normal ggviw"*p
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
385 call assert_equal('food', getreg('*'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
386 call assert_equal('text for clipboard test', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
387
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
388 " Test for replacing the selection register contents
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
389 set clipboard=unnamedplus
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
390 let @+ = 'food'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
391 normal ggviw"+p
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
392 call assert_equal('text', getreg('+'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
393 call assert_equal('food for clipboard test', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
394 normal ggviw"+p
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
395 call assert_equal('food', getreg('+'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
396 call assert_equal('text for clipboard test', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
397
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
398 " Test for auto copying visually selected text to clipboard register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
399 call setline(1, "text for clipboard test")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
400 let @* = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
401 set clipboard=autoselect
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
402 normal ggwwviwy
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
403 call assert_equal('clipboard', @*)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
404
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
405 " Test for auto copying visually selected text to selection register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
406 let @+ = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
407 set clipboard=autoselectplus
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
408 normal ggwviwy
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
409 call assert_equal('for', @+)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
410
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
411 set clipboard&vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
412 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
413 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
414
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
415 " Test unnamed for both clipboard registers (* and +)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
416 func Test_clipboard_regs_both_unnamed()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
417 CheckNotGui
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
418 CheckFeature clipboard_working
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
419 CheckTwoClipboards
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
420
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
421 let @* = 'xxx'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
422 let @+ = 'xxx'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
423
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
424 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
425
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
426 set clipboard=unnamed,unnamedplus
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
427 call setline(1, ['foo', 'bar'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
428
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
429 " op_yank copies to both
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
430 :1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
431 :normal yw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
432 call assert_equal('foo', getreg('*'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
433 call assert_equal('foo', getreg('+'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
434
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
435 " op_delete only copies to '+'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
436 :2
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
437 :normal dw
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
438 call assert_equal('foo', getreg('*'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
439 call assert_equal('bar', getreg('+'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
440
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
441 set clipboard&vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
442 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
443 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
444
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
445 " Test for restarting the current mode (insert or virtual replace) after
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
446 " executing the contents of a register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
447 func Test_put_reg_restart_mode()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
448 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
449 call append(0, 'editor')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
450 normal gg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
451 let @r = "ivim \<Esc>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
452 call feedkeys("i\<C-O>@r\<C-R>=mode()\<CR>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
453 call assert_equal('vimi editor', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
454
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
455 call setline(1, 'editor')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
456 normal gg
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
457 call feedkeys("gR\<C-O>@r\<C-R>=mode()\<CR>", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
458 call assert_equal('vimReditor', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
459
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
460 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
461 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
462
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
463 " Test for executing a register using :@ command
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
464 func Test_execute_register()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
465 call setreg('r', [])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
466 call assert_beeps('@r')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
467 let i = 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
468 let @q = 'let i+= 1'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
469 @q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
470 @
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
471 call assert_equal(3, i)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
472
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
473 " try to execute expression register and use a backspace to cancel it
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
474 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
475 call feedkeys("@=\<BS>ax\<CR>y", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
476 call assert_equal(['x', 'y'], getline(1, '$'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
477 close!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
478
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
479 " cannot execute a register in operator pending mode
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
480 call assert_beeps('normal! c@r')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
481 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
482
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
483 " Test for getting register info
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
484 func Test_get_reginfo()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
485 enew
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
486 call setline(1, ['foo', 'bar'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
487
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
488 exe 'norm! "zyy'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
489 let info = getreginfo('"')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
490 call assert_equal('z', info.points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
491 call setreg('y', 'baz')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
492 call assert_equal('z', getreginfo('').points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
493 call setreg('y', { 'isunnamed': v:true })
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
494 call assert_equal('y', getreginfo('"').points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
495
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
496 exe '$put'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
497 call assert_equal(getreg('y'), getline(3))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
498 call setreg('', 'qux')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
499 call assert_equal('0', getreginfo('').points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
500 call setreg('x', 'quux')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
501 call assert_equal('0', getreginfo('').points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
502
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
503 let info = getreginfo('')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
504 call assert_equal(getreg('', 1, 1), info.regcontents)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
505 call assert_equal(getregtype(''), info.regtype)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
506
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
507 exe "norm! 0\<c-v>e" .. '"zy'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
508 let info = getreginfo('z')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
509 call assert_equal(getreg('z', 1, 1), info.regcontents)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
510 call assert_equal(getregtype('z'), info.regtype)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
511 call assert_equal(1, +info.isunnamed)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
512
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
513 let info = getreginfo('"')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
514 call assert_equal('z', info.points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
515
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
516 let @a="a1b2"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
517 nnoremap <F2> <Cmd>let g:RegInfo = getreginfo()<CR>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
518 exe "normal \"a\<F2>"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
519 call assert_equal({'regcontents': ['a1b2'], 'isunnamed': v:false,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
520 \ 'regtype': 'v'}, g:RegInfo)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
521 nunmap <F2>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
522 unlet g:RegInfo
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
523
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
524 " The type of "isunnamed" was VAR_SPECIAL but should be VAR_BOOL. Can only
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
525 " be noticed when using json_encod().
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
526 call setreg('a', 'foo')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
527 let reginfo = getreginfo('a')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
528 let expected = #{regcontents: ['foo'], isunnamed: v:false, regtype: 'v'}
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
529 call assert_equal(json_encode(expected), json_encode(reginfo))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
530
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
531 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
532 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
533
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
534 " Test for restoring register with dict from getreginfo
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
535 func Test_set_register_dict()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
536 enew!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
537
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
538 call setreg('"', #{ regcontents: ['one', 'two'],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
539 \ regtype: 'V', points_to: 'z' })
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
540 call assert_equal(['one', 'two'], getreg('"', 1, 1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
541 let info = getreginfo('"')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
542 call assert_equal('z', info.points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
543 call assert_equal('V', info.regtype)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
544 call assert_equal(1, +getreginfo('z').isunnamed)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
545
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
546 call setreg('x', #{ regcontents: ['three', 'four'],
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
547 \ regtype: 'v', isunnamed: v:true })
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
548 call assert_equal(['three', 'four'], getreg('"', 1, 1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
549 let info = getreginfo('"')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
550 call assert_equal('x', info.points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
551 call assert_equal('v', info.regtype)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
552 call assert_equal(1, +getreginfo('x').isunnamed)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
553
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
554 call setreg('y', #{ regcontents: 'five',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
555 \ regtype: "\<c-v>", isunnamed: v:false })
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
556 call assert_equal("\<c-v>4", getreginfo('y').regtype)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
557 call assert_equal(0, +getreginfo('y').isunnamed)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
558 call assert_equal(['three', 'four'], getreg('"', 1, 1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
559 call assert_equal('x', getreginfo('"').points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
560
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
561 call setreg('"', #{ regcontents: 'six' })
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
562 call assert_equal('0', getreginfo('"').points_to)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
563 call assert_equal(1, +getreginfo('0').isunnamed)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
564 call assert_equal(['six'], getreginfo('0').regcontents)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
565 call assert_equal(['six'], getreginfo('"').regcontents)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
566
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
567 let @x = 'one'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
568 call setreg('x', {})
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
569 call assert_equal(1, len(split(execute('reg x'), '\n')))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
570
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
571 call assert_fails("call setreg('0', #{regtype: 'V'}, 'v')", 'E118:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
572 call assert_fails("call setreg('0', #{regtype: 'X'})", 'E475:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
573 call assert_fails("call setreg('0', #{regtype: 'vy'})", 'E475:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
574
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
575 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
576 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
577
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
578 func Test_v_register()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
579 enew
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
580 call setline(1, 'nothing')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
581
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
582 func s:Put()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
583 let s:register = v:register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
584 exec 'normal! "' .. v:register .. 'P'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
585 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
586 nnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
587 nmap <buffer> S <plug>(test)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
588
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
589 let @z = "testz\n"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
590 let @" = "test@\n"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
591
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
592 let s:register = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
593 call feedkeys('"_ddS', 'mx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
594 call assert_equal('test@', getline('.')) " fails before 8.2.0929
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
595 call assert_equal('"', s:register) " fails before 8.2.0929
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
596
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
597 let s:register = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
598 call feedkeys('"zS', 'mx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
599 call assert_equal('z', s:register)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
600
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
601 let s:register = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
602 call feedkeys('"zSS', 'mx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
603 call assert_equal('"', s:register)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
604
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
605 let s:register = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
606 call feedkeys('"_S', 'mx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
607 call assert_equal('_', s:register)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
608
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
609 let s:register = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
610 normal "_ddS
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
611 call assert_equal('"', s:register) " fails before 8.2.0929
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
612 call assert_equal('test@', getline('.')) " fails before 8.2.0929
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
613
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
614 let s:register = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
615 execute 'normal "z:call' "s:Put()\n"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
616 call assert_equal('z', s:register)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
617 call assert_equal('testz', getline('.'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
618
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
619 " Test operator and omap
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
620 let @b = 'testb'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
621 func s:OpFunc(...)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
622 let s:register2 = v:register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
623 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
624 set opfunc=s:OpFunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
625
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
626 normal "bg@l
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
627 normal S
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
628 call assert_equal('"', s:register) " fails before 8.2.0929
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
629 call assert_equal('b', s:register2)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
630
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
631 func s:Motion()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
632 let s:register1 = v:register
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
633 normal! l
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
634 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
635 onoremap <buffer> Q :<c-u>call s:Motion()<cr>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
636
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
637 normal "bg@Q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
638 normal S
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
639 call assert_equal('"', s:register)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
640 call assert_equal('b', s:register1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
641 call assert_equal('"', s:register2)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
642
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
643 set opfunc&
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
644 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
645 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
646
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
647 " Test for executing the contents of a register as an Ex command with line
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
648 " continuation.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
649 func Test_execute_reg_as_ex_cmd()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
650 " Line continuation with just two lines
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
651 let code =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
652 let l = [
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
653 \ 1]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
654 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
655 let @r = code->join("\n")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
656 let l = []
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
657 @r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
658 call assert_equal([1], l)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
659
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
660 " Line continuation with more than two lines
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
661 let code =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
662 let l = [
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
663 \ 1,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
664 \ 2,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
665 \ 3]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
666 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
667 let @r = code->join("\n")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
668 let l = []
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
669 @r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
670 call assert_equal([1, 2, 3], l)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
671
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
672 " use comments interspersed with code
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
673 let code =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
674 let l = [
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
675 "\ one
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
676 \ 1,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
677 "\ two
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
678 \ 2,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
679 "\ three
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
680 \ 3]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
681 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
682 let @r = code->join("\n")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
683 let l = []
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
684 @r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
685 call assert_equal([1, 2, 3], l)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
686
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
687 " use line continuation in the middle
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
688 let code =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
689 let a = "one"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
690 let l = [
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
691 \ 1,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
692 \ 2]
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
693 let b = "two"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
694 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
695 let @r = code->join("\n")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
696 let l = []
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
697 @r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
698 call assert_equal([1, 2], l)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
699 call assert_equal("one", a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
700 call assert_equal("two", b)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
701
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
702 " only one line with a \
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
703 let @r = "\\let l = 1"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
704 call assert_fails('@r', 'E10:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
705
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
706 " only one line with a "\
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
707 let @r = ' "\ let i = 1'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
708 @r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
709 call assert_false(exists('i'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
710
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
711 " first line also begins with a \
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
712 let @r = "\\let l = [\n\\ 1]"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
713 call assert_fails('@r', 'E10:')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
714
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
715 " Test with a large number of lines
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
716 let @r = "let str = \n"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
717 let @r ..= repeat(" \\ 'abcdefghijklmnopqrstuvwxyz' ..\n", 312)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
718 let @r ..= ' \ ""'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
719 @r
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
720 call assert_equal(repeat('abcdefghijklmnopqrstuvwxyz', 312), str)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
721 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
722
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
723 " Test for clipboard registers with ASCII NUL
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
724 func Test_clipboard_nul()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
725 CheckFeature clipboard_working
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
726 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
727
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
728 " Test for putting ASCII NUL into the clipboard
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
729 set clipboard=unnamed
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
730 call append(0, "\ntest")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
731 normal ggyyp
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
732 call assert_equal("^@test^@", strtrans(getreg('*')))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
733 call assert_equal(getline(1), getline(2))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
734 let b = split(execute(":reg *"), "\n")
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
735 call assert_match('"\*\s*\^@test\^J',b[1])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
736
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
737 set clipboard&vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
738 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
739 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
740
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
741 func Test_ve_blockpaste()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
742 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
743 set ve=all
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
744 0put =['QWERTZ','ASDFGH']
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
745 call cursor(1,1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
746 exe ":norm! \<C-V>3ljdP"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
747 call assert_equal(1, col('.'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
748 call assert_equal(getline(1, 2), ['QWERTZ', 'ASDFGH'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
749 call cursor(1,1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
750 exe ":norm! \<C-V>3ljd"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
751 call cursor(1,1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
752 norm! $3lP
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
753 call assert_equal(5, col('.'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
754 call assert_equal(getline(1, 2), ['TZ QWER', 'GH ASDF'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
755 set ve&vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
756 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
757 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
758
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
759 func Test_insert_small_delete()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
760 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
761 call setline(1, ['foo foobar bar'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
762 call cursor(1,1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
763 exe ":norm! ciw'\<C-R>-'"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
764 call assert_equal("'foo' foobar bar", getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
765 exe ":norm! w.w."
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
766 call assert_equal("'foo' 'foobar' 'bar'", getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
767 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
768 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
769
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
770 " Record in insert mode using CTRL-O
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
771 func Test_record_in_insert_mode()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
772 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
773 let @r = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
774 call setline(1, ['foo'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
775 call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
776 call assert_equal('baz', @r)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
777 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
778 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
779
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
780 func Test_record_in_select_mode()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
781 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
782 call setline(1, 'text')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
783 sil norm q00
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
784 sil norm q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
785 call assert_equal('0ext', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
786
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
787 %delete
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
788 let @r = ''
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
789 call setline(1, ['abc', 'abc', 'abc'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
790 smap <F2> <Right><Right>,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
791 call feedkeys("qrgh\<F2>Dk\<Esc>q", 'xt')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
792 call assert_equal("gh\<F2>Dk\<Esc>", @r)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
793 norm j0@rj0@@
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
794 call assert_equal([',Dk', ',Dk', ',Dk'], getline(1, 3))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
795 sunmap <F2>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
796
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
797 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
798 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
799
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
800 " mapping that ends macro recording should be removed from recorded macro
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
801 func Test_end_record_using_mapping()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
802 call setline(1, 'aaa')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
803 nnoremap s q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
804 call feedkeys('safas', 'tx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
805 call assert_equal('fa', @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
806 nunmap s
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
807
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
808 nnoremap xx q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
809 call feedkeys('0xxafaxx', 'tx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
810 call assert_equal('fa', @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
811 nunmap xx
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
812
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
813 nnoremap xsx q
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
814 call feedkeys('0qafaxsx', 'tx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
815 call assert_equal('fa', @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
816 nunmap xsx
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
817
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
818 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
819 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
820
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
821 func Test_end_reg_executing()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
822 nnoremap s <Nop>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
823 let @a = 's'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
824 call feedkeys("@aqaq\<Esc>", 'tx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
825 call assert_equal('', @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
826 call assert_equal('', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
827
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
828 call setline(1, 'aaa')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
829 nnoremap s qa
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
830 let @a = 'fa'
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
831 call feedkeys("@asq\<Esc>", 'tx')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
832 call assert_equal('', @a)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
833 call assert_equal('aaa', getline(1))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
834
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
835 nunmap s
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
836 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
837 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
838
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
839 " This was causing a crash because y_append was ending up being NULL
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
840 func Test_zero_y_append()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
841 " Run in a separate Vim instance because changing 'encoding' may cause
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
842 " trouble for later tests.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
843 let lines =<< trim END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
844 d
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
845 silent ?n
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
846 next <sfile>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
847 so
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
848 sil! norm 0V€PSP
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
849 set enc=latin1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
850  
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
851 END
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
852 call writefile(lines, 'XTest_zero_y_append', 'D')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
853 call RunVim([], [], '-u NONE -i NONE -e -s -S XTest_zero_y_append -c qa\!')
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
854 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
855
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
856 " Make sure that y_append is correctly reset
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
857 " and the previous register is working as expected
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
858 func Test_register_y_append_reset()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
859 new
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
860 call setline(1, ['1',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
861 \ '2 ----------------------------------------------------',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
862 \ '3',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
863 \ '4',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
864 \ '5 ----------------------------------------------------',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
865 \ '6',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
866 \ '7',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
867 \ '8 ----------------------------------------------------',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
868 \ '9',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
869 \ '10 aaaaaaa 4.',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
870 \ '11 Game Dbl-Figures Leaders:',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
871 \ '12 Player Pts FG% 3P% FT% RB AS BL ST TO PF EFF',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
872 \ '13 bbbbbbbbb 12 (50 /0 /67 )/ 7/ 3/ 0/ 2/ 3/ 4/+15',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
873 \ '14 cccccc 12 (57 /67 /100)/ 2/ 1/ 1/ 0/ 1/ 3/+12',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
874 \ '15 ddddddd 10 (63 /0 /0 )/ 1/ 3/ 0/ 3/ 5/ 3/ +9',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
875 \ '16 4 5-15 0-3 2-2 5-12 1-1 3-4 33.3 0.0 100 41.7 100 75 12 14',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
876 \ '17 F 23-55 2-10 9-11 23-52 3-13 26-29 41.8 20 81.8 44.2 23.1 89.7 57 75',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
877 \ '18 4 3 6 3 2 3 3 4 3 3 7 3 1 4 6 -1 -1 +2 -1 -2',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
878 \ '19 F 13 19 5 10 4 17 22 9 14 32 13 4 20 17 -1 -13 -4 -3 -3 +5'])
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
879 11
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
880 exe "norm! \"a5dd"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
881 norm! j
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
882 exe "norm! \"bY"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
883 norm! 2j
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
884 exe "norm! \"BY"
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
885 norm! 4k
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
886 norm! 5dd
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
887 norm! 3k
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
888 " The next put should put the content of the unnamed register, not of
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
889 " register b!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
890 norm! p
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
891 call assert_equal(['1',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
892 \ '2 ----------------------------------------------------',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
893 \ '3',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
894 \ '4',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
895 \ '5 ----------------------------------------------------',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
896 \ '6',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
897 \ '10 aaaaaaa 4.',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
898 \ '16 4 5-15 0-3 2-2 5-12 1-1 3-4 33.3 0.0 100 41.7 100 75 12 14',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
899 \ '17 F 23-55 2-10 9-11 23-52 3-13 26-29 41.8 20 81.8 44.2 23.1 89.7 57 75',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
900 \ '18 4 3 6 3 2 3 3 4 3 3 7 3 1 4 6 -1 -1 +2 -1 -2',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
901 \ '19 F 13 19 5 10 4 17 22 9 14 32 13 4 20 17 -1 -13 -4 -3 -3 +5',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
902 \ '7',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
903 \ '8 ----------------------------------------------------',
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
904 \ '9'], getline(1,'$'))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
905 bwipe!
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
906 endfunc
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
907
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32529
diff changeset
908 " vim: shiftwidth=2 sts=2 expandtab