diff src/testdir/test_functions.vim @ 14379:0f1446193ded v8.1.0204

patch 8.1.0204: inputlist() is not tested commit https://github.com/vim/vim/commit/947b39e761b8a95cc1bd37ad0c2c30552238809a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 22 19:36:37 2018 +0200 patch 8.1.0204: inputlist() is not tested Problem: inputlist() is not tested. Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/3240)
author Christian Brabandt <cb@256bit.org>
date Sun, 22 Jul 2018 19:45:05 +0200
parents e73c0a0e7e87
children 06316dbd66bc
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -810,6 +810,17 @@ func Test_col()
   bw!
 endfunc
 
+func Test_inputlist()
+  call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<cr>", 'tx')
+  call assert_equal(1, c)
+  call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>2\<cr>", 'tx')
+  call assert_equal(2, c)
+  call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>3\<cr>", 'tx')
+  call assert_equal(3, c)
+
+  call assert_fails('call inputlist("")', 'E686:')
+endfunc
+
 func Test_balloon_show()
   if has('balloon_eval')
     " This won't do anything but must not crash either.