annotate src/testdir/test_registers.vim @ 19783:546bdeef35f1 v8.2.0448

patch 8.2.0448: various functions not properly tested Commit: https://github.com/vim/vim/commit/0e05de46226eb4e5ea580beefa71831f92d613d3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 25 22:23:46 2020 +0100 patch 8.2.0448: various functions not properly tested Problem: Various functions not properly tested. Solution: Add more tests, especially for failures. (Yegappan Lakshmanan, closes #5843)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Mar 2020 22:30:04 +0100
parents f70a3c1000bb
children 2fb397573541
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
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
6
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
7 " 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
8 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
9 call assert_fails('normal @@', 'E748:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
10 call assert_fails('normal @%', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
11 call assert_fails('normal @#', 'E354:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
12 call assert_fails('normal @!', '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 @:', 'E30:')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
14 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
15 call assert_fails('put /', 'E35:')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
16 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
17 endfunc
11682
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 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
20 enew
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 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
22 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
23 " Line-wise
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 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
25 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
26 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
27 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
28 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
29 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
30 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
31 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
32
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " Block-wise
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 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
35 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
36 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
37 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
38 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
39 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
40 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
41 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
42
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 bwipe!
b9928ef8632f patch 8.0.0724: the message for yanking doesn't indicate the register
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 endfunc
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
45
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
46 func Test_display_registers()
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
47 e file1
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
48 e file2
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
49 call setline(1, ['foo', 'bar'])
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
50 /bar
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
51 exe 'norm! y2l"axx'
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
52 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
53 call feedkeys(":ls\n", 'xt')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
54
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
55 let a = execute('display')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
56 let b = execute('registers')
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
57
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
58 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
59 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
60 \ . ' 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
61 \ . ' 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
62 \ . ' c "a b\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
63 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
64 \ . ' c "- a\n'
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
65 \ . '.*'
18436
6ec1bfb4690b patch 8.1.2212: cannot see the selection type in :reg output
Bram Moolenaar <Bram@vim.org>
parents: 16784
diff changeset
66 \ . ' 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
67 \ . ' 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
68 \ . ' 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
69 \ . ' 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
70 \ . ' c "= 2\*4', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
71
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
72 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
73 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
74 \ . ' c "a b', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
75
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
76 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
77 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
78 \ . ' c ": ls', a)
13855
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
79
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
80 bwipe!
536874138ecd patch 8.0.1799: no test for :registers command
Christian Brabandt <cb@256bit.org>
parents: 11682
diff changeset
81 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
82
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
83 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
84 " 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
85 new
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
86 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
87 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
88 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
89
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
90 " 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
91 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
92 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
93 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
94 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
95
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
96 " 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
97 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
98 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
99 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
100 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
101
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
102 " 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
103 " operators
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
104 " %
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
105 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
106 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
107 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
108 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
109
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
110 " (
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
111 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
112 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
113 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
114 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
115
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
116 " )
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
117 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
118 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
119 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
120 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
121
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
122 " `
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
123 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
124 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
125 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
126 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
127
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
128 " /
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
129 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
130 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
131 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
132 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
133
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
134 " ?
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
135 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
136 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
137 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
138 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
139
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
140 " n
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
141 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
142 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
143 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
144 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
145
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
146 " N
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
147 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
148 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
149 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
150 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
151
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
152 " }
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
153 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
154 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
155 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
156 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
157
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
158 " {
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
159 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
160 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
161 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
162 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
163
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
164 bwipe!
29de75f53b1a patch 8.1.0999: use register one too often and not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 13855
diff changeset
165 endfunc
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
166
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
167 " 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
168 " 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
169 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
170 new
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
171 try
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
172 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
173 catch
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
174 endtry
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
175 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
176 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
177 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
178 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
179 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
180 bwipe!
15999
f4c282082ec8 patch 8.1.1005: test fails because t_F2 is not set
Bram Moolenaar <Bram@vim.org>
parents: 15995
diff changeset
181 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
182 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
183 else
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15999
diff changeset
184 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
185 endif
15995
e7030c0c79cd patch 8.1.1003: playing back recorded key sequence mistakes key code
Bram Moolenaar <Bram@vim.org>
parents: 15987
diff changeset
186 endfunc
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
187
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
188 " 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
189 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
190 " Test for the @: command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
191 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
192 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
193 normal @:
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
194 call assert_equal('VimVim', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
195
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
196 " Test for the @= command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
197 let x = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
198 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
199 exe "normal @=a\<CR>"
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
200 normal @@
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
201 call assert_equal('VimVim', x)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
202
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
203 " Test for the @. command
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
204 let a = ''
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
205 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
206 normal @.
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('EditEdit', a)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
209
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
210 " 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
211 call append(0, 'register')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
212 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
213 let @r = ''
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
214 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
215 call feedkeys("v@:", 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
216 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
217
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
218 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
219 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
220
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
221 func Test_get_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
222 enew
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
223 edit Xfile1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
224 edit Xfile2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
225 call assert_equal('Xfile2', getreg('%'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
226 call assert_equal('Xfile1', getreg('#'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
227
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
228 call feedkeys("iTwo\<Esc>", 'xt')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
229 call assert_equal('Two', getreg('.'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
230 call assert_equal('', getreg('_'))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
231 call assert_beeps('normal ":yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
232 call assert_beeps('normal "%yy')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
233 call assert_beeps('normal ".yy')
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 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
236 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
237 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
238 " 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
239 normal! ""yy
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
240 let @" = 'happy'
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
241 call assert_equal('happy', getreg())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
242 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
243
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
244 call assert_equal('', getregtype('!'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
245 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
246 call assert_equal('v', getregtype())
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
247 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
248
18771
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
249 " 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
250 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
251
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
252 " 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
253 call deletebufline('', 1, '$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
254 call setreg('r', ['a', 'b'])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
255 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
256 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
257
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
258 " 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
259 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
260 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
261
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
262 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
263 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
264
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
265 func Test_set_register()
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
266 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
267
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
268 edit Xfile_alt_1
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
269 let b1 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
270 edit Xfile_alt_2
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
271 let b2 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
272 edit Xfile_alt_3
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
273 let b3 = bufnr('')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
274 call setreg('#', 'alt_1')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
275 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
276 call setreg('#', b2)
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
277 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
278
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
279 let ab = 'regwrite'
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
280 call setreg('=', '')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
281 call setreg('=', 'a', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
282 call setreg('=', 'b', 'a')
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
283 call assert_equal('regwrite', getreg('='))
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
284
19195
2ef19eed524a patch 8.2.0156: various typos in source files and tests
Bram Moolenaar <Bram@vim.org>
parents: 18784
diff changeset
285 " 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
286 call setreg('/', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
287 call assert_equal('', @/)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
288 call setreg('=', [])
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
289 call assert_equal('', @=)
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
290 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
291 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
292 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
293
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
294 " 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
295 call assert_beeps('normal q$')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
296
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
297 " 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
298 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
299 normal gg
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
300 call feedkeys('qrllq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
301 call feedkeys('qRhhq', 'xt')
50fde4e20790 patch 8.1.2375: no suffucient testing for registers
Bram Moolenaar <Bram@vim.org>
parents: 18755
diff changeset
302 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
303
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
304 " 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
305 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
306 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
307 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
308 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
309 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
310 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
311
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
312 " 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
313 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
314 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
315 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
316 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
317 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
318
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
319 " 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
320 %delete
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
321 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
322 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
323 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
324 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
325 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
326
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
327 let @"=''
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
328 call setreg('', '1')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
329 call assert_equal('1', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
330 call setreg('@', '2')
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
331 call assert_equal('2', @")
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
332
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
333 enew!
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
334 endfunc
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
335
18784
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
336 " 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
337 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
338 CheckNotGui
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
339 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
340
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
341 new
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
342 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
343 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
344 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
345 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
346 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
347
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
348 " 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
349 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
350 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
351 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
352 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
353 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
354 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
355 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
356 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
357
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
358 " 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
359 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
360 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
361 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
362 call assert_equal('text', getreg('+'))
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
363 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
364 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
365 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
366 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
367
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
368 " 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
369 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
370 let @* = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
371 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
372 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
373 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
374
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
375 " 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
376 let @+ = ''
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
377 set clipboard=autoselectplus
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
378 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
379 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
380
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
381 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
382 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
383 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
384
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
385 " 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
386 " 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
387 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
388 new
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 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
390 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
391 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
392 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
393 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
394
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 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
396 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
397 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
398 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
399
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
400 bwipe!
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
401 endfunc
7b57a80f70f6 patch 8.1.2381: not all register related code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18771
diff changeset
402
19425
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
403 " 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
404 func Test_execute_register()
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
405 call setreg('r', [])
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
406 call assert_beeps('@r')
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
407 let i = 1
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
408 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
409 @q
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
410 @
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
411 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
412
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19425
diff changeset
413 " 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
414 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
415 endfunc
67fbe280a502 patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19195
diff changeset
416
18755
a0be066d0b48 patch 8.1.2367: registers are not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 18436
diff changeset
417 " vim: shiftwidth=2 sts=2 expandtab