Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 27595:d504745607bc v8.2.4324
patch 8.2.4324: Vim9: script-local function name can start with "_"
Commit: https://github.com/vim/vim/commit/3787f26c2ed33732a36f26ebe46faeebfe0151af
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 7 21:54:01 2022 +0000
patch 8.2.4324: Vim9: script-local function name can start with "_"
Problem: Vim9: script-local function name can start with "_".
Solution: Check for leading capital after "s:". Correct error message.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 07 Feb 2022 23:00:03 +0100 |
parents | 8c7836f8668d |
children | 766a329fe5bb |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -97,7 +97,7 @@ def Test_wrong_function_name() echo 'foo' endfunc END - v9.CheckScriptFailure(lines, 'E128:') + v9.CheckScriptFailure(lines, 'E1267:') lines =<< trim END vim9script @@ -105,7 +105,7 @@ def Test_wrong_function_name() echo 'foo' enddef END - v9.CheckScriptFailure(lines, 'E128:') + v9.CheckScriptFailure(lines, 'E1267:') enddef def Test_autoload_name_mismatch() @@ -685,11 +685,11 @@ def Test_nested_function() def _Inner() echo 'bad' enddef - Inner() + _Inner() enddef defcompile END - v9.CheckScriptFailure(lines, 'E128:') + v9.CheckScriptFailure(lines, 'E1267:') lines =<< trim END vim9script @@ -697,11 +697,27 @@ def Test_nested_function() def g:inner() echo 'bad' enddef - Inner() + g:inner() enddef defcompile END - v9.CheckScriptFailure(lines, 'E128:') + v9.CheckScriptFailure(lines, 'E1267:') + + lines =<< trim END + vim9script + def g:_Func() + echo 'bad' + enddef + END + v9.CheckScriptFailure(lines, 'E1267:') + + lines =<< trim END + vim9script + def s:_Func() + echo 'bad' + enddef + END + v9.CheckScriptFailure(lines, 'E1267:') # nested function inside conditional lines =<< trim END @@ -2772,7 +2788,7 @@ def Test_nested_inline_lambda() lines =<< trim END vim9script - def s:func() + def s:Func() range(10) ->mapnew((_, _) => ({ key: range(10)->mapnew((_, _) => {