Patch 8.2.3321
Problem: Some code is not tested.
Solution: Add some more tests. (Dominique Pellé, closes #8735)
Files: src/testdir/test_excmd.vim, src/testdir/test_writefile.vim
*** ../vim-8.2.3320/src/testdir/test_excmd.vim 2021-06-13 21:52:42.521260063 +0200
--- src/testdir/test_excmd.vim 2021-08-09 20:59:42.632948524 +0200
***************
*** 382,387 ****
--- 382,423 ----
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:')
*** ../vim-8.2.3320/src/testdir/test_writefile.vim 2021-05-30 18:04:14.714468918 +0200
--- src/testdir/test_writefile.vim 2021-08-09 20:59:42.632948524 +0200
***************
*** 230,235 ****
--- 230,243 ----
close!
enew | only
call delete('Xfile')
+
+ " :saveas should detect and set the file type.
+ syntax on
+ saveas! Xsaveas.pl
+ call assert_equal('perl', &filetype)
+ syntax off
+ %bw!
+ call delete('Xsaveas.pl')
endfunc
func Test_write_errors()
*** ../vim-8.2.3320/src/version.c 2021-08-09 19:59:01.446811234 +0200
--- src/version.c 2021-08-09 21:01:44.188600087 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3321,
/**/
--
ARTHUR: A scratch? Your arm's off!
BLACK KNIGHT: No, it isn't.
ARTHUR: Well, what's that then?
BLACK KNIGHT: I've had worse.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///