Patch 8.1.0832
Problem:    confirm() is not tested.
Solution:   Add a test. (Dominique Pelle, closes #3868)
Files:      src/testdir/test_functions.vim


*** ../vim-8.1.0831/src/testdir/test_functions.vim      2019-01-24 
17:59:35.139217458 +0100
--- src/testdir/test_functions.vim      2019-01-27 14:57:15.545336214 +0100
***************
*** 1153,1155 ****
--- 1153,1210 ----
    call delete('Xfuncexists')
    delfunc ExistingFunction
  endfunc
+ 
+ " Test confirm({msg} [, {choices} [, {default} [, {type}]]])
+ func Test_confirm()
+   if !has('unix') || has('gui_running')
+     return
+   endif
+ 
+   call feedkeys('o', 'L')
+   let a = confirm('Press O to proceed')
+   call assert_equal(1, a)
+ 
+   call feedkeys('y', 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No")
+   call assert_equal(1, a)
+ 
+   call feedkeys('n', 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No")
+   call assert_equal(2, a)
+ 
+   " confirm() should return 0 when pressing CTRL-C.
+   call feedkeys("\<C-c>", 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No")
+   call assert_equal(0, a)
+ 
+   " <Esc> requires another character to avoid it being seen as the start of an
+   " escape sequence.  Zero should be harmless.
+   call feedkeys("\<Esc>0", 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No")
+   call assert_equal(0, a)
+ 
+   " Default choice is returned when pressing <CR>.
+   call feedkeys("\<CR>", 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No")
+   call assert_equal(1, a)
+ 
+   call feedkeys("\<CR>", 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No", 2)
+   call assert_equal(2, a)
+ 
+   call feedkeys("\<CR>", 'L')
+   let a = confirm('Are you sure?', "&Yes\n&No", 0)
+   call assert_equal(0, a)
+ 
+   " Test with the {type} 4th argument
+   for type in ['Error', 'Question', 'Info', 'Warning', 'Generic']
+     call feedkeys('y', 'L')
+     let a = confirm('Are you sure?', "&Yes\n&No\n", 1, type)
+     call assert_equal(1, a)
+   endfor
+ 
+   call assert_fails('call confirm([])', 'E730:')
+   call assert_fails('call confirm("Are you sure?", [])', 'E730:')
+   call assert_fails('call confirm("Are you sure?", "&Yes\n&No\n", [])', 
'E745:')
+   call assert_fails('call confirm("Are you sure?", "&Yes\n&No\n", 0, [])', 
'E730:')
+ endfunc
*** ../vim-8.1.0831/src/version.c       2019-01-27 14:41:40.411163229 +0100
--- src/version.c       2019-01-27 15:00:27.004294355 +0100
***************
*** 785,786 ****
--- 785,788 ----
  {   /* Add new patch number below this line */
+ /**/
+     832,
  /**/

-- 
DEAD PERSON:  I'm getting better!
CUSTOMER:     No, you're not -- you'll be stone dead in a moment.
MORTICIAN:    Oh, I can't take him like that -- it's against regulations.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui