Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 22908:54219df706b5 v8.2.2001
patch 8.2.2001: Vim9: :def function does not apply 'maxfuncdepth'
Commit: https://github.com/vim/vim/commit/0ba48e8c2741bd65d547fe6bf1d9873f411b25b4
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 17 18:23:19 2020 +0100
patch 8.2.2001: Vim9: :def function does not apply 'maxfuncdepth'
Problem: Vim9: :def function does not apply 'maxfuncdepth'.
Solution: Use 'maxfuncdepth'. (issue https://github.com/vim/vim/issues/7313)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 Nov 2020 18:30:04 +0100 |
parents | 8a5369f5f2b4 |
children | f78057703df9 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -49,6 +49,36 @@ def TestCompilingError() call delete('XTest_compile_error') enddef +def CallRecursive(n: number): number + return CallRecursive(n + 1) +enddef + +def CallMapRecursive(l: list<number>): number + return map(l, {_, v -> CallMapRecursive([v])})[0] +enddef + +def Test_funcdepth_error() + set maxfuncdepth=10 + + var caught = false + try + CallRecursive(1) + catch /E132:/ + caught = true + endtry + assert_true(caught) + + caught = false + try + CallMapRecursive([1]) + catch /E132:/ + caught = true + endtry + assert_true(caught) + + set maxfuncdepth& +enddef + def ReturnString(): string return 'string' enddef