aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_expr.vim
diff options
context:
space:
mode:
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