diff src/testdir/test_vim9_script.vim @ 27237:44cb142c8615 v8.2.4147

patch 8.2.4147: E464 does not always include the offending command Commit: https://github.com/vim/vim/commit/bed34f0a8a4e38a72a080184881bc68254a8cdc6 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 19 20:48:37 2022 +0000 patch 8.2.4147: E464 does not always include the offending command Problem: E464 does not always include the offending command. Solution: Add another error message with "%s". (closes https://github.com/vim/vim/issues/9564)
author Bram Moolenaar <Bram@vim.org>
date Wed, 19 Jan 2022 22:00:03 +0100
parents 6fc63c6a7ee7
children 4c16acb2525f
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -3664,6 +3664,36 @@ def ProfiledNestedProfiled()
   Nested()
 enddef
 
+def Test_ambigous_command_error()
+  var lines =<< trim END
+      vim9script
+      command CmdA echomsg 'CmdA'
+      command CmdB echomsg 'CmdB'
+      Cmd
+  END
+  CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 4)
+
+  lines =<< trim END
+      vim9script
+      def Func()
+        Cmd
+      enddef
+      Func()
+  END
+  CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 1)
+
+  lines =<< trim END
+      vim9script
+      nnoremap <F3> <ScriptCmd>Cmd<CR>
+      feedkeys("\<F3>", 'xt')
+  END
+  CheckScriptFailure(lines, 'E464: Ambiguous use of user-defined command: Cmd', 3)
+
+  delcommand CmdA
+  delcommand CmdB
+  nunmap <F3>
+enddef
+
 " Execute this near the end, profiling doesn't stop until Vim exits.
 " This only tests that it works, not the profiling output.
 def Test_xx_profile_with_lambda()