diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2021-12-24 20:47:38 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-24 20:47:38 +0000 |
commit | e7f4abd38b6e05100c699900c8f87281e363beb2 (patch) | |
tree | badec536bcfe024c7214b18fcce1fa58e5315f80 /src/testdir/test_expr.vim | |
parent | 73a024209cbfbd5b39a2e974084d807c6131e2ed (diff) |
patch 8.2.3889: duplicate code for translating script-local function namev8.2.3889
Problem: Duplicate code for translating script-local function name.
Solution: Move the code to get_scriptlocal_funcname(). (Yegappan Lakshmanan,
closes #9393)
Diffstat (limited to 'src/testdir/test_expr.vim')
-rw-r--r-- | src/testdir/test_expr.vim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index 99cb9a1374..ba2e2597a0 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -639,6 +639,21 @@ func Test_funcref() call assert_fails('echo test_null_function()->funcref()', 'E475: Invalid argument: NULL') 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() let lines =<< trim END hi def link 1 Comment |