aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_expr.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-03 04:26:00 +0800
committerGitHub <noreply@github.com>2022-12-03 04:26:00 +0800
commit10c50d9f30138e7811789ba1c62f4c520cf04c8f (patch)
tree6be3628f7d152c1f703f59fa1050039c90244707 /src/nvim/testdir/test_expr.vim
parent07e6296520fc83b1fdb287b5173494cdd0e9136f (diff)
parentafb3ff52ecafe2d5bd1239869124794bb2ac68b9 (diff)
downloadrneovim-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/test_expr.vim')
-rw-r--r--src/nvim/testdir/test_expr.vim15
1 files changed, 15 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