diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-11-06 11:16:54 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-06 11:16:54 +0800 |
| commit | eb55eba7e5b422301c50088623e60514a843ab08 (patch) | |
| tree | 2fd4f4964889533fc9b72c98ad64d95a6cb70763 /src/nvim/testdir | |
| parent | be90bfbb00436fba68595cc4fd67548df794469d (diff) | |
| parent | d4353c3645f294b67f5b30dae9f39de8f99c7413 (diff) | |
| download | rneovim-eb55eba7e5b422301c50088623e60514a843ab08.tar.gz rneovim-eb55eba7e5b422301c50088623e60514a843ab08.tar.bz2 rneovim-eb55eba7e5b422301c50088623e60514a843ab08.zip | |
Merge pull request #20955 from zeertzjq/vim-8.2.2918
vim-patch:8.2.{2918,2920,2921},9.0.0836: variable can shadow builtin function
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_functions.vim | 42 | ||||
| -rw-r--r-- | src/nvim/testdir/test_let.vim | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index d2603809b9..743022ece4 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -2478,4 +2478,46 @@ func Test_default_arg_value() call assert_equal('msg', HasDefault()) endfunc +" Test for gettext() +func Test_gettext() + call assert_fails('call gettext(1)', 'E475:') +endfunc + +func Test_builtin_check() + call assert_fails('let g:["trim"] = {x -> " " .. x}', 'E704:') + call assert_fails('let g:.trim = {x -> " " .. x}', 'E704:') + call assert_fails('let l:["trim"] = {x -> " " .. x}', 'E704:') + call assert_fails('let l:.trim = {x -> " " .. x}', 'E704:') + let lines =<< trim END + vim9script + var s:trim = (x) => " " .. x + END + " call CheckScriptFailure(lines, 'E704:') + + call assert_fails('call extend(g:, #{foo: { -> "foo" }})', 'E704:') + let g:bar = 123 + call extend(g:, #{bar: { -> "foo" }}, "keep") + call assert_fails('call extend(g:, #{bar: { -> "foo" }}, "force")', 'E704:') + unlet g:bar + + call assert_fails('call extend(l:, #{foo: { -> "foo" }})', 'E704:') + let bar = 123 + call extend(l:, #{bar: { -> "foo" }}, "keep") + call assert_fails('call extend(l:, #{bar: { -> "foo" }}, "force")', 'E704:') + unlet bar + + call assert_fails('call extend(g:, #{foo: function("extend")})', 'E704:') + let g:bar = 123 + call extend(g:, #{bar: function("extend")}, "keep") + call assert_fails('call extend(g:, #{bar: function("extend")}, "force")', 'E704:') + unlet g:bar + + call assert_fails('call extend(l:, #{foo: function("extend")})', 'E704:') + let bar = 123 + call extend(l:, #{bar: function("extend")}, "keep") + call assert_fails('call extend(l:, #{bar: function("extend")}, "force")', 'E704:') + unlet bar +endfunc + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim index 48c5699093..cb883fc238 100644 --- a/src/nvim/testdir/test_let.vim +++ b/src/nvim/testdir/test_let.vim @@ -293,6 +293,7 @@ func Test_let_errors() call assert_fails('let l += 2', 'E734:') call assert_fails('let g:["a;b"] = 10', 'E461:') call assert_fails('let g:.min = function("max")', 'E704:') + call assert_fails('let g:cos = "" | let g:.cos = {-> 42}', 'E704:') if has('channel') let ch = test_null_channel() call assert_fails('let ch += 1', 'E734:') |