diff src/testdir/test_cmdline.vim @ 20745:49673325ca13 v8.2.0925

patch 8.2.0925: getcompletion() does not return command line arguments Commit: https://github.com/vim/vim/commit/1f1fd44ef796dd909ff5f3e5288b3fd79294dc71 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 7 18:45:14 2020 +0200 patch 8.2.0925: getcompletion() does not return command line arguments Problem: Getcompletion() does not return command line arguments. Solution: Add the "cmdline" option. (Shougo, closes https://github.com/vim/vim/issues/1140)
author Bram Moolenaar <Bram@vim.org>
date Sun, 07 Jun 2020 19:00:03 +0200
parents fa6f1c97813f
children 32f24b8c9c2d
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -355,6 +355,20 @@ func Test_getcompletion()
     call assert_equal(['Testing'], l)
   endif
 
+  " Command line completion tests
+  let l = getcompletion('cd ', 'cmdline')
+  call assert_true(index(l, 'samples/') >= 0)
+  let l = getcompletion('cd NoMatch', 'cmdline')
+  call assert_equal([], l)
+  let l = getcompletion('let v:n', 'cmdline')
+  call assert_true(index(l, 'v:null') >= 0)
+  let l = getcompletion('let v:notexists', 'cmdline')
+  call assert_equal([], l)
+  let l = getcompletion('call tag', 'cmdline')
+  call assert_true(index(l, 'taglist(') >= 0)
+  let l = getcompletion('call paint', 'cmdline')
+  call assert_equal([], l)
+
   " For others test if the name is recognized.
   let names = ['buffer', 'environment', 'file_in_path', 'mapping', 'tag', 'tag_listfiles', 'user']
   if has('cmdline_hist')
@@ -379,7 +393,7 @@ func Test_getcompletion()
   set tags&
 
   call assert_fails('call getcompletion("", "burp")', 'E475:')
-  call assert_fails('call getcompletion("abc", [])', 'E474:')
+  call assert_fails('call getcompletion("abc", [])', 'E475:')
 endfunc
 
 func Test_shellcmd_completion()