comparison src/testdir/test_paste.vim @ 24914:1186160ecf57 v8.2.2994

patch 8.2.2994: various code is not fully tested Commit: https://github.com/vim/vim/commit/2d6d718dde7163c971d37b8f4f1ed8f2d25de130 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Jun 13 21:52:48 2021 +0200 patch 8.2.2994: various code is not fully tested Problem: Various code is not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8378)
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jun 2021 22:00:04 +0200
parents 72e9b861bc92
children a5a772dace5b
comparison
equal deleted inserted replaced
24913:de12fb675362 24914:1186160ecf57
157 call feedkeys("iHello\<F4>", 'xt') 157 call feedkeys("iHello\<F4>", 'xt')
158 call assert_true(&paste) 158 call assert_true(&paste)
159 call feedkeys("i\<F4>", 'xt') 159 call feedkeys("i\<F4>", 'xt')
160 call assert_false(&paste) 160 call assert_false(&paste)
161 call assert_equal('Hello', getline(1)) 161 call assert_equal('Hello', getline(1))
162 " command-line completion for 'pastetoggle' value
163 call feedkeys(":set pastetoggle=\<Tab>\<C-B>\"\<CR>", 'xt')
164 call assert_equal('"set pastetoggle=<F4>', @:)
162 set pastetoggle& 165 set pastetoggle&
163 bwipe! 166 bwipe!
164 endfunc 167 endfunc
165 168
169 " Test for restoring option values when 'paste' is disabled
170 func Test_paste_opt_restore()
171 set autoindent expandtab ruler showmatch
172 if has('rightleft')
173 set revins hkmap
174 endif
175 set smarttab softtabstop=3 textwidth=27 wrapmargin=12
176 if has('vartabs')
177 set varsofttabstop=10,20
178 endif
179
180 " enabling 'paste' should reset the above options
181 set paste
182 call assert_false(&autoindent)
183 call assert_false(&expandtab)
184 if has('rightleft')
185 call assert_false(&revins)
186 call assert_false(&hkmap)
187 endif
188 call assert_false(&ruler)
189 call assert_false(&showmatch)
190 call assert_false(&smarttab)
191 call assert_equal(0, &softtabstop)
192 call assert_equal(0, &textwidth)
193 call assert_equal(0, &wrapmargin)
194 if has('vartabs')
195 call assert_equal('', &varsofttabstop)
196 endif
197
198 " disabling 'paste' should restore the option values
199 set nopaste
200 call assert_true(&autoindent)
201 call assert_true(&expandtab)
202 if has('rightleft')
203 call assert_true(&revins)
204 call assert_true(&hkmap)
205 endif
206 call assert_true(&ruler)
207 call assert_true(&showmatch)
208 call assert_true(&smarttab)
209 call assert_equal(3, &softtabstop)
210 call assert_equal(27, &textwidth)
211 call assert_equal(12, &wrapmargin)
212 if has('vartabs')
213 call assert_equal('10,20', &varsofttabstop)
214 endif
215
216 set autoindent& expandtab& ruler& showmatch&
217 if has('rightleft')
218 set revins& hkmap&
219 endif
220 set smarttab& softtabstop& textwidth& wrapmargin&
221 if has('vartabs')
222 set varsofttabstop&
223 endif
224 endfunc
225
166 " vim: shiftwidth=2 sts=2 expandtab 226 " vim: shiftwidth=2 sts=2 expandtab