diff src/testdir/test_cmdline.vim @ 23853:a9ed31ab85c3 v8.2.2468

patch 8.2.2468: not easy to get the full command name from a shortened one Commit: https://github.com/vim/vim/commit/038e09ee7645731de0296d255aabb17603276443 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 6 12:38:51 2021 +0100 patch 8.2.2468: not easy to get the full command name from a shortened one Problem: Not easy to get the full command name from a shortened one. Solution: Add fullcommand(). (Martin Tournoij, closes https://github.com/vim/vim/issues/7777)
author Bram Moolenaar <Bram@vim.org>
date Sat, 06 Feb 2021 12:45:04 +0100
parents 34a95c4bd647
children 2a885d095bff
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -442,6 +442,43 @@ func Test_getcompletion()
   call assert_fails('call getcompletion("abc", [])', 'E475:')
 endfunc
 
+func Test_fullcommand()
+  let tests = {
+        \ '':           '',
+        \ ':':          '',
+        \ ':::':        '',
+        \ ':::5':       '',
+        \ 'not_a_cmd':  '',
+        \ 'Check':      '',
+        \ 'syntax':     'syntax',
+        \ ':syntax':    'syntax',
+        \ '::::syntax': 'syntax',
+        \ 'sy':         'syntax',
+        \ 'syn':        'syntax',
+        \ 'synt':       'syntax',
+        \ ':sy':        'syntax',
+        \ '::::sy':     'syntax',
+        \ 'match':      'match',
+        \ '2match':     'match',
+        \ '3match':     'match',
+        \ 'aboveleft':  'aboveleft',
+        \ 'abo':        'aboveleft',
+        \ 's':          'substitute',
+        \ '5s':         'substitute',
+        \ ':5s':        'substitute',
+        \ "'<,'>s":     'substitute',
+        \ ":'<,'>s":    'substitute',
+        \ 'CheckUni':   'CheckUnix',
+        \ 'CheckUnix':  'CheckUnix',
+  \ }
+
+  for [in, want] in items(tests)
+    call assert_equal(want, fullcommand(in))
+  endfor
+
+  call assert_equal('syntax', 'syn'->fullcommand())
+endfunc
+
 func Test_shellcmd_completion()
   let save_path = $PATH