diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-03 04:26:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-03 04:26:00 +0800 |
commit | 10c50d9f30138e7811789ba1c62f4c520cf04c8f (patch) | |
tree | 6be3628f7d152c1f703f59fa1050039c90244707 /src/nvim/testdir | |
parent | 07e6296520fc83b1fdb287b5173494cdd0e9136f (diff) | |
parent | afb3ff52ecafe2d5bd1239869124794bb2ac68b9 (diff) | |
download | rneovim-10c50d9f30138e7811789ba1c62f4c520cf04c8f.tar.gz rneovim-10c50d9f30138e7811789ba1c62f4c520cf04c8f.tar.bz2 rneovim-10c50d9f30138e7811789ba1c62f4c520cf04c8f.zip |
Merge pull request #21266 from zeertzjq/vim-8.2.3889
vim-patch:8.2.3889,9.0.{0805,0990}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_expr.vim | 15 | ||||
-rw-r--r-- | src/nvim/testdir/test_normal.vim | 12 | ||||
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 28 |
3 files changed, 55 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index f33358c59a..47f7f5eb0e 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -525,6 +525,21 @@ func Test_funcref() call assert_fails('echo function("min") =~ function("min")', 'E694:') endfunc +" Test for calling function() and funcref() outside of a Vim script context. +func Test_function_outside_script() + let cleanup =<< trim END + call writefile([execute('messages')], 'Xtest.out') + qall + END + call writefile(cleanup, 'Xverify.vim') + call RunVim([], [], "-c \"echo function('s:abc')\" -S Xverify.vim") + call assert_match('E81: Using <SID> not in a', readfile('Xtest.out')[0]) + call RunVim([], [], "-c \"echo funcref('s:abc')\" -S Xverify.vim") + call assert_match('E81: Using <SID> not in a', readfile('Xtest.out')[0]) + call delete('Xtest.out') + call delete('Xverify.vim') +endfunc + func Test_setmatches() hi def link 1 Comment hi def link 2 PreProc diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index d9b392992f..9c5cc51f79 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -658,6 +658,18 @@ func Test_opfunc_callback() END " call CheckScriptSuccess(lines) + " setting 'opfunc' to a script local function outside of a script context + " should fail + let cleanup =<< trim END + call writefile([execute('messages')], 'Xtest.out') + qall + END + call writefile(cleanup, 'Xverify.vim') + call RunVim([], [], "-c \"set opfunc=s:abc\" -S Xverify.vim") + call assert_match('E81: Using <SID> not in a', readfile('Xtest.out')[0]) + call delete('Xtest.out') + call delete('Xverify.vim') + " cleanup set opfunc& delfunc OpFunc1 diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 02cee8a8dd..7b94c4027c 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -3298,6 +3298,21 @@ func Test_resize_from_copen() endtry endfunc +func Test_filetype_autocmd() + " this changes the location list while it is in use to fill a buffer + lexpr '' + lopen + augroup FT_loclist + au FileType * call setloclist(0, [], 'f') + augroup END + silent! lolder + lexpr '' + + augroup FT_loclist + au! FileType + augroup END +endfunc + func Test_vimgrep_with_textlock() new @@ -6165,4 +6180,17 @@ func Test_loclist_replace_autocmd() call setloclist(0, [], 'f') endfunc +func s:QfTf(_) +endfunc + +func Test_setqflist_cb_arg() + " This was changing the callback name in the dictionary. + let d = #{quickfixtextfunc: 's:QfTf'} + call setqflist([], 'a', d) + call assert_equal('s:QfTf', d.quickfixtextfunc) + + call setqflist([], 'f') +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |