summaryrefslogtreecommitdiff
path: root/src/testdir/test_cmdline.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-16 13:09:15 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-16 13:09:15 +0000
commitfe8e9f674036f3206b0080f4a931c991cf142f8b (patch)
tree164fd1908cb9969743eac38bf927584b13acc8da /src/testdir/test_cmdline.vim
parent9323ca51c2b1522f26907a7b8879067245ebd1be (diff)
downloadvim-git-fe8e9f674036f3206b0080f4a931c991cf142f8b.tar.gz
patch 8.2.4578: no warning when autoload script for completion has an errorv8.2.4578
Problem: No warning when an autoload script for completion function has an error. Solution: Do not ignore errors when a function name is given with a dot or '#' character. (closes #9958)
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r--src/testdir/test_cmdline.vim30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index bdcecbfa2..20f932b30 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -4,6 +4,7 @@ source check.vim
source screendump.vim
source view_util.vim
source shared.vim
+import './vim9.vim' as v9
func SetUp()
func SaveLastScreenLine()
@@ -543,6 +544,32 @@ func Test_getcompletion()
call assert_fails('call getcompletion("abc", [])', 'E475:')
endfunc
+func Test_complete_autoload_error()
+ let save_rtp = &rtp
+ let lines =<< trim END
+ vim9script
+ export def Complete(..._): string
+ return 'match'
+ enddef
+ echo this will cause an error
+ END
+ call mkdir('Xdir/autoload', 'p')
+ call writefile(lines, 'Xdir/autoload/script.vim')
+ exe 'set rtp+=' .. getcwd() .. '/Xdir'
+
+ let lines =<< trim END
+ vim9script
+ import autoload 'script.vim'
+ command -nargs=* -complete=custom,script.Complete Cmd eval 0 + 0
+ &wildcharm = char2nr("\<Tab>")
+ feedkeys(":Cmd \<Tab>", 'xt')
+ END
+ call v9.CheckScriptFailure(lines, 'E121: Undefined variable: this')
+
+ let &rtp = save_rtp
+ call delete('Xdir', 'rf')
+endfunc
+
func Test_fullcommand()
let tests = {
\ '': '',
@@ -2671,8 +2698,7 @@ func Test_fuzzy_completion_userdefined_snr_func()
endfunc
set wildoptions=fuzzy
call feedkeys(":call sendmail\<C-A>\<C-B>\"\<CR>", 'tx')
- call assert_equal('"call SendSomemail() S1e2n3dmail() '
- \ .. expand("<SID>") .. 'Sendmail()', @:)
+ call assert_match('"call SendSomemail() S1e2n3dmail() <SNR>\d\+_Sendmail()', @:)
set wildoptions&
delfunc s:Sendmail
delfunc SendSomemail