diff src/testdir/test_ins_complete.vim @ 29000:7d28903e80df v8.2.5022

patch 8.2.5022: 'completefunc'/'omnifunc' error does not end completion Commit: https://github.com/vim/vim/commit/9bcb9ca9c7dd1632385dc3351b5e019739368658 Author: LemonBoy <thatlemon@gmail.com> Date: Thu May 26 15:23:26 2022 +0100 patch 8.2.5022: 'completefunc'/'omnifunc' error does not end completion Problem: 'completefunc'/'omnifunc' error does not end completion. Solution: Check if there was an error or exception. (closes https://github.com/vim/vim/issues/10486, closes #4218)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 May 2022 16:30:02 +0200
parents c1591fa6f81a
children 45c182c4f7e9
line wrap: on
line diff
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -140,6 +140,30 @@ func Test_omni_dash()
   set omnifunc=
 endfunc
 
+func Test_omni_throw()
+  let g:CallCount = 0
+  func Omni(findstart, base)
+    let g:CallCount += 1
+    if a:findstart
+      throw "he he he"
+    endif
+  endfunc
+  set omnifunc=Omni
+  new
+  try
+    exe "normal ifoo\<C-x>\<C-o>"
+    call assert_false(v:true, 'command should have failed')
+  catch
+    call assert_exception('he he he')
+    call assert_equal(1, g:CallCount)
+  endtry
+
+  bwipe!
+  delfunc Omni
+  unlet g:CallCount
+  set omnifunc=
+endfunc
+
 func Test_omni_autoload()
   let save_rtp = &rtp
   set rtp=Xruntime/some