Patch 8.2.0049

23 views
Skip to first unread message

Bram Moolenaar

unread,
Dec 27, 2019, 11:21:47 AM12/27/19
to vim...@googlegroups.com

Patch 8.2.0049
Problem: Command line completion not fully tested.
Solution: Add more test cases. Make help sorting stable. (Dominique Pelle,
closes #5402)
Files: src/ex_cmds.c, src/testdir/test_cd.vim,
src/testdir/test_cmdline.vim, src/testdir/test_help.vim,
src/testdir/test_menu.vim, src/testdir/test_options.vim,
src/testdir/test_syntax.vim


*** ../vim-8.2.0048/src/ex_cmds.c 2019-12-14 16:18:11.578458401 +0100
--- src/ex_cmds.c 2019-12-27 17:17:05.414680043 +0100
***************
*** 5341,5350 ****
{
char *p1;
char *p2;

p1 = *(char **)s1 + strlen(*(char **)s1) + 1;
p2 = *(char **)s2 + strlen(*(char **)s2) + 1;
! return strcmp(p1, p2);
}

/*
--- 5341,5358 ----
{
char *p1;
char *p2;
+ int cmp;

p1 = *(char **)s1 + strlen(*(char **)s1) + 1;
p2 = *(char **)s2 + strlen(*(char **)s2) + 1;
!
! // Compare by help heuristic number first.
! cmp = strcmp(p1, p2);
! if (cmp != 0)
! return cmp;
!
! // Compare by strings as tie-breaker when same heuristic number.
! return strcmp(*(char **)s1, *(char **)s2);
}

/*
*** ../vim-8.2.0048/src/testdir/test_cd.vim 2019-11-09 17:59:16.000000000 +0100
--- src/testdir/test_cd.vim 2019-12-27 17:17:05.414680043 +0100
***************
*** 106,108 ****
--- 106,123 ----
call chdir(topdir)
call delete('Xdir', 'rf')
endfunc
+
+ func Test_cd_completion()
+ call mkdir('XComplDir1', 'p')
+ call mkdir('XComplDir2', 'p')
+ call writefile([], 'XComplFile')
+
+ for cmd in ['cd', 'chdir', 'lcd', 'lchdir', 'tcd', 'tchdir']
+ call feedkeys(':' .. cmd .. " XCompl\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"' .. cmd .. ' XComplDir1/ XComplDir2/', @:)
+ endfor
+
+ call delete('XComplDir1', 'd')
+ call delete('XComplDir2', 'd')
+ call delete('XComplFile')
+ endfunc
*** ../vim-8.2.0048/src/testdir/test_cmdline.vim 2019-12-18 22:26:15.746294049 +0100
--- src/testdir/test_cmdline.vim 2019-12-27 17:17:05.418680032 +0100
***************
*** 553,558 ****
--- 553,566 ----
endif
endfunc

+ func Test_cmdline_complete_bang()
+ if executable('whoami')
+ return
+ endif
+ call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_match('^".*\<whoami\>', @:)
+ endfunc
+
funct Test_cmdline_complete_languages()
let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '')

***************
*** 575,580 ****
--- 583,597 ----
endif
endfunc

+ func Test_cmdline_complete_env_variable()
+ let $X_VIM_TEST_COMPLETE_ENV = 'foo'
+
+ call feedkeys(":edit $X_VIM_TEST_COMPLETE_E\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_match('"edit $X_VIM_TEST_COMPLETE_ENV', @:)
+
+ unlet $X_VIM_TEST_COMPLETE_ENV
+ endfunc
+
func Test_cmdline_write_alternatefile()
new
call setline('.', ['one', 'two'])
*** ../vim-8.2.0048/src/testdir/test_help.vim 2019-10-05 11:27:27.000000000 +0200
--- src/testdir/test_help.vim 2019-12-27 17:17:05.418680032 +0100
***************
*** 55,57 ****
--- 55,62 ----
call delete('Xruntime', 'rf')
let &rtp = rtp_save
endfunc
+
+ func Test_help_completion()
+ call feedkeys(":help :undo\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"help :undo :undoj :undol :undojoin :undolist', @:)
+ endfunc
*** ../vim-8.2.0048/src/testdir/test_menu.vim 2019-12-10 22:02:30.000000000 +0100
--- src/testdir/test_menu.vim 2019-12-27 17:17:05.418680032 +0100
***************
*** 45,50 ****
--- 45,54 ----
imenu 2 Test.FooBar :let g:did_menu = 'insert'<CR>
cmenu 2 Test.FooBar :let g:did_menu = 'cmdline'<CR>
emenu n Test.FooBar
+
+ call feedkeys(":menu Test.FooB\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"menu Test.FooBar', @:)
+
call assert_equal('normal', g:did_menu)
emenu v Test.FooBar
call assert_equal('visual', g:did_menu)
*** ../vim-8.2.0048/src/testdir/test_options.vim 2019-12-27 13:49:19.988946876 +0100
--- src/testdir/test_options.vim 2019-12-27 17:17:05.418680032 +0100
***************
*** 201,206 ****
--- 201,212 ----
call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:)

+ call feedkeys(":setlocal di\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"setlocal dictionary diff diffexpr diffopt digraph directory display', @:)
+
+ call feedkeys(":setglobal di\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"setglobal dictionary diff diffexpr diffopt digraph directory display', @:)
+
" Expand boolan options. When doing :set no<Tab>
" vim displays the options names without "no" but completion uses "no...".
call feedkeys(":set nodi\<C-A>\<C-B>\"\<CR>", 'tx')
***************
*** 239,244 ****
--- 245,251 ----

call feedkeys(":set tags=./\\\\ dif\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set tags=./\\ diff diffexpr diffopt', @:)
+
set tags&
endfunc

*** ../vim-8.2.0048/src/testdir/test_syntax.vim 2019-10-20 14:48:13.000000000 +0200
--- src/testdir/test_syntax.vim 2019-12-27 17:17:05.418680032 +0100
***************
*** 180,185 ****
--- 180,190 ----
call assert_match('^"syn match Boolean Character ', @:)
endfunc

+ func Test_echohl_completion()
+ call feedkeys(":echohl no\<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"echohl NonText Normal none', @:)
+ endfunc
+
func Test_syntax_arg_skipped()
syn clear
syntax case ignore
*** ../vim-8.2.0048/src/version.c 2019-12-27 17:14:28.939200621 +0100
--- src/version.c 2019-12-27 17:18:42.542353952 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 49,
/**/

--
ARTHUR: Well, I AM king...
DENNIS: Oh king, eh, very nice. An' how'd you get that, eh? By exploitin'
the workers -- by 'angin' on to outdated imperialist dogma which
perpetuates the economic an' social differences in our society! If
there's ever going to be any progress--
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Dec 27, 2019, 3:47:43 PM12/27/19
to vim...@googlegroups.com

On Fr, 27 Dez 2019, Bram Moolenaar wrote:

> Patch 8.2.0049
> Problem: Command line completion not fully tested.
> Solution: Add more test cases. Make help sorting stable. (Dominique Pelle,
> closes #5402)
[...]
> + func Test_cmdline_complete_bang()
> + if executable('whoami')
> + return
> + endif
> + call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
> + call assert_match('^".*\<whoami\>', @:)
> + endfunc

That condition is backwards.

Best
Christian
--
Tief und ernstlich denkende Menschen haben gegen das Publikum
einen bösen Stand.
-- Goethe, Maximen und Reflektionen, Nr. 61

Dominique Pellé

unread,
Dec 28, 2019, 4:02:06 AM12/28/19
to vim_dev
Christian Brabandt <cbl...@256bit.org> wrote:

> On Fr, 27 Dez 2019, Bram Moolenaar wrote:
>
> > Patch 8.2.0049
> > Problem: Command line completion not fully tested.
> > Solution: Add more test cases. Make help sorting stable. (Dominique Pelle,
> > closes #5402)
> [...]
> > + func Test_cmdline_complete_bang()
> > + if executable('whoami')
> > + return
> > + endif
> > + call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
> > + call assert_match('^".*\<whoami\>', @:)
> > + endfunc
>
> That condition is backwards.
>
> Best
> Christian

Thanks. You're right. At first I could not see it.
But the line `if executable('whoami')` should of course
be `if !executable('whoami')`. This is the piece
of code that is not covered as a result:

https://codecov.io/gh/vim/vim/src/297610ba4b110c918ffe60c45eb4a1d6ea2daae5/src/cmdexpand.c#L1270

Regards
Dominique

Bram Moolenaar

unread,
Dec 28, 2019, 8:07:36 AM12/28/19
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> On Fr, 27 Dez 2019, Bram Moolenaar wrote:
>
> > Patch 8.2.0049
> > Problem: Command line completion not fully tested.
> > Solution: Add more test cases. Make help sorting stable. (Dominique Pelle,
> > closes #5402)
> [...]
> > + func Test_cmdline_complete_bang()
> > + if executable('whoami')
> > + return
> > + endif
> > + call feedkeys(":!whoam\<C-A>\<C-B>\"\<CR>", 'tx')
> > + call assert_match('^".*\<whoami\>', @:)
> > + endfunc
>
> That condition is backwards.

Well spotted. I'll fix it.

--
WOMAN: Dennis, there's some lovely filth down here. Oh -- how d'you do?
ARTHUR: How do you do, good lady. I am Arthur, King of the Britons.
Who's castle is that?
WOMAN: King of the who?
Reply all
Reply to author
Forward
0 new messages