1
0
forked from aniani/vim

patch 8.2.4602: Vim9: not enough test coverage for executing :def function

Problem:    Vim9: not enough test coverage for executing :def function.
Solution:   Add a few more tests.  Fix uncovered problem.  Remove dead code.
This commit is contained in:
Bram Moolenaar
2022-03-20 21:14:15 +00:00
parent efd73ae5d2
commit 397a87ac1c
8 changed files with 82 additions and 52 deletions

View File

@@ -3312,6 +3312,29 @@ def Test_expr8_call_global()
v9.CheckDefAndScriptFailure(lines, 'E117: Unknown function: ExistingGlobal')
enddef
def Test_expr8_autoload_var()
var auto_lines =<< trim END
let autofile#var = 'found'
END
mkdir('Xruntime/autoload', 'p')
writefile(auto_lines, 'Xruntime/autoload/autofile.vim')
var save_rtp = &rtp
&rtp = getcwd() .. '/Xruntime,' .. &rtp
var lines =<< trim END
assert_equal('found', autofile#var)
END
v9.CheckDefAndScriptSuccess(lines)
lines =<< trim END
echo autofile#other
END
v9.CheckDefExecAndScriptFailure(lines, 'E121: Undefined variable: autofile#other')
&rtp = save_rtp
delete('Xruntime', 'rf')
enddef
def Test_expr8_call_autoload()
var auto_lines =<< trim END
def g:some#func(): string