comparison src/testdir/test_paste.vim @ 30592:457ea0570b6f v9.0.0631

patch 9.0.0631: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/145d1fd91041bd2a22a11eef0357702e420796e2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 30 21:57:11 2022 +0100 patch 9.0.0631: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Sep 2022 23:00:10 +0200
parents da77eb586899
children
comparison
equal deleted inserted replaced
30591:38ef10db4a4e 30592:457ea0570b6f
224 let lines =<< trim END 224 let lines =<< trim END
225 set pastetoggle=abc 225 set pastetoggle=abc
226 set ttimeoutlen=10000 226 set ttimeoutlen=10000
227 imap d a 227 imap d a
228 END 228 END
229 call writefile(lines, 'Xpastetoggle_no_typed_after_mapped.vim') 229 call writefile(lines, 'Xpastetoggle_no_typed_after_mapped.vim', 'D')
230 let buf = RunVimInTerminal('-S Xpastetoggle_no_typed_after_mapped.vim', #{rows: 8}) 230 let buf = RunVimInTerminal('-S Xpastetoggle_no_typed_after_mapped.vim', #{rows: 8})
231 call TermWait(buf) 231 call TermWait(buf)
232 call term_sendkeys(buf, ":call feedkeys('id', 't')\<CR>") 232 call term_sendkeys(buf, ":call feedkeys('id', 't')\<CR>")
233 call term_wait(buf, 200) 233 call term_wait(buf, 200)
234 call term_sendkeys(buf, 'bc') 234 call term_sendkeys(buf, 'bc')
235 " 'ttimeoutlen' should NOT apply 235 " 'ttimeoutlen' should NOT apply
236 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 8))}) 236 call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 8))})
237 237
238 call StopVimInTerminal(buf) 238 call StopVimInTerminal(buf)
239 call delete('Xpastetoggle_no_typed_after_mapped.vim')
240 endfunc 239 endfunc
241 240
242 func Test_pastetoggle_timeout_typed_after_mapped() 241 func Test_pastetoggle_timeout_typed_after_mapped()
243 CheckRunVimInTerminal 242 CheckRunVimInTerminal
244 243
245 let lines =<< trim END 244 let lines =<< trim END
246 set pastetoggle=abc 245 set pastetoggle=abc
247 set ttimeoutlen=10000 246 set ttimeoutlen=10000
248 imap d a 247 imap d a
249 END 248 END
250 call writefile(lines, 'Xpastetoggle_typed_after_mapped.vim') 249 call writefile(lines, 'Xpastetoggle_typed_after_mapped.vim', 'D')
251 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_mapped.vim', #{rows: 8}) 250 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_mapped.vim', #{rows: 8})
252 call TermWait(buf) 251 call TermWait(buf)
253 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>") 252 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>")
254 call term_wait(buf, 200) 253 call term_wait(buf, 200)
255 call term_sendkeys(buf, 'c') 254 call term_sendkeys(buf, 'c')
256 " 'ttimeoutlen' should apply 255 " 'ttimeoutlen' should apply
257 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))}) 256 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))})
258 257
259 call StopVimInTerminal(buf) 258 call StopVimInTerminal(buf)
260 call delete('Xpastetoggle_typed_after_mapped.vim')
261 endfunc 259 endfunc
262 260
263 func Test_pastetoggle_timeout_typed_after_noremap() 261 func Test_pastetoggle_timeout_typed_after_noremap()
264 CheckRunVimInTerminal 262 CheckRunVimInTerminal
265 263
266 let lines =<< trim END 264 let lines =<< trim END
267 set pastetoggle=abc 265 set pastetoggle=abc
268 set ttimeoutlen=10000 266 set ttimeoutlen=10000
269 inoremap d a 267 inoremap d a
270 END 268 END
271 call writefile(lines, 'Xpastetoggle_typed_after_noremap.vim') 269 call writefile(lines, 'Xpastetoggle_typed_after_noremap.vim', 'D')
272 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_noremap.vim', #{rows: 8}) 270 let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_noremap.vim', #{rows: 8})
273 call TermWait(buf) 271 call TermWait(buf)
274 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>") 272 call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>")
275 call term_wait(buf, 200) 273 call term_wait(buf, 200)
276 call term_sendkeys(buf, 'c') 274 call term_sendkeys(buf, 'c')
277 " 'ttimeoutlen' should apply 275 " 'ttimeoutlen' should apply
278 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))}) 276 call WaitForAssert({-> assert_match('^-- INSERT (paste) --', term_getline(buf, 8))})
279 277
280 call StopVimInTerminal(buf) 278 call StopVimInTerminal(buf)
281 call delete('Xpastetoggle_typed_after_noremap.vim')
282 endfunc 279 endfunc
283 280
284 " Test for restoring option values when 'paste' is disabled 281 " Test for restoring option values when 'paste' is disabled
285 func Test_paste_opt_restore() 282 func Test_paste_opt_restore()
286 set autoindent expandtab ruler showmatch 283 set autoindent expandtab ruler showmatch