comparison src/testdir/test_usercommands.vim @ 30203:a3016780f346 v9.0.0437

patch 9.0.0437: no error when custom completion function returns wrong type Commit: https://github.com/vim/vim/commit/55e9366e32bc0e1056478d1d0ae935f9cf039d6a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 10 13:52:26 2022 +0100 patch 9.0.0437: no error when custom completion function returns wrong type Problem: No error when a custom completion function returns something else than the expected list. Solution: Give an error. (closes #11100)
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Sep 2022 15:00:03 +0200
parents 578e71f924fe
children 0913cd44fdfa
comparison
equal deleted inserted replaced
30202:fee9eccee266 30203:a3016780f346
664 func Test_usercmd_custom() 664 func Test_usercmd_custom()
665 func T1(a, c, p) 665 func T1(a, c, p)
666 return "a\nb\n" 666 return "a\nb\n"
667 endfunc 667 endfunc
668 command -nargs=* -complete=customlist,T1 TCmd1 668 command -nargs=* -complete=customlist,T1 TCmd1
669 call feedkeys(":TCmd1 \<C-A>\<C-B>\"\<CR>", 'xt') 669 call assert_fails('call feedkeys(":TCmd1 \<C-A>\<C-B>\"\<CR>", "xt")', 'E1303: Custom list completion function does not return a List but a string')
670 call assert_equal('"TCmd1 ', @:) 670 call assert_equal('"TCmd1 ', @:)
671 delcommand TCmd1 671 delcommand TCmd1
672 delfunc T1 672 delfunc T1
673 673
674 func T2(a, c, p) 674 func T2(a, c, p)
675 return {} 675 return {}
676 endfunc 676 endfunc
677 command -nargs=* -complete=customlist,T2 TCmd2 677 command -nargs=* -complete=customlist,T2 TCmd2
678 call feedkeys(":TCmd2 \<C-A>\<C-B>\"\<CR>", 'xt') 678 call assert_fails('call feedkeys(":TCmd2 \<C-A>\<C-B>\"\<CR>", "xt")', 'E1303: Custom list completion function does not return a List but a dict')
679 call assert_equal('"TCmd2 ', @:) 679 call assert_equal('"TCmd2 ', @:)
680 delcommand TCmd2 680 delcommand TCmd2
681 delfunc T2 681 delfunc T2
682 endfunc 682 endfunc
683 683