Mercurial > vim
comparison src/testdir/test_registers.vim @ 15987:29de75f53b1a v8.1.0999
patch 8.1.0999: use register one too often and not properly tested
commit https://github.com/vim/vim/commit/9d7fdd403a3a9ee0d008b6dcbcd2ecc9ec0f57b7
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 8 09:50:52 2019 +0100
patch 8.1.0999: use register one too often and not properly tested
Problem: Use register one too often and not properly tested.
Solution: Do not always use register one when specifying a register.
(closes #4085) Add more tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 08 Mar 2019 10:00:07 +0100 |
parents | 536874138ecd |
children | e7030c0c79cd |
comparison
equal
deleted
inserted
replaced
15986:77b7032bb373 | 15987:29de75f53b1a |
---|---|
40 | 40 |
41 call assert_equal(a, b) | 41 call assert_equal(a, b) |
42 call assert_match('^\n--- Registers ---\n' | 42 call assert_match('^\n--- Registers ---\n' |
43 \ . '"" a\n' | 43 \ . '"" a\n' |
44 \ . '"0 ba\n' | 44 \ . '"0 ba\n' |
45 \ . '"1 b\n' | |
46 \ . '"a b\n' | 45 \ . '"a b\n' |
47 \ . '.*' | 46 \ . '.*' |
48 \ . '"- a\n' | 47 \ . '"- a\n' |
49 \ . '.*' | 48 \ . '.*' |
50 \ . '": ls\n' | 49 \ . '": ls\n' |
61 call assert_match('^\n--- Registers ---\n' | 60 call assert_match('^\n--- Registers ---\n' |
62 \ . '": ls', a) | 61 \ . '": ls', a) |
63 | 62 |
64 bwipe! | 63 bwipe! |
65 endfunc | 64 endfunc |
65 | |
66 func Test_register_one() | |
67 " delete a line goes into register one | |
68 new | |
69 call setline(1, "one") | |
70 normal dd | |
71 call assert_equal("one\n", @1) | |
72 | |
73 " delete a word does not change register one, does change "- | |
74 call setline(1, "two") | |
75 normal de | |
76 call assert_equal("one\n", @1) | |
77 call assert_equal("two", @-) | |
78 | |
79 " delete a word with a register does not change register one | |
80 call setline(1, "three") | |
81 normal "ade | |
82 call assert_equal("three", @a) | |
83 call assert_equal("one\n", @1) | |
84 | |
85 " delete a word with register DOES change register one with one of a list of | |
86 " operators | |
87 " % | |
88 call setline(1, ["(12)3"]) | |
89 normal "ad% | |
90 call assert_equal("(12)", @a) | |
91 call assert_equal("(12)", @1) | |
92 | |
93 " ( | |
94 call setline(1, ["first second"]) | |
95 normal $"ad( | |
96 call assert_equal("first secon", @a) | |
97 call assert_equal("first secon", @1) | |
98 | |
99 " ) | |
100 call setline(1, ["First Second."]) | |
101 normal gg0"ad) | |
102 call assert_equal("First Second.", @a) | |
103 call assert_equal("First Second.", @1) | |
104 | |
105 " ` | |
106 call setline(1, ["start here."]) | |
107 normal gg0fhmx0"ad`x | |
108 call assert_equal("start ", @a) | |
109 call assert_equal("start ", @1) | |
110 | |
111 " / | |
112 call setline(1, ["searchX"]) | |
113 exe "normal gg0\"ad/X\<CR>" | |
114 call assert_equal("search", @a) | |
115 call assert_equal("search", @1) | |
116 | |
117 " ? | |
118 call setline(1, ["Ysearch"]) | |
119 exe "normal gg$\"ad?Y\<CR>" | |
120 call assert_equal("Ysearc", @a) | |
121 call assert_equal("Ysearc", @1) | |
122 | |
123 " n | |
124 call setline(1, ["Ynext"]) | |
125 normal gg$"adn | |
126 call assert_equal("Ynex", @a) | |
127 call assert_equal("Ynex", @1) | |
128 | |
129 " N | |
130 call setline(1, ["prevY"]) | |
131 normal gg0"adN | |
132 call assert_equal("prev", @a) | |
133 call assert_equal("prev", @1) | |
134 | |
135 " } | |
136 call setline(1, ["one", ""]) | |
137 normal gg0"ad} | |
138 call assert_equal("one\n", @a) | |
139 call assert_equal("one\n", @1) | |
140 | |
141 " { | |
142 call setline(1, ["", "two"]) | |
143 normal 2G$"ad{ | |
144 call assert_equal("\ntw", @a) | |
145 call assert_equal("\ntw", @1) | |
146 | |
147 bwipe! | |
148 endfunc |