Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 28107:710a509be2cd v8.2.4578
patch 8.2.4578: no warning when autoload script for completion has an error
Commit: https://github.com/vim/vim/commit/fe8e9f674036f3206b0080f4a931c991cf142f8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 16 13:09:15 2022 +0000
patch 8.2.4578: no warning when autoload script for completion has an error
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Mar 2022 14:15:03 +0100 |
parents | 554f493902ea |
children | 06535d568f74 |
comparison
equal
deleted
inserted
replaced
28106:4c7aa481d798 | 28107:710a509be2cd |
---|---|
2 | 2 |
3 source check.vim | 3 source check.vim |
4 source screendump.vim | 4 source screendump.vim |
5 source view_util.vim | 5 source view_util.vim |
6 source shared.vim | 6 source shared.vim |
7 import './vim9.vim' as v9 | |
7 | 8 |
8 func SetUp() | 9 func SetUp() |
9 func SaveLastScreenLine() | 10 func SaveLastScreenLine() |
10 let g:Sline = Screenline(&lines - 1) | 11 let g:Sline = Screenline(&lines - 1) |
11 return '' | 12 return '' |
539 endif | 540 endif |
540 | 541 |
541 call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E871:') | 542 call assert_fails("call getcompletion('\\\\@!\\\\@=', 'buffer')", 'E871:') |
542 call assert_fails('call getcompletion("", "burp")', 'E475:') | 543 call assert_fails('call getcompletion("", "burp")', 'E475:') |
543 call assert_fails('call getcompletion("abc", [])', 'E475:') | 544 call assert_fails('call getcompletion("abc", [])', 'E475:') |
545 endfunc | |
546 | |
547 func Test_complete_autoload_error() | |
548 let save_rtp = &rtp | |
549 let lines =<< trim END | |
550 vim9script | |
551 export def Complete(..._): string | |
552 return 'match' | |
553 enddef | |
554 echo this will cause an error | |
555 END | |
556 call mkdir('Xdir/autoload', 'p') | |
557 call writefile(lines, 'Xdir/autoload/script.vim') | |
558 exe 'set rtp+=' .. getcwd() .. '/Xdir' | |
559 | |
560 let lines =<< trim END | |
561 vim9script | |
562 import autoload 'script.vim' | |
563 command -nargs=* -complete=custom,script.Complete Cmd eval 0 + 0 | |
564 &wildcharm = char2nr("\<Tab>") | |
565 feedkeys(":Cmd \<Tab>", 'xt') | |
566 END | |
567 call v9.CheckScriptFailure(lines, 'E121: Undefined variable: this') | |
568 | |
569 let &rtp = save_rtp | |
570 call delete('Xdir', 'rf') | |
544 endfunc | 571 endfunc |
545 | 572 |
546 func Test_fullcommand() | 573 func Test_fullcommand() |
547 let tests = { | 574 let tests = { |
548 \ '': '', | 575 \ '': '', |
2669 endfunc | 2696 endfunc |
2670 func S1e2n3dmail() | 2697 func S1e2n3dmail() |
2671 endfunc | 2698 endfunc |
2672 set wildoptions=fuzzy | 2699 set wildoptions=fuzzy |
2673 call feedkeys(":call sendmail\<C-A>\<C-B>\"\<CR>", 'tx') | 2700 call feedkeys(":call sendmail\<C-A>\<C-B>\"\<CR>", 'tx') |
2674 call assert_equal('"call SendSomemail() S1e2n3dmail() ' | 2701 call assert_match('"call SendSomemail() S1e2n3dmail() <SNR>\d\+_Sendmail()', @:) |
2675 \ .. expand("<SID>") .. 'Sendmail()', @:) | |
2676 set wildoptions& | 2702 set wildoptions& |
2677 delfunc s:Sendmail | 2703 delfunc s:Sendmail |
2678 delfunc SendSomemail | 2704 delfunc SendSomemail |
2679 delfunc S1e2n3dmail | 2705 delfunc S1e2n3dmail |
2680 endfunc | 2706 endfunc |