diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-31 22:51:29 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-10-03 20:06:32 +0100 |
commit | 59c8a1fd5158886cb13b56070ebf15259d12eba2 (patch) | |
tree | 9f38ebf07476c8d4f3e9baa5801ed787ff197a04 /src/nvim/testdir/test_functions.vim | |
parent | 8b7615c735325245cff20907fbd7e0470a0d00d0 (diff) | |
download | rneovim-59c8a1fd5158886cb13b56070ebf15259d12eba2.tar.gz rneovim-59c8a1fd5158886cb13b56070ebf15259d12eba2.tar.bz2 rneovim-59c8a1fd5158886cb13b56070ebf15259d12eba2.zip |
feat(eval/method): partially port v8.1.1953
Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:
- index(): requires Blobs from v8.1.0735.
Note that index() was already added as a method in v8.1.1803;
this patch only adds a test.
- iconv(): requires v8.1.1136 for test_termcodes.vim.
Nvim deprecated inputdialog(), so it no longer has an eval.txt entry.
Keep the test for hlexists() commented-out, just like previously. (Nvim
always defines the Number group, so it always returns 1 instead)
Cannot include both changes to test_syn_attr.vim as Nvim doesn't support
":hi term=..."; however, both test the same ->hlID() syntax anyway.
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index e3a80be6d5..90732549de 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -1127,7 +1127,7 @@ endfunc func Test_hlexists() call assert_equal(0, hlexists('does_not_exist')) - " call assert_equal(0, hlexists('Number')) + " call assert_equal(0, 'Number'->hlexists()) call assert_equal(0, highlight_exists('does_not_exist')) " call assert_equal(0, highlight_exists('Number')) syntax on @@ -1160,7 +1160,7 @@ endfunc func Test_inputlist() call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<cr>", 'tx') call assert_equal(1, c) - call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>2\<cr>", 'tx') + call feedkeys(":let c = ['Select color:', '1. red', '2. green', '3. blue']->inputlist()\<cr>2\<cr>", 'tx') call assert_equal(2, c) call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>3\<cr>", 'tx') call assert_equal(3, c) @@ -1413,7 +1413,7 @@ func Test_reg_executing_and_recording() let g:regs = [] func TestFunc() abort let g:regs += [reg_executing()] - let g:typed = input('?') + let g:typed = '?'->input() let g:regs += [reg_executing()] endfunc call feedkeys("@qy\<CR>", 'xt') @@ -1429,6 +1429,25 @@ func Test_reg_executing_and_recording() unlet s:reg_stat endfunc +func Test_inputsecret() + map W :call TestFunc()<CR> + let @q = "W" + let g:typed1 = '' + let g:typed2 = '' + let g:regs = [] + func TestFunc() abort + let g:typed1 = '?'->inputsecret() + let g:typed2 = inputsecret('password: ') + endfunc + call feedkeys("@qsomething\<CR>else\<CR>", 'xt') + call assert_equal("something", g:typed1) + call assert_equal("else", g:typed2) + delfunc TestFunc + unmap W + unlet g:typed1 + unlet g:typed2 +endfunc + func Test_getchar() call feedkeys('a', '') call assert_equal(char2nr('a'), getchar()) |