annotate src/testdir/test_registers.vim @ 21465:b5d4ab124782 v8.2.1283

patch 8.2.1283: Vim9: error for misplaced -> lacks argument Commit: https://github.com/vim/vim/commit/637cd7d1c9fa0ee47951ccdc310a388cb7ecfada Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 23 19:06:23 2020 +0200 patch 8.2.1283: Vim9: error for misplaced -> lacks argument Problem: Vim9: error for misplaced -> lacks argument. Solution: Use the pointer before it was advanced.
author Bram Moolenaar <Bram@vim.org>
date Thu, 23 Jul 2020 19:15:03 +0200
parents ce655819d9ec
children 08940efa6b4e
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 "
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
2 " Tests for register operations
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
3 "
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
4
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 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
6 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
7
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
8 " 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
9 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
10 call assert_fails('normal @@', 'E748:')
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 @#', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
13 call assert_fails('normal @!', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
14 call assert_fails('normal @:', 'E30:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
15 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
16 call assert_fails('put /', 'E35:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
17 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
18 endfunc
11682
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 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
21 enew
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 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
23 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
24 " Line-wise
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! yy'
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', 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! "zyy'
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('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
29 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
30 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
31 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
32 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
33
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 " Block-wise
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>y"
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', 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>\"zy"
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 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
39 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
40 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
41 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
42 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
43
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 bwipe!
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endfunc
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
46
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
47 func Test_display_registers()
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
48 e file1
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
49 e file2
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
50 call setline(1, ['foo', 'bar'])
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
51 /bar
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
52 exe 'norm! y2l"axx'
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
53 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
54 call feedkeys(":ls\n", 'xt')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
55
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
56 let a = execute('display')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
57 let b = execute('registers')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
58
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
59 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
60 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
61 \ . ' 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
62 \ . ' 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
63 \ . ' c "a b\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 "- a\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
66 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
67 \ . ' 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
68 \ . ' 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
69 \ . ' 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
70 \ . ' 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
71 \ . ' c "= 2\*4', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
72
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
73 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
74 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
75 \ . ' c "a b', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
76
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
77 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
78 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
79 \ . ' c ": ls', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
80
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
81 bwipe!
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
82 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
83
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
84 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
85 " 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
86 new
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 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
88 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
89 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
90
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
91 " 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
92 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
93 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
94 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
95 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
96
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
97 " 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
98 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
99 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
100 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
101 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
102
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
103 " 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
104 " operators
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
105 " %
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 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
107 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
108 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
109 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
110
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
111 " (
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 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
113 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
114 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
115 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
116
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
117 " )
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 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
119 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
120 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
121 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
122
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
123 " `
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 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
125 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
126 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
127 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
128
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
129 " /
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 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
131 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
132 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
133 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
134
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
135 " ?
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 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
137 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
138 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
139 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
140
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
141 " n
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 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
143 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
144 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
145 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
146
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
147 " N
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 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
149 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
150 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
151 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
152
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
153 " }
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 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
155 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
156 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
157 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
158
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
159 " {
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 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
161 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
162 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
163 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
164
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
165 bwipe!
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
166 endfunc
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
167
21246
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
168 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
169 norm qx
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
170 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
171 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
172 set shortmess=q
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
173 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
174 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
175 set shortmess&
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
176 norm q
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
177 redraw!
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
178 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
179 endfunc
ce655819d9ec patch 8.2.1174: no test for the "recording @x" message
Bram Moolenaar <Bram@vim.org>
parents: 21238
diff changeset
180
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
181 " 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
182 " 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
183 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
184 new
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
185 try
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
186 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
187 catch
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
188 endtry
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
189 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
190 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
191 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
192 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
193 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
194 bwipe!
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
195 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
196 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
197 else
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15999
diff changeset
198 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
199 endif
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
200 endfunc
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
201
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
202 " 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
203 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
204 " Test for the @: command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
205 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
206 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
207 normal @:
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
208 call assert_equal('VimVim', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
209
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
210 " Test for the @= command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
211 let x = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
212 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
213 exe "normal @=a\<CR>"
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
214 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
215 call assert_equal('VimVim', x)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
216
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
217 " Test for the @. command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
218 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
219 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
220 normal @.
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
221 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
222 call assert_equal('EditEdit', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
223
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
224 " 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
225 call append(0, 'register')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
226 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
227 let @r = ''
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
228 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
229 call feedkeys("v@:", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
230 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
231
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
232 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
233 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
234
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
235 func Test_get_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
236 enew
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
237 edit Xfile1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
238 edit Xfile2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
239 call assert_equal('Xfile2', getreg('%'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
240 call assert_equal('Xfile1', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
241
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
242 call feedkeys("iTwo\<Esc>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
243 call assert_equal('Two', getreg('.'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
244 call assert_equal('', getreg('_'))
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 call assert_beeps('normal "%yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
247 call assert_beeps('normal ".yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
248
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-F>"))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
250 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
251 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
252 " 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
253 normal! ""yy
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
254 let @" = 'happy'
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
255 call assert_equal('happy', getreg())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
256 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
257
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
258 call assert_equal('', getregtype('!'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
259 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
260 call assert_equal('v', getregtype())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
261 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
262
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
263 " 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
264 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
265
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
266 " 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
267 call deletebufline('', 1, '$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
268 call setreg('r', ['a', 'b'])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
269 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
270 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
271
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
272 " 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
273 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
274 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
275
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
276 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
277 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
278 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
279 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
280
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
281 func Test_set_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
282 call assert_fails("call setreg('#', 200)", 'E86:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
283
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
284 edit Xfile_alt_1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
285 let b1 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
286 edit Xfile_alt_2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
287 let b2 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
288 edit Xfile_alt_3
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
289 let b3 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
290 call setreg('#', 'alt_1')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
291 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
292 call setreg('#', b2)
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_2', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
294
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
295 let ab = 'regwrite'
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
296 call setreg('=', '')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
297 call setreg('=', 'a', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
298 call setreg('=', 'b', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
299 call assert_equal('regwrite', getreg('='))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
300
19195
2ef19eed524a patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
301 " 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
302 call setreg('/', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
303 call assert_equal('', @/)
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 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
307 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
308 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
309
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
310 " 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
311 call assert_beeps('normal q$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
312
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
313 " 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
314 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
315 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
316 call feedkeys('qrllq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
317 call feedkeys('qRhhq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
318 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
319
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
320 " 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
321 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
322 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
323 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
324 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
325 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
326 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
327
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
328 " 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
329 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
330 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
331 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
332 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
333 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
334
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
335 " 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
336 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
337 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
338 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
339 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
340 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
341 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
342
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
343 let @"=''
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
344 call setreg('', '1')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
345 call assert_equal('1', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
346 call setreg('@', '2')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
347 call assert_equal('2', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
348
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
349 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
350 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
351
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
352 " 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
353 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
354 CheckNotGui
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
355 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
356
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
357 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
358 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
359 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
360 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
361 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
362 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
363
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
364 " 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
365 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
374 " 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
375 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
376 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
377 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
378 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
379 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
380 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
381 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
382 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
383
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
384 " 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
385 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
386 let @* = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
387 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
388 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
389 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
390
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
391 " 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
392 let @+ = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
393 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
394 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
395 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
396
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
397 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
398 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
399 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
400
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
401 " 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
402 " 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
403 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
404 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
405 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
406 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
407 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
408 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
409 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
410
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 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
412 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
413 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
414 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
415
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
416 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
417 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
418
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
419 " 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
420 func Test_execute_register()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
421 call setreg('r', [])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
422 call assert_beeps('@r')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
423 let i = 1
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
424 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
425 @q
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
426 @
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
427 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
428
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
429 " 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
430 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
431 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
432
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
433 " 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
434 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
435 enew
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
436 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
437
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
438 exe 'norm! "zyy'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
439 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
440 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
441 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
442 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
443 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
444 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
445
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
446 exe '$put'
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
447 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
448 call setreg('', 'qux')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
449 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
450 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
451 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
452
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
453 let info = getreginfo('')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
454 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
455 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
456
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
457 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
458 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
459 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
460 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
461 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
462
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
463 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
464 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
465
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
466 bwipe!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
467 endfunc
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
468
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
469 " 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
470 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
471 enew!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
472
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
473 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
474 \ 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
475 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
476 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
477 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
478 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
479 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
480
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
481 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
482 \ 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
483 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
484 let info = getreginfo('"')
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
485 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
486 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
487 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
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('y', #{ regcontents: 'five',
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
490 \ 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
491 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
492 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
493 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
494 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
495
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
496 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
497 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
498 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
499 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
500 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
501
20968
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
502 let @x = 'one'
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
503 call setreg('x', {})
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
504 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
505
1c36b96522ae patch 8.2.1035: setreg() does not always clear the register
Bram Moolenaar <Bram@vim.org>
parents: 20891
diff changeset
506 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
507 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
508 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
509
20743
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
510 bwipe!
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
511 endfunc
a672feb8fc4f patch 8.2.0924: cannot save and restore a register properly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
512
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
513 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
514 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
515 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
516
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
517 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
518 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
519 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
520 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
521 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
522 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
523
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
524 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
525 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
526
e6a5a5ef4034 patch 8.2.0929: v:register is not cleared after an operator was executed
Bram Moolenaar <Bram@vim.org>
parents: 20743
diff changeset
527 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
528 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
529 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
530 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
531
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 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
533 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
534 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
535
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 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
537 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
538 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
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 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
541 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
542 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
543
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 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
545 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
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 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
548
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 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
550 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
551 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
552 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
553
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 " 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
555 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
556 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
557 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
558 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
559 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
560
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 "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
562 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
563 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
564 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
565
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 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
567 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
568 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
569 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
570 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
571
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 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
573 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
574 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
575 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
576 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
577
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 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
579 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
580 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
581
20891
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
582 " 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
583 " continuation.
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
584 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
585 " 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
586 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
587 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
588 \ 1]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
589 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
590 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
591 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
592 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
593 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
594
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
595 " 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
596 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
597 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
598 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
599 \ 2,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
600 \ 3]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
601 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
602 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
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 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
605 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
606
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
607 " 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
608 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
609 let l = [
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
610 "\ one
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
611 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
612 "\ two
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
613 \ 2,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
614 "\ three
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
615 \ 3]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
616 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
617 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
618 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
619 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
620 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
621
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
622 " 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
623 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
624 let a = "one"
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 \ 1,
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
627 \ 2]
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
628 let b = "two"
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
629 END
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
630 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
631 let l = []
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
632 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
633 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
634 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
635 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
636
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
637 " 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
638 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
639 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
640
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
641 " 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
642 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
643 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
644 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
645
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
646 " 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
647 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
648 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
649
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
650 " 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
651 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
652 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
653 let @r ..= ' \ ""'
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
654 @r
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
655 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
656 endfunc
4bdc07beeadb patch 8.2.0997: cannot execute a register containing line continuation
Bram Moolenaar <Bram@vim.org>
parents: 20754
diff changeset
657
20976
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
658 " 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
659 func Test_clipboard_nul()
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
660 CheckFeature clipboard_working
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
661 new
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
662
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
663 " 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
664 set clipboard=unnamed
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
665 call append(0, "\ntest")
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
666 normal ggyyp
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
667 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
668 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
669 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
670 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
671
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
672 set clipboard&vim
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
673 bwipe!
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
674 endfunc
599b29b6e540 patch 8.2.1039: cannot put NUL byte on clipboard
Bram Moolenaar <Bram@vim.org>
parents: 20968
diff changeset
675
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
676 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
677 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
678 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
679 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
680 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
681 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
682 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
683 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
684 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
685 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
686 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
687 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
688 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
689 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
690 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
691 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
692 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
693
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
694 " vim: shiftwidth=2 sts=2 expandtab