diff src/testdir/test_cmdline.vim @ 28119:57ea74314c1b v8.2.4584

patch 8.2.4584: error for using autoload function in custom completion Commit: https://github.com/vim/vim/commit/da6d42c35a68610af872551b03077047258a7551 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 17 11:46:55 2022 +0000 patch 8.2.4584: error for using autoload function in custom completion Problem: Error for using autoload function in custom completion. Solution: Do not check for errors when using an autoload function. (closes #9962)
author Bram Moolenaar <Bram@vim.org>
date Thu, 17 Mar 2022 13:00:07 +0100
parents 06535d568f74
children 4765d97b4d8b
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1829,6 +1829,29 @@ func Test_wildmode()
   let &encoding = save_encoding
 endfunc
 
+func Test_custom_complete_autoload()
+  call mkdir('Xdir/autoload', 'p')
+  let save_rtp = &rtp
+  exe 'set rtp=' .. getcwd() .. '/Xdir'
+  let lines =<< trim END
+      func vim8#Complete(a, c, p)
+        return "oneA\noneB\noneC"
+      endfunc
+  END
+  call writefile(lines, 'Xdir/autoload/vim8.vim')
+
+  command -nargs=1 -complete=custom,vim8#Complete MyCmd
+  set nowildmenu
+  set wildmode=full,list
+  call feedkeys(":MyCmd \<C-A>\<C-B>\"\<CR>", 'xt')
+  call assert_equal('"MyCmd oneA oneB oneC', @:)
+
+  let &rtp = save_rtp
+  set wildmode& wildmenu&
+  delcommand MyCmd
+  call delete('Xdir', 'rf')
+endfunc
+
 " Test for interrupting the command-line completion
 func Test_interrupt_compl()
   func F(lead, cmdl, p)