diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-10-17 01:19:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-17 01:19:30 -0700 |
commit | 94bda2fec8d03cdbea442d70c41186f0aa039786 (patch) | |
tree | ab9724bfdc987d314b4e38350b6ad7cd12f8b64a /src/nvim/testdir | |
parent | 913d01bb03616f3bb7468490573a1579d62debbe (diff) | |
parent | 8add4cb8fd39b0f6462f0dc064c7534d66326faf (diff) | |
download | rneovim-94bda2fec8d03cdbea442d70c41186f0aa039786.tar.gz rneovim-94bda2fec8d03cdbea442d70c41186f0aa039786.tar.bz2 rneovim-94bda2fec8d03cdbea442d70c41186f0aa039786.zip |
Merge #11215 from erw7/vim-8.1.0084
vim-patch:8.1.{84,85,361}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index e6aafd964b..0a3e6ae625 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -1,6 +1,5 @@ " Tests for editing the command line. - func Test_complete_tab() call writefile(['testfile'], 'Xtestfile') call feedkeys(":e Xtestf\t\r", "tx") @@ -477,6 +476,50 @@ func Test_cmdline_complete_user_cmd() delcommand Foo endfunc +func Test_cmdline_complete_user_names() + if has('unix') && executable('whoami') + let whoami = systemlist('whoami')[0] + let first_letter = whoami[0] + if len(first_letter) > 0 + " Trying completion of :e ~x where x is the first letter of + " the user name should complete to at least the user name. + call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx') + call assert_match('^"e \~.*\<' . whoami . '\>', @:) + endif + endif + if has('win32') + " Just in case: check that the system has an Administrator account. + let names = system('net user') + if names =~ 'Administrator' + " Trying completion of :e ~A should complete to Administrator. + call feedkeys(':e ~A' . "\<c-a>\<c-B>\"\<cr>", 'tx') + call assert_match('^"e \~Administrator', @:) + endif + endif +endfunc + +funct Test_cmdline_complete_languages() + let lang = substitute(execute('language messages'), '.*"\(.*\)"$', '\1', '') + + call feedkeys(":language \<c-a>\<c-b>\"\<cr>", 'tx') + call assert_match('^"language .*\<ctype\>.*\<messages\>.*\<time\>', @:) + + if has('unix') + " TODO: these tests don't work on Windows. lang appears to be 'C' + " but C does not appear in the completion. Why? + call assert_match('^"language .*\<' . lang . '\>', @:) + + call feedkeys(":language messages \<c-a>\<c-b>\"\<cr>", 'tx') + call assert_match('^"language .*\<' . lang . '\>', @:) + + call feedkeys(":language ctype \<c-a>\<c-b>\"\<cr>", 'tx') + call assert_match('^"language .*\<' . lang . '\>', @:) + + call feedkeys(":language time \<c-a>\<c-b>\"\<cr>", 'tx') + call assert_match('^"language .*\<' . lang . '\>', @:) + endif +endfunc + func Test_cmdline_write_alternatefile() new call setline('.', ['one', 'two']) |