Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -382,6 +382,42 @@ func Test_confirm_write_ro() call delete('Xconfirm_write_ro') endfunc +func Test_confirm_write_partial_file() + CheckNotGui + CheckRunVimInTerminal + + call writefile(['a', 'b', 'c', 'd'], 'Xwrite_partial') + call writefile(['set nobackup ff=unix cmdheight=2', + \ 'edit Xwrite_partial'], 'Xscript') + let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) + + call term_sendkeys(buf, ":confirm 2,3w\n") + call WaitForAssert({-> assert_match('^Write partial file? *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', + \ term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'N') + call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000) + call assert_equal(['a', 'b', 'c', 'd'], readfile('Xwrite_partial')) + call delete('Xwrite_partial') + + call term_sendkeys(buf, ":confirm 2,3w\n") + call WaitForAssert({-> assert_match('^Write partial file? *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', + \ term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, 'Y') + call WaitForAssert({-> assert_match('^"Xwrite_partial" \[New\] 2L, 4B written *$', + \ term_getline(buf, 19))}, 1000) + call WaitForAssert({-> assert_match('^Press ENTER or type command to continue *$', + \ term_getline(buf, 20))}, 1000) + call assert_equal(['b', 'c'], readfile('Xwrite_partial')) + + call StopVimInTerminal(buf) + call delete('Xwrite_partial') + call delete('Xscript') +endfunc + " Test for the :print command func Test_print_cmd() call assert_fails('print', 'E749:')