Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 24404:a2a7d2d6e724 v8.2.2742
patch 8.2.2742: Vim9: when compiling a function fails it is cleared
Commit: https://github.com/vim/vim/commit/701cc6ca9e940665a9424541f989bb38c853a498
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 10 13:33:48 2021 +0200
patch 8.2.2742: Vim9: when compiling a function fails it is cleared
Problem: Vim9: when compiling a function fails it is cleared.
Solution: Keep the function lines, prevent execution with a different
status. (closes #8093)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Apr 2021 13:45:05 +0200 |
parents | 009a540f16a6 |
children | a26f0fa12845 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1498,7 +1498,7 @@ def Test_redef_failure() so Xdef delete('Xdef') - g:Func0()->assert_equal(0) + assert_fails('g:Func0()', 'E1091:') g:Func1()->assert_equal('Func1') g:Func2()->assert_equal('Func2') @@ -2591,6 +2591,20 @@ def Test_check_func_arg_types() CheckScriptFailure(lines + ['echo H(G(F2))'], 'E1013:') enddef +def Test_compile_error() + var lines =<< trim END + def g:Broken() + echo 'a' + {} + enddef + call g:Broken() + END + # First call: compilation error + CheckScriptFailure(lines, 'E1051: Wrong argument type for +') + + # Second call won't try compiling again + assert_fails('call g:Broken()', 'E1091: Function is not compiled: Broken') +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker