Mercurial > vim
comparison src/testdir/test_cursorline.vim @ 30164:f7a2de8a4ddc v9.0.0418
patch 9.0.0418: manually deleting temp test files
Commit: https://github.com/vim/vim/commit/45bbaef0382c5468d9fac511775bd99ea7bf5b84
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 8 16:39:22 2022 +0100
patch 9.0.0418: manually deleting temp test files
Problem: Manually deleting temp test files.
Solution: Use the 'D' flag of writefile() and mkdir().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 08 Sep 2022 17:45:03 +0200 |
parents | d0241e74bfdb |
children | f936d46cc9c1 |
comparison
equal
deleted
inserted
replaced
30163:ac28d70ac476 | 30164:f7a2de8a4ddc |
---|---|
131 call cursor(1,1) | 131 call cursor(1,1) |
132 END2 | 132 END2 |
133 call extend(lines, lines1) | 133 call extend(lines, lines1) |
134 call extend(lines, ["call append(0, ".. string(file_content).. ')']) | 134 call extend(lines, ["call append(0, ".. string(file_content).. ')']) |
135 call extend(lines, lines2) | 135 call extend(lines, lines2) |
136 call writefile(lines, filename) | 136 call writefile(lines, filename, 'D') |
137 " basic test | 137 " basic test |
138 let buf = RunVimInTerminal('-S '. filename, #{rows: 20}) | 138 let buf = RunVimInTerminal('-S '. filename, #{rows: 20}) |
139 call VerifyScreenDump(buf, 'Test_'. filename. '_1', {}) | 139 call VerifyScreenDump(buf, 'Test_'. filename. '_1', {}) |
140 call term_sendkeys(buf, "fagj") | 140 call term_sendkeys(buf, "fagj") |
141 call VerifyScreenDump(buf, 'Test_'. filename. '_2', {}) | 141 call VerifyScreenDump(buf, 'Test_'. filename. '_2', {}) |
194 call term_sendkeys(buf, "gj") | 194 call term_sendkeys(buf, "gj") |
195 call VerifyScreenDump(buf, 'Test_'. filename. '_24', {}) | 195 call VerifyScreenDump(buf, 'Test_'. filename. '_24', {}) |
196 call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>") | 196 call term_sendkeys(buf, ":set list& cursorlineopt& listchars&\<cr>") |
197 | 197 |
198 call StopVimInTerminal(buf) | 198 call StopVimInTerminal(buf) |
199 call delete(filename) | |
200 endfunc | 199 endfunc |
201 | 200 |
202 func Test_cursorline_redraw() | 201 func Test_cursorline_redraw() |
203 CheckScreendump | 202 CheckScreendump |
204 CheckOption cursorlineopt | 203 CheckOption cursorlineopt |
225 This is only done when specific option values are requested, not for ":verbose | 224 This is only done when specific option values are requested, not for ":verbose |
226 set all" or ":verbose set" without an argument. | 225 set all" or ":verbose set" without an argument. |
227 When the option was set by hand there is no "Last set" message. | 226 When the option was set by hand there is no "Last set" message. |
228 When the option was set while executing a function, user command or | 227 When the option was set while executing a function, user command or |
229 END | 228 END |
230 call writefile(textlines, 'Xtextfile') | 229 call writefile(textlines, 'Xtextfile', 'D') |
231 | 230 |
232 let script =<< trim END | 231 let script =<< trim END |
233 set cursorline scrolloff=2 | 232 set cursorline scrolloff=2 |
234 normal 12G | 233 normal 12G |
235 END | 234 END |
236 call writefile(script, 'Xscript') | 235 call writefile(script, 'Xscript', 'D') |
237 | 236 |
238 let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40}) | 237 let buf = RunVimInTerminal('-S Xscript Xtextfile', #{rows: 20, cols: 40}) |
239 call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {}) | 238 call VerifyScreenDump(buf, 'Test_cursorline_redraw_1', {}) |
240 call term_sendkeys(buf, "zt") | 239 call term_sendkeys(buf, "zt") |
241 call TermWait(buf) | 240 call TermWait(buf) |
242 call term_sendkeys(buf, "\<C-U>") | 241 call term_sendkeys(buf, "\<C-U>") |
243 call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {}) | 242 call VerifyScreenDump(buf, 'Test_cursorline_redraw_2', {}) |
244 | 243 |
245 call StopVimInTerminal(buf) | 244 call StopVimInTerminal(buf) |
246 call delete('Xscript') | |
247 call delete('Xtextfile') | |
248 endfunc | 245 endfunc |
249 | 246 |
250 func Test_cursorline_callback() | 247 func Test_cursorline_callback() |
251 CheckScreendump | 248 CheckScreendump |
252 CheckFeature timers | 249 CheckFeature timers |
260 call cursor(2, 1) | 257 call cursor(2, 1) |
261 endfunc | 258 endfunc |
262 | 259 |
263 call timer_start(300, 'Func') | 260 call timer_start(300, 'Func') |
264 END | 261 END |
265 call writefile(lines, 'Xcul_timer') | 262 call writefile(lines, 'Xcul_timer', 'D') |
266 | 263 |
267 let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8}) | 264 let buf = RunVimInTerminal('-S Xcul_timer', #{rows: 8}) |
268 call TermWait(buf, 310) | 265 call TermWait(buf, 310) |
269 call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {}) | 266 call VerifyScreenDump(buf, 'Test_cursorline_callback_1', {}) |
270 | 267 |
271 call StopVimInTerminal(buf) | 268 call StopVimInTerminal(buf) |
272 call delete('Xcul_timer') | |
273 endfunc | 269 endfunc |
274 | 270 |
275 func Test_cursorline_screenline_update() | 271 func Test_cursorline_screenline_update() |
276 CheckScreendump | 272 CheckScreendump |
277 | 273 |
278 let lines =<< trim END | 274 let lines =<< trim END |
279 call setline(1, repeat('xyz ', 30)) | 275 call setline(1, repeat('xyz ', 30)) |
280 set cursorline cursorlineopt=screenline | 276 set cursorline cursorlineopt=screenline |
281 inoremap <F2> <Cmd>call cursor(1, 1)<CR> | 277 inoremap <F2> <Cmd>call cursor(1, 1)<CR> |
282 END | 278 END |
283 call writefile(lines, 'Xcul_screenline') | 279 call writefile(lines, 'Xcul_screenline', 'D') |
284 | 280 |
285 let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8}) | 281 let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8}) |
286 call term_sendkeys(buf, "A") | 282 call term_sendkeys(buf, "A") |
287 call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {}) | 283 call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {}) |
288 call term_sendkeys(buf, "\<F2>") | 284 call term_sendkeys(buf, "\<F2>") |
289 call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {}) | 285 call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {}) |
290 call term_sendkeys(buf, "\<Esc>") | 286 call term_sendkeys(buf, "\<Esc>") |
291 | 287 |
292 call StopVimInTerminal(buf) | 288 call StopVimInTerminal(buf) |
293 call delete('Xcul_screenline') | |
294 endfunc | 289 endfunc |
295 | 290 |
296 func Test_cursorline_cursorbind_horizontal_scroll() | 291 func Test_cursorline_cursorbind_horizontal_scroll() |
297 CheckScreendump | 292 CheckScreendump |
298 | 293 |
305 " add empty lines, required for cursorcolumn | 300 " add empty lines, required for cursorcolumn |
306 call append(1, ['','','','']) | 301 call append(1, ['','','','']) |
307 20vsp | 302 20vsp |
308 windo :set cursorbind | 303 windo :set cursorbind |
309 END | 304 END |
310 call writefile(lines, 'Xhor_scroll') | 305 call writefile(lines, 'Xhor_scroll', 'D') |
311 | 306 |
312 let buf = RunVimInTerminal('-S Xhor_scroll', #{rows: 8}) | 307 let buf = RunVimInTerminal('-S Xhor_scroll', #{rows: 8}) |
313 call term_sendkeys(buf, "20l") | 308 call term_sendkeys(buf, "20l") |
314 call VerifyScreenDump(buf, 'Test_hor_scroll_1', {}) | 309 call VerifyScreenDump(buf, 'Test_hor_scroll_1', {}) |
315 call term_sendkeys(buf, "10l") | 310 call term_sendkeys(buf, "10l") |
324 call term_sendkeys(buf, "0") | 319 call term_sendkeys(buf, "0") |
325 call term_sendkeys(buf, "40l") | 320 call term_sendkeys(buf, "40l") |
326 call VerifyScreenDump(buf, 'Test_hor_scroll_5', {}) | 321 call VerifyScreenDump(buf, 'Test_hor_scroll_5', {}) |
327 | 322 |
328 call StopVimInTerminal(buf) | 323 call StopVimInTerminal(buf) |
329 call delete('Xhor_scroll') | |
330 endfunc | 324 endfunc |
331 | 325 |
332 | 326 |
333 " vim: shiftwidth=2 sts=2 expandtab | 327 " vim: shiftwidth=2 sts=2 expandtab |