|
1 | 1 | " Tests for editing the command line.
|
2 | 2 |
|
3 |
| - |
4 | 3 | func Test_complete_tab()
|
5 | 4 | call writefile(['testfile'], 'Xtestfile')
|
6 | 5 | call feedkeys(":e Xtest\t\r", "tx")
|
@@ -392,6 +391,50 @@ func Test_cmdline_complete_user_cmd()
|
392 | 391 | delcommand Foo
|
393 | 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 | 438 | func Test_cmdline_write_alternatefile()
|
396 | 439 | new
|
397 | 440 | call setline('.', ['one', 'two'])
|
|
0 commit comments