annotate src/testdir/test_registers.vim @ 24695:13efbfc53054 v8.2.2886

patch 8.2.2886: various pieces of code not covered by tests Commit: https://github.com/vim/vim/commit/34fcb697240c1bc9e69417ed75db3b1a83479724 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue May 25 20:14:00 2021 +0200 patch 8.2.2886: various pieces of code not covered by tests Problem: Various pieces of code not covered by tests. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8255)
author Bram Moolenaar <Bram@vim.org>
date Tue, 25 May 2021 20:15:03 +0200
parents 72e9b861bc92
children b1440083f0da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
1 " Tests for register operations
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
2
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
3 source check.vim
21246
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
4 source view_util.vim
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
5
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
6 " This test must be executed first to check for empty and unset registers.
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
7 func Test_aaa_empty_reg_test()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
8 call assert_fails('normal @@', 'E748:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
9 call assert_fails('normal @%', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
10 call assert_fails('normal @#', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
11 call assert_fails('normal @!', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
12 call assert_fails('normal @:', 'E30:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
13 call assert_fails('normal @.', 'E29:')
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
14 call assert_fails('put /', 'E35:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
15 call assert_fails('put .', 'E29:')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
16 endfunc
11682
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 func Test_yank_shows_register()
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 enew
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 set report=0
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call setline(1, ['foo', 'bar'])
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " Line-wise
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 exe 'norm! yy'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal('1 line yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 exe 'norm! "zyy'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_equal('1 line yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 exe 'norm! yj'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal('2 lines yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 exe 'norm! "zyj'
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal('2 lines yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 " Block-wise
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 exe "norm! \<C-V>y"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal('block of 1 line yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 exe "norm! \<C-V>\"zy"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal('block of 1 line yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 exe "norm! \<C-V>jy"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal('block of 2 lines yanked', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 exe "norm! \<C-V>j\"zy"
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal('block of 2 lines yanked into "z', v:statusmsg)
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 bwipe!
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
44
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
45 func Test_display_registers()
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
46 e file1
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
47 e file2
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
48 call setline(1, ['foo', 'bar'])
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
49 /bar
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
50 exe 'norm! y2l"axx'
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
51 call feedkeys("i\<C-R>=2*4\n\<esc>")
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
52 call feedkeys(":ls\n", 'xt')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
53
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
54 let a = execute('display')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
55 let b = execute('registers')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
56
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
57 call assert_equal(a, b)
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
58 call assert_match('^\nType Name Content\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
59 \ . ' c "" a\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
60 \ . ' c "0 ba\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
61 \ . ' c "a b\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
62 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
63 \ . ' c "- a\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
64 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
65 \ . ' c ": ls\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
66 \ . ' c "% file2\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
67 \ . ' c "# file1\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
68 \ . ' c "/ bar\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
69 \ . ' c "= 2\*4', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
70
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
71 let a = execute('registers a')
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
72 call assert_match('^\nType Name Content\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
73 \ . ' c "a b', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
74
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
75 let a = execute('registers :')
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
76 call assert_match('^\nType Name Content\n'
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
77 \ . ' c ": ls', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
78
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
79 bwipe!
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
80 endfunc
15987
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
81
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
82 func Test_register_one()
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
83 " delete a line goes into register one
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
84 new
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
85 call setline(1, "one")
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
86 normal dd
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
87 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
88
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
89 " delete a word does not change register one, does change "-
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
90 call setline(1, "two")
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
91 normal de
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
92 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
93 call assert_equal("two", @-)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
94
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
95 " delete a word with a register does not change register one
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
96 call setline(1, "three")
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
97 normal "ade
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
98 call assert_equal("three", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
99 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
100
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
101 " delete a word with register DOES change register one with one of a list of
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
102 " operators
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
103 " %
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
104 call setline(1, ["(12)3"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
105 normal "ad%
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
106 call assert_equal("(12)", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
107 call assert_equal("(12)", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
108
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
109 " (
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
110 call setline(1, ["first second"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
111 normal $"ad(
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
112 call assert_equal("first secon", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
113 call assert_equal("first secon", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
114
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
115 " )
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
116 call setline(1, ["First Second."])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
117 normal gg0"ad)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
118 call assert_equal("First Second.", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
119 call assert_equal("First Second.", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
120
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
121 " `
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
122 call setline(1, ["start here."])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
123 normal gg0fhmx0"ad`x
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
124 call assert_equal("start ", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
125 call assert_equal("start ", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
126
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
127 " /
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
128 call setline(1, ["searchX"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
129 exe "normal gg0\"ad/X\<CR>"
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
130 call assert_equal("search", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
131 call assert_equal("search", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
132
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
133 " ?
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
134 call setline(1, ["Ysearch"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
135 exe "normal gg$\"ad?Y\<CR>"
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
136 call assert_equal("Ysearc", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
137 call assert_equal("Ysearc", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
138
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
139 " n
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
140 call setline(1, ["Ynext"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
141 normal gg$"adn
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
142 call assert_equal("Ynex", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
143 call assert_equal("Ynex", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
144
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
145 " N
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
146 call setline(1, ["prevY"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
147 normal gg0"adN
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
148 call assert_equal("prev", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
149 call assert_equal("prev", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
150
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
151 " }
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
152 call setline(1, ["one", ""])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
153 normal gg0"ad}
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
154 call assert_equal("one\n", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
155 call assert_equal("one\n", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
156
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
157 " {
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
158 call setline(1, ["", "two"])
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
159 normal 2G$"ad{
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
160 call assert_equal("\ntw", @a)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
161 call assert_equal("\ntw", @1)
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
162
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
163 bwipe!
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
164 endfunc
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
165
21246
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
166 func Test_recording_status_in_ex_line()
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
167 norm qx
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
168 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
169 call assert_equal('recording @x', Screenline(&lines))
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
170 set shortmess=q
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
171 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
172 call assert_equal('recording', Screenline(&lines))
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
173 set shortmess&
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
174 norm q
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
175 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
176 call assert_equal('', Screenline(&lines))
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
177 endfunc
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
178
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
179 " Check that replaying a typed sequence does not use an Esc and following
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
180 " characters as an escape sequence.
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
181 func Test_recording_esc_sequence()
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
182 new
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
183 try
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
184 let save_F2 = &t_F2
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
185 catch
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
186 endtry
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
187 let t_F2 = "\<Esc>OQ"
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
188 call feedkeys("qqiTest\<Esc>", "xt")
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
189 call feedkeys("OQuirk\<Esc>q", "xt")
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
190 call feedkeys("Go\<Esc>@q", "xt")
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
191 call assert_equal(['Quirk', 'Test', 'Quirk', 'Test'], getline(1, 4))
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
192 bwipe!
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
193 if exists('save_F2')
16784
62d84ef82f96 patch 8.1.1394: not restoring t_F2 in registers test
Bram Moolenaar <Bram@vim.org>
parents: 16376
diff changeset
194 let &t_F2 = save_F2
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15999
diff changeset
195 else
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15999
diff changeset
196 set t_F2=
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
197 endif
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
198 endfunc
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
199
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
200 " Test for executing the last used register (@)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
201 func Test_last_used_exec_reg()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
202 " Test for the @: command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
203 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
204 call feedkeys(":let a ..= 'Vim'\<CR>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
205 normal @:
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
206 call assert_equal('VimVim', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
207
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
208 " Test for the @= command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
209 let x = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
210 let a = ":let x ..= 'Vim'\<CR>"
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
211 exe "normal @=a\<CR>"
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
212 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
213 call assert_equal('VimVim', x)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
214
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
215 " Test for the @. command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
216 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
217 call feedkeys("i:let a ..= 'Edit'\<CR>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
218 normal @.
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
219 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
220 call assert_equal('EditEdit', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
221
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
222 " Test for repeating the last command-line in visual mode
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
223 call append(0, 'register')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
224 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
225 let @r = ''
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
226 call feedkeys("v:yank R\<CR>", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
227 call feedkeys("v@:", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
228 call assert_equal("\nregister\nregister\n", @r)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
229
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
230 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
231 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
232
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
233 func Test_get_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
234 enew
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
235 edit Xfile1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
236 edit Xfile2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
237 call assert_equal('Xfile2', getreg('%'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
238 call assert_equal('Xfile1', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
239
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
240 call feedkeys("iTwo\<Esc>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
241 call assert_equal('Two', getreg('.'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
242 call assert_equal('', getreg('_'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
243 call assert_beeps('normal ":yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
244 call assert_beeps('normal "%yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
245 call assert_beeps('normal ".yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
246
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
247 call assert_equal('', getreg("\<C-F>"))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
248 call assert_equal('', getreg("\<C-W>"))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
249 call assert_equal('', getreg("\<C-L>"))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
250 " Change the last used register to '"' for the next test
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
251 normal! ""yy
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
252 let @" = 'happy'
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
253 call assert_equal('happy', getreg())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
254 call assert_equal('happy', getreg(''))
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
255
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
256 call assert_equal('', getregtype('!'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
257 call assert_fails('echo getregtype([])', 'E730:')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
258 call assert_equal('v', getregtype())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
259 call assert_equal('v', getregtype(''))
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
260
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
261 " Test for inserting an invalid register content
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
262 call assert_beeps('exe "normal i\<C-R>!"')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
263
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
264 " Test for inserting a register with multiple lines
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
265 call deletebufline('', 1, '$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
266 call setreg('r', ['a', 'b'])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
267 exe "normal i\<C-R>r"
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
268 call assert_equal(['a', 'b', ''], getline(1, '$'))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
269
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
270 " Test for inserting a multi-line register in the command line
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
271 call feedkeys(":\<C-R>r\<Esc>", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
272 call assert_equal("a\rb\r", histget(':', -1))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
273
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
274 call assert_fails('let r = getreg("=", [])', 'E745:')
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
275 call assert_fails('let r = getreg("=", 1, [])', 'E745:')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
276 enew!
22502
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
277
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
278 " Using a register in operator-pending mode should fail
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22476
diff changeset
279 call assert_beeps('norm! c"')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
280 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
281
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
282 func Test_set_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
283 call assert_fails("call setreg('#', 200)", 'E86:')
24695
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
284 call assert_fails("call setreg('a', test_unknown())", 'E908:')
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
285
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
286 edit Xfile_alt_1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
287 let b1 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
288 edit Xfile_alt_2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
289 let b2 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
290 edit Xfile_alt_3
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
291 let b3 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
292 call setreg('#', 'alt_1')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
293 call assert_equal('Xfile_alt_1', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
294 call setreg('#', b2)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
295 call assert_equal('Xfile_alt_2', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
296
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
297 let ab = 'regwrite'
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
298 call setreg('=', '')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
299 call setreg('=', 'a', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
300 call setreg('=', 'b', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
301 call assert_equal('regwrite', getreg('='))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
302
19195
2ef19eed524a patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
303 " Test for setting a list of lines to special registers
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
304 call setreg('/', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
305 call assert_equal('', @/)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
306 call setreg('=', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
307 call assert_equal('', @=)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
308 call assert_fails("call setreg('/', ['a', 'b'])", 'E883:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
309 call assert_fails("call setreg('=', ['a', 'b'])", 'E883:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
310 call assert_equal(0, setreg('_', ['a', 'b']))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
311
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
312 " Test for recording to a invalid register
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
313 call assert_beeps('normal q$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
314
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
315 " Appending to a register when recording
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
316 call append(0, "text for clipboard test")
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
317 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
318 call feedkeys('qrllq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
319 call feedkeys('qRhhq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
320 call assert_equal('llhh', getreg('r'))
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
321
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
322 " Appending a list of characters to a register from different lines
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
323 let @r = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
324 call append(0, ['abcdef', '123456'])
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
325 normal gg"ry3l
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
326 call cursor(2, 4)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
327 normal "Ry3l
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
328 call assert_equal('abc456', @r)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
329
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
330 " Test for gP with multiple lines selected using characterwise motion
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
331 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
332 call append(0, ['vim editor', 'vim editor'])
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
333 let @r = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
334 exe "normal ggwy/vim /e\<CR>gP"
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
335 call assert_equal(['vim editor', 'vim editor', 'vim editor'], getline(1, 3))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
336
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
337 " Test for gP with . register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
338 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
339 normal iabc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
340 normal ".gp
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
341 call assert_equal('abcabc', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
342 normal 0".gP
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
343 call assert_equal('abcabcabc', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
344
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
345 let @"=''
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
346 call setreg('', '1')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
347 call assert_equal('1', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
348 call setreg('@', '2')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
349 call assert_equal('2', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
350
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
351 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
352 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
353
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
354 " Test for clipboard registers (* and +)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
355 func Test_clipboard_regs()
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
356 CheckNotGui
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
357 CheckFeature clipboard_working
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
358
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
359 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
360 call append(0, "text for clipboard test")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
361 normal gg"*yiw
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
362 call assert_equal('text', getreg('*'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
363 normal gg2w"+yiw
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
364 call assert_equal('clipboard', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
365
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
366 " Test for replacing the clipboard register contents
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
367 set clipboard=unnamed
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
368 let @* = 'food'
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
369 normal ggviw"*p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
370 call assert_equal('text', getreg('*'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
371 call assert_equal('food for clipboard test', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
372 normal ggviw"*p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
373 call assert_equal('food', getreg('*'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
374 call assert_equal('text for clipboard test', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
375
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
376 " Test for replacing the selection register contents
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
377 set clipboard=unnamedplus
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
378 let @+ = 'food'
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
379 normal ggviw"+p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
380 call assert_equal('text', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
381 call assert_equal('food for clipboard test', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
382 normal ggviw"+p
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
383 call assert_equal('food', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
384 call assert_equal('text for clipboard test', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
385
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
386 " Test for auto copying visually selected text to clipboard register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
387 call setline(1, "text for clipboard test")
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
388 let @* = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
389 set clipboard=autoselect
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
390 normal ggwwviwy
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
391 call assert_equal('clipboard', @*)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
392
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
393 " Test for auto copying visually selected text to selection register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
394 let @+ = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
395 set clipboard=autoselectplus
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
396 normal ggwviwy
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
397 call assert_equal('for', @+)
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
398
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
399 set clipboard&vim
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
400 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
401 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
402
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
403 " Test for restarting the current mode (insert or virtual replace) after
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
404 " executing the contents of a register
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
405 func Test_put_reg_restart_mode()
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
406 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
407 call append(0, 'editor')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
408 normal gg
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
409 let @r = "ivim \<Esc>"
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
410 call feedkeys("i\<C-O>@r\<C-R>=mode()\<CR>", 'xt')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
411 call assert_equal('vimi editor', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
412
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
413 call setline(1, 'editor')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
414 normal gg
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
415 call feedkeys("gR\<C-O>@r\<C-R>=mode()\<CR>", 'xt')
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
416 call assert_equal('vimReditor', getline(1))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
417
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
418 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
419 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
420
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
421 " Test for executing a register using :@ command
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
422 func Test_execute_register()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
423 call setreg('r', [])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
424 call assert_beeps('@r')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
425 let i = 1
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
426 let @q = 'let i+= 1'
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
427 @q
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
428 @
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
429 call assert_equal(3, i)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
430
22476
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
431 " try to execute expression register and use a backspace to cancel it
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
432 new
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
433 call feedkeys("@=\<BS>ax\<CR>y", 'xt')
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
434 call assert_equal(['x', 'y'], getline(1, '$'))
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
435 close!
b3751f4d3b26 patch 8.2.1786: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
436
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
437 " cannot execute a register in operator pending mode
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
438 call assert_beeps('normal! c@r')
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
439 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
440
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
441 " Test for getting register info
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
442 func Test_get_reginfo()
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
443 enew
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
444 call setline(1, ['foo', 'bar'])
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
445
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
446 exe 'norm! "zyy'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
447 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
448 call assert_equal('z', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
449 call setreg('y', 'baz')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
450 call assert_equal('z', getreginfo('').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
451 call setreg('y', { 'isunnamed': v:true })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
452 call assert_equal('y', getreginfo('"').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
453
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
454 exe '$put'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
455 call assert_equal(getreg('y'), getline(3))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
456 call setreg('', 'qux')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
457 call assert_equal('0', getreginfo('').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
458 call setreg('x', 'quux')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
459 call assert_equal('0', getreginfo('').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
460
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
461 let info = getreginfo('')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
462 call assert_equal(getreg('', 1, 1), info.regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
463 call assert_equal(getregtype(''), info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
464
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
465 exe "norm! 0\<c-v>e" .. '"zy'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
466 let info = getreginfo('z')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
467 call assert_equal(getreg('z', 1, 1), info.regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
468 call assert_equal(getregtype('z'), info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
469 call assert_equal(1, +info.isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
470
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
471 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
472 call assert_equal('z', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
473
24695
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
474 let @a="a1b2"
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
475 nnoremap <F2> <Cmd>let g:RegInfo = getreginfo()<CR>
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
476 exe "normal \"a\<F2>"
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
477 call assert_equal({'regcontents': ['a1b2'], 'isunnamed': v:false,
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
478 \ 'regtype': 'v'}, g:RegInfo)
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
479 nunmap <F2>
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
480 unlet g:RegInfo
13efbfc53054 patch 8.2.2886: various pieces of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
481
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
482 bwipe!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
483 endfunc
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
484
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
485 " Test for restoring register with dict from getreginfo
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
486 func Test_set_register_dict()
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
487 enew!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
488
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
489 call setreg('"', #{ regcontents: ['one', 'two'],
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
490 \ regtype: 'V', points_to: 'z' })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
491 call assert_equal(['one', 'two'], getreg('"', 1, 1))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
492 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
493 call assert_equal('z', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
494 call assert_equal('V', info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
495 call assert_equal(1, +getreginfo('z').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
496
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
497 call setreg('x', #{ regcontents: ['three', 'four'],
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
498 \ regtype: 'v', isunnamed: v:true })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
499 call assert_equal(['three', 'four'], getreg('"', 1, 1))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
500 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
501 call assert_equal('x', info.points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
502 call assert_equal('v', info.regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
503 call assert_equal(1, +getreginfo('x').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
504
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
505 call setreg('y', #{ regcontents: 'five',
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
506 \ regtype: "\<c-v>", isunnamed: v:false })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
507 call assert_equal("\<c-v>4", getreginfo('y').regtype)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
508 call assert_equal(0, +getreginfo('y').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
509 call assert_equal(['three', 'four'], getreg('"', 1, 1))
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
510 call assert_equal('x', getreginfo('"').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
511
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
512 call setreg('"', #{ regcontents: 'six' })
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
513 call assert_equal('0', getreginfo('"').points_to)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
514 call assert_equal(1, +getreginfo('0').isunnamed)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
515 call assert_equal(['six'], getreginfo('0').regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
516 call assert_equal(['six'], getreginfo('"').regcontents)
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
517
20968
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
518 let @x = 'one'
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
519 call setreg('x', {})
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
520 call assert_equal(1, len(split(execute('reg x'), '\n')))
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
521
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
522 call assert_fails("call setreg('0', #{regtype: 'V'}, 'v')", 'E118:')
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
523 call assert_fails("call setreg('0', #{regtype: 'X'})", 'E475:')
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
524 call assert_fails("call setreg('0', #{regtype: 'vy'})", 'E475:')
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
525
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
526 bwipe!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
527 endfunc
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
528
20754
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
529 func Test_v_register()
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
530 enew
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
531 call setline(1, 'nothing')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
532
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
533 func s:Put()
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
534 let s:register = v:register
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
535 exec 'normal! "' .. v:register .. 'P'
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
536 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
537 nnoremap <buffer> <plug>(test) :<c-u>call s:Put()<cr>
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
538 nmap <buffer> S <plug>(test)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
539
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
540 let @z = "testz\n"
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
541 let @" = "test@\n"
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
542
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
543 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
544 call feedkeys('"_ddS', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
545 call assert_equal('test@', getline('.')) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
546 call assert_equal('"', s:register) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
547
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
548 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
549 call feedkeys('"zS', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
550 call assert_equal('z', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
551
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
552 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
553 call feedkeys('"zSS', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
554 call assert_equal('"', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
555
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
556 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
557 call feedkeys('"_S', 'mx')
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
558 call assert_equal('_', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
559
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
560 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
561 normal "_ddS
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
562 call assert_equal('"', s:register) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
563 call assert_equal('test@', getline('.')) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
564
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
565 let s:register = ''
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
566 execute 'normal "z:call' "s:Put()\n"
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
567 call assert_equal('z', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
568 call assert_equal('testz', getline('.'))
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
569
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
570 " Test operator and omap
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
571 let @b = 'testb'
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
572 func s:OpFunc(...)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
573 let s:register2 = v:register
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
574 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
575 set opfunc=s:OpFunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
576
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
577 normal "bg@l
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
578 normal S
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
579 call assert_equal('"', s:register) " fails before 8.2.0929
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
580 call assert_equal('b', s:register2)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
581
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
582 func s:Motion()
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
583 let s:register1 = v:register
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
584 normal! l
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
585 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
586 onoremap <buffer> Q :<c-u>call s:Motion()<cr>
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
587
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
588 normal "bg@Q
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
589 normal S
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
590 call assert_equal('"', s:register)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
591 call assert_equal('b', s:register1)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
592 call assert_equal('"', s:register2)
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
593
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
594 set opfunc&
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
595 bwipe!
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
596 endfunc
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
597
20891
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
598 " Test for executing the contents of a register as an Ex command with line
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
599 " continuation.
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
600 func Test_execute_reg_as_ex_cmd()
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
601 " Line continuation with just two lines
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
602 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
603 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
604 \ 1]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
605 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
606 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
607 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
608 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
609 call assert_equal([1], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
610
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
611 " Line continuation with more than two lines
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
612 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
613 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
614 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
615 \ 2,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
616 \ 3]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
617 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
618 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
619 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
620 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
621 call assert_equal([1, 2, 3], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
622
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
623 " use comments interspersed with code
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
624 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
625 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
626 "\ one
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
627 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
628 "\ two
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
629 \ 2,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
630 "\ three
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
631 \ 3]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
632 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
633 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
634 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
635 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
636 call assert_equal([1, 2, 3], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
637
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
638 " use line continuation in the middle
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
639 let code =<< trim END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
640 let a = "one"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
641 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
642 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
643 \ 2]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
644 let b = "two"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
645 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
646 let @r = code->join("\n")
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
647 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
648 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
649 call assert_equal([1, 2], l)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
650 call assert_equal("one", a)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
651 call assert_equal("two", b)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
652
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
653 " only one line with a \
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
654 let @r = "\\let l = 1"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
655 call assert_fails('@r', 'E10:')
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
656
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
657 " only one line with a "\
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
658 let @r = ' "\ let i = 1'
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
659 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
660 call assert_false(exists('i'))
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
661
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
662 " first line also begins with a \
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
663 let @r = "\\let l = [\n\\ 1]"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
664 call assert_fails('@r', 'E10:')
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
665
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
666 " Test with a large number of lines
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
667 let @r = "let str = \n"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
668 let @r ..= repeat(" \\ 'abcdefghijklmnopqrstuvwxyz' ..\n", 312)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
669 let @r ..= ' \ ""'
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
670 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
671 call assert_equal(repeat('abcdefghijklmnopqrstuvwxyz', 312), str)
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
672 endfunc
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
673
20976
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
674 " Test for clipboard registers with ASCII NUL
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
675 func Test_clipboard_nul()
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
676 CheckFeature clipboard_working
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
677 new
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
678
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
679 " Test for putting ASCII NUL into the clipboard
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
680 set clipboard=unnamed
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
681 call append(0, "\ntest")
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
682 normal ggyyp
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
683 call assert_equal("^@test^@", strtrans(getreg('*')))
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
684 call assert_equal(getline(1), getline(2))
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
685 let b = split(execute(":reg *"), "\n")
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
686 call assert_match('"\*\s*\^@test\^J',b[1])
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
687
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
688 set clipboard&vim
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
689 bwipe!
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
690 endfunc
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
691
21238
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
692 func Test_ve_blockpaste()
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
693 new
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
694 set ve=all
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
695 0put =['QWERTZ','ASDFGH']
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
696 call cursor(1,1)
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
697 exe ":norm! \<C-V>3ljdP"
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
698 call assert_equal(1, col('.'))
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
699 call assert_equal(getline(1, 2), ['QWERTZ', 'ASDFGH'])
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
700 call cursor(1,1)
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
701 exe ":norm! \<C-V>3ljd"
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
702 call cursor(1,1)
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
703 norm! $3lP
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
704 call assert_equal(5, col('.'))
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
705 call assert_equal(getline(1, 2), ['TZ QWER', 'GH ASDF'])
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
706 set ve&vim
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
707 bwipe!
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
708 endfunc
136b33ce8216 patch 8.2.1170: cursor off by one with block paste while 'virtualedit' "all"
Bram Moolenaar <Bram@vim.org>
parents: 20976
diff changeset
709
23287
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
710 func Test_insert_small_delete()
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
711 new
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
712 call setline(1, ['foo foobar bar'])
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
713 call cursor(1,1)
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
714 exe ":norm! ciw'\<C-R>-'"
23303
9af15022894c patch 8.2.2197: assert arguments order reversed
Bram Moolenaar <Bram@vim.org>
parents: 23287
diff changeset
715 call assert_equal("'foo' foobar bar", getline(1))
23287
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
716 exe ":norm! w.w."
23303
9af15022894c patch 8.2.2197: assert arguments order reversed
Bram Moolenaar <Bram@vim.org>
parents: 23287
diff changeset
717 call assert_equal("'foo' 'foobar' 'bar'", getline(1))
23287
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
718 bwipe!
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
719 endfunc
f2a70fca3485 patch 8.2.2189: cannot repeat a command that uses the small delete register
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
720
24134
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
721 " Record in insert mode using CTRL-O
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
722 func Test_record_in_insert_mode()
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
723 new
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
724 let @r = ''
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
725 call setline(1, ['foo'])
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
726 call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
727 call assert_equal('baz', @r)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
728 bwipe!
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
729 endfunc
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23303
diff changeset
730
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
731 " vim: shiftwidth=2 sts=2 expandtab