diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:10:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 02:10:58 +0000 |
commit | bee19c22d569e54513a9c591441c7f411811dc81 (patch) | |
tree | b990d2df9fddb8194bfe49e9205005a0d952bc1f /src/testdir/test_functions.vim | |
parent | Adding upstream version 2:9.1.0199. (diff) | |
download | vim-bee19c22d569e54513a9c591441c7f411811dc81.tar.xz vim-bee19c22d569e54513a9c591441c7f411811dc81.zip |
Adding upstream version 2:9.1.0374.upstream/2%9.1.0374
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r-- | src/testdir/test_functions.vim | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index fecebc4..f0d7385 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -3794,6 +3794,43 @@ func Test_funcref_to_string() call assert_equal("function('g:Test_funcref_to_string')", string(Fn)) endfunc +" A funcref cannot start with an underscore (except when used as a protected +" class or object variable) +func Test_funcref_with_underscore() + " at script level + let lines =<< trim END + vim9script + var _Fn = () => 10 + END + call v9.CheckSourceFailure(lines, 'E704: Funcref variable name must start with a capital: _Fn') + + " inside a function + let lines =<< trim END + vim9script + def Func() + var _Fn = () => 10 + enddef + defcompile + END + call v9.CheckSourceFailure(lines, 'E704: Funcref variable name must start with a capital: _Fn', 1) + + " as a function argument + let lines =<< trim END + vim9script + def Func(_Fn: func) + enddef + defcompile + END + call v9.CheckSourceFailure(lines, 'E704: Funcref variable name must start with a capital: _Fn', 2) + + " as a lambda argument + let lines =<< trim END + vim9script + var Fn = (_Farg: func) => 10 + END + call v9.CheckSourceFailure(lines, 'E704: Funcref variable name must start with a capital: _Farg', 2) +endfunc + " Test for isabsolutepath() func Test_isabsolutepath() call assert_false(isabsolutepath('')) |