To: vim_dev@googlegroups.com Subject: Patch 8.2.0049 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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\\\"\", '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\\\"\", 'tx') + call assert_match('^".*\', @:) + 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\\\"\", '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\\\"\", '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' cmenu 2 Test.FooBar :let g:did_menu = 'cmdline' emenu n Test.FooBar + + call feedkeys(":menu Test.FooB\\\"\", '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\\\"\", 'tx') call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:) + call feedkeys(":setlocal di\\\"\", 'tx') + call assert_equal('"setlocal dictionary diff diffexpr diffopt digraph directory display', @:) + + call feedkeys(":setglobal di\\\"\", 'tx') + call assert_equal('"setglobal dictionary diff diffexpr diffopt digraph directory display', @:) + " Expand boolan options. When doing :set no " vim displays the options names without "no" but completion uses "no...". call feedkeys(":set nodi\\\"\", 'tx') *************** *** 239,244 **** --- 245,251 ---- call feedkeys(":set tags=./\\\\ dif\\\"\", '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\\\"\", '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 -- Bram@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 ///