Patch 9.0.1460

3 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 17, 2023, 10:54:02 AM4/17/23
to vim...@googlegroups.com

Patch 9.0.1460
Problem: Insufficient testing for getcmdcompltype().
Solution: Add a few more test cases. (closes #12268)
Files: src/ex_getln.c, src/testdir/test_cmdline.vim


*** ../vim-9.0.1459/src/ex_getln.c 2023-04-12 16:21:11.033023805 +0100
--- src/ex_getln.c 2023-04-17 15:49:52.889542429 +0100
***************
*** 4152,4162 ****
if (p == NULL || p->xpc == NULL)
return NULL;

- char_u *cmd_compl;
-
set_expand_context(p->xpc);

! cmd_compl = cmdcomplete_type_to_str(p->xpc->xp_context);
if (cmd_compl != NULL)
return vim_strsave(cmd_compl);

--- 4152,4162 ----
if (p == NULL || p->xpc == NULL)
return NULL;

set_expand_context(p->xpc);
+ if (p->xpc->xp_context == EXPAND_UNSUCCESSFUL)
+ return NULL;

! char_u *cmd_compl = cmdcomplete_type_to_str(p->xpc->xp_context);
if (cmd_compl != NULL)
return vim_strsave(cmd_compl);

*** ../vim-9.0.1459/src/testdir/test_cmdline.vim 2023-04-12 16:21:11.033023805 +0100
--- src/testdir/test_cmdline.vim 2023-04-17 15:49:52.889542429 +0100
***************
*** 3337,3352 ****
call assert_equal('"!vim test_cmdline.vim', @:)
endfunc

! func Check_completion()
! call assert_equal('let a', getcmdline())
! call assert_equal(6, getcmdpos())
! call assert_equal(7, getcmdscreenpos())
! call assert_equal('var', getcmdcompltype())
! return ''
endfunc

func Test_screenpos_and_completion()
! call feedkeys(":let a\<C-R>=Check_completion()\<CR>\<Esc>", "xt")
endfunc

func Test_recursive_register()
--- 3337,3359 ----
call assert_equal('"!vim test_cmdline.vim', @:)
endfunc

! func Call_cmd_funcs()
! return string([getcmdpos(), getcmdscreenpos(), getcmdcompltype()])
endfunc

func Test_screenpos_and_completion()
! call assert_equal(0, getcmdpos())
! call assert_equal(0, getcmdscreenpos())
! call assert_equal('', getcmdcompltype())
!
! cnoremap <expr> <F2> string([getcmdpos(), getcmdscreenpos(), getcmdcompltype()])
! call feedkeys(":let a\<F2>\<C-B>\"\<CR>", "xt")
! call assert_equal("\"let a[6, 7, 'var']", @:)
! call feedkeys(":quit \<F2>\<C-B>\"\<CR>", "xt")
! call assert_equal("\"quit [6, 7, '']", @:)
! call feedkeys(":nosuchcommand \<F2>\<C-B>\"\<CR>", "xt")
! call assert_equal("\"nosuchcommand [15, 16, '']", @:)
! cunmap <F2>
endfunc

func Test_recursive_register()
*** ../vim-9.0.1459/src/version.c 2023-04-16 20:53:50.189171575 +0100
--- src/version.c 2023-04-17 15:50:54.821635529 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1460,
/**/

--
The Law, in its majestic equality, forbids the rich, as well as the
poor, to sleep under the bridges, to beg in the streets, and to steal
bread. -- Anatole France

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages