Skip to content

Commit 5f8f2d3

Browse files
committed
patch 8.1.0085: no test for completing user name and language
Problem: No test for completing user name and language. Solution: Add tests. (Dominique Pelle, closes #2978)
1 parent 828c3d7 commit 5f8f2d3

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

src/testdir/test_cmdline.vim

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
" Tests for editing the command line.
22

3-
43
func Test_complete_tab()
54
call writefile(['testfile'], 'Xtestfile')
65
call feedkeys(":e Xtest\t\r", "tx")
@@ -392,6 +391,50 @@ func Test_cmdline_complete_user_cmd()
392391
delcommand Foo
393392
endfunc
394393

394+
func Test_cmdline_complete_user_names()
395+
if has('unix') && executable('whoami')
396+
let whoami = systemlist('whoami')[0]
397+
let first_letter = whoami[0]
398+
if len(first_letter) > 0
399+
" Trying completion of :e ~x where x is the first letter of
400+
" the user name should complete to at least the user name.
401+
call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx')
402+
call assert_match('^"e \~.*\<' . whoami . '\>', @:)
403+
endif
404+
endif
405+
if has('win32')
406+
" Just in case: check that the system has an Administrator account.
407+
let names = system('net user')
408+
if names =~ 'Administrator'
409+
" Trying completion of :e ~A should complete to Administrator.
410+
call feedkeys(':e ~A' . "\<c-a>\<c-B>\"\<cr>", 'tx')
411+
call assert_match('^"e \~Administrator', @:)
412+
endif
413+
endif
414+
endfunc
415+
416+
funct Test_cmdline_complete_languages()
417+
let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '')
418+
419+
call feedkeys(":language \<c-a>\<c-b>\"\<cr>", 'tx')
420+
call assert_match('^"language .*\<ctype\>.*\<messages\>.*\<time\>', @:)
421+
422+
if has('unix')
423+
" TODO: these tests don't work on Windows. lang appears to be 'C'
424+
" but C does not appear in the completion. Why?
425+
call assert_match('^"language .*\<' . lang . '\>', @:)
426+
427+
call feedkeys(":language messages \<c-a>\<c-b>\"\<cr>", 'tx')
428+
call assert_match('^"language .*\<' . lang . '\>', @:)
429+
430+
call feedkeys(":language ctype \<c-a>\<c-b>\"\<cr>", 'tx')
431+
call assert_match('^"language .*\<' . lang . '\>', @:)
432+
433+
call feedkeys(":language time \<c-a>\<c-b>\"\<cr>", 'tx')
434+
call assert_match('^"language .*\<' . lang . '\>', @:)
435+
endif
436+
endfunc
437+
395438
func Test_cmdline_write_alternatefile()
396439
new
397440
call setline('.', ['one', 'two'])

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
85,
764766
/**/
765767
84,
766768
/**/

0 commit comments

Comments
 (0)