Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 14135:ee649db58c41 v8.1.0085
patch 8.1.0085: no test for completing user name and language
commit https://github.com/vim/vim/commit/5f8f2d378a4f6d7db12806f3e35ec6f7fc6bd1f3
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 19 19:09:09 2018 +0200
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 https://github.com/vim/vim/issues/2978)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Jun 2018 19:15:06 +0200 |
parents | c3f9c37160e7 |
children | 3ca818b65cde |
comparison
equal
deleted
inserted
replaced
14134:ca2908f449ca | 14135:ee649db58c41 |
---|---|
1 " Tests for editing the command line. | 1 " Tests for editing the command line. |
2 | |
3 | 2 |
4 func Test_complete_tab() | 3 func Test_complete_tab() |
5 call writefile(['testfile'], 'Xtestfile') | 4 call writefile(['testfile'], 'Xtestfile') |
6 call feedkeys(":e Xtest\t\r", "tx") | 5 call feedkeys(":e Xtest\t\r", "tx") |
7 call assert_equal('testfile', getline(1)) | 6 call assert_equal('testfile', getline(1)) |
390 call feedkeys(":Foo b\<Tab>\<Home>\"\<cr>", 'tx') | 389 call feedkeys(":Foo b\<Tab>\<Home>\"\<cr>", 'tx') |
391 call assert_equal('"Foo blue', @:) | 390 call assert_equal('"Foo blue', @:) |
392 delcommand Foo | 391 delcommand Foo |
393 endfunc | 392 endfunc |
394 | 393 |
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 | |
395 func Test_cmdline_write_alternatefile() | 438 func Test_cmdline_write_alternatefile() |
396 new | 439 new |
397 call setline('.', ['one', 'two']) | 440 call setline('.', ['one', 'two']) |
398 f foo.txt | 441 f foo.txt |
399 new | 442 new |