comparison src/testdir/test_excmd.vim @ 25569:8e9886ce88b3 v8.2.3321

patch 8.2.3321: some code is not tested Commit: https://github.com/vim/vim/commit/bd9e7961256ea6a98bd5a7bfe14e32c4c47186e6 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Mon Aug 9 21:04:44 2021 +0200 patch 8.2.3321: some code is not tested Problem: Some code is not tested. Solution: Add some more tests. (Dominique Pell?, closes https://github.com/vim/vim/issues/8735)
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Aug 2021 21:15:03 +0200
parents 1186160ecf57
children 826c36b4640b
comparison
equal deleted inserted replaced
25568:8c26cfe0b103 25569:8e9886ce88b3
378 call assert_equal(['foo'], readfile('Xconfirm_write_ro')) 378 call assert_equal(['foo'], readfile('Xconfirm_write_ro'))
379 379
380 call StopVimInTerminal(buf) 380 call StopVimInTerminal(buf)
381 call delete('Xscript') 381 call delete('Xscript')
382 call delete('Xconfirm_write_ro') 382 call delete('Xconfirm_write_ro')
383 endfunc
384
385 func Test_confirm_write_partial_file()
386 CheckNotGui
387 CheckRunVimInTerminal
388
389 call writefile(['a', 'b', 'c', 'd'], 'Xwrite_partial')
390 call writefile(['set nobackup ff=unix cmdheight=2',
391 \ 'edit Xwrite_partial'], 'Xscript')
392 let buf = RunVimInTerminal('-S Xscript', {'rows': 20})
393
394 call term_sendkeys(buf, ":confirm 2,3w\n")
395 call WaitForAssert({-> assert_match('^Write partial file? *$',
396 \ term_getline(buf, 19))}, 1000)
397 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$',
398 \ term_getline(buf, 20))}, 1000)
399 call term_sendkeys(buf, 'N')
400 call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000)
401 call assert_equal(['a', 'b', 'c', 'd'], readfile('Xwrite_partial'))
402 call delete('Xwrite_partial')
403
404 call term_sendkeys(buf, ":confirm 2,3w\n")
405 call WaitForAssert({-> assert_match('^Write partial file? *$',
406 \ term_getline(buf, 19))}, 1000)
407 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$',
408 \ term_getline(buf, 20))}, 1000)
409 call term_sendkeys(buf, 'Y')
410 call WaitForAssert({-> assert_match('^"Xwrite_partial" \[New\] 2L, 4B written *$',
411 \ term_getline(buf, 19))}, 1000)
412 call WaitForAssert({-> assert_match('^Press ENTER or type command to continue *$',
413 \ term_getline(buf, 20))}, 1000)
414 call assert_equal(['b', 'c'], readfile('Xwrite_partial'))
415
416 call StopVimInTerminal(buf)
417 call delete('Xwrite_partial')
418 call delete('Xscript')
383 endfunc 419 endfunc
384 420
385 " Test for the :print command 421 " Test for the :print command
386 func Test_print_cmd() 422 func Test_print_cmd()
387 call assert_fails('print', 'E749:') 423 call assert_fails('print', 'E749:')