From d13222649a2145272f14675d9bbf64bb72c43f64 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 08:58:37 +0800 Subject: vim-patch:8.2.1945: crash when passing NULL function to reduce() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Crash when passing NULL function to reduce(). Solution: Check for NULL pointer and give an error. (Dominique Pellé, closes vim/vim#7243) https://github.com/vim/vim/commit/0d90e728fe089ff1bb34d6a17f5591a96b57f734 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_listdict.vim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index ba95e2ea9a..41ea04c755 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -747,6 +747,10 @@ func Test_reduce() call assert_equal(42, reduce(v:_null_list, function('add'), 42)) call assert_equal(42, reduce(v:_null_blob, function('add'), 42)) + + " should not crash + " Nvim doesn't have null functions + " call assert_fails('echo reduce([1], test_null_function())', 'E1132:') endfunc " splitting a string to a List using split() -- cgit From 08121ef69f47f8ad8f8903a732920412e24d30c1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 08:55:42 +0800 Subject: vim-patch:8.2.2848: crash whn calling partial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Crash whn calling partial. Solution: Check for NULL pointer. (Dominique Pellé, closes vim/vim#8202) https://github.com/vim/vim/commit/fe8ebdbe5c4e116311c0c0d5937b89ded5c92d01 Co-authored-by: Dominique Pelle --- test/old/testdir/test_functions.vim | 6 ++++++ test/old/testdir/test_listdict.vim | 2 ++ 2 files changed, 8 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index ad2b6dc563..3144af83d7 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2009,6 +2009,12 @@ func Test_call() eval mydict.len->call([], mydict)->assert_equal(4) call assert_fails("call call('Mylen', [], 0)", 'E715:') call assert_fails('call foo', 'E107:') + + " This once caused a crash. + " Nvim doesn't have null functions + " call call(test_null_function(), []) + " Nvim doesn't have null partials + " call call(test_null_partial(), []) endfunc func Test_char2nr() diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 41ea04c755..cbed71bb0a 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -751,6 +751,8 @@ func Test_reduce() " should not crash " Nvim doesn't have null functions " call assert_fails('echo reduce([1], test_null_function())', 'E1132:') + " Nvim doesn't have null partials + " call assert_fails('echo reduce([1], test_null_partial())', 'E1132:') endfunc " splitting a string to a List using split() -- cgit From f4d3e279e861dc37dd047c81a0807767a74d251b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 09:01:33 +0800 Subject: vim-patch:8.2.2977: crash when using a null function reference Problem: Crash when using a null function reference. (Naohiro Ono) Solution: Check for an invalid function name. (closes vim/vim#8367) https://github.com/vim/vim/commit/22db0d549f64aa3d8a6e366b70eb8d7e66933b82 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_functions.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 3144af83d7..abea3b2538 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2010,11 +2010,15 @@ func Test_call() call assert_fails("call call('Mylen', [], 0)", 'E715:') call assert_fails('call foo', 'E107:') - " This once caused a crash. + " These once caused a crash. " Nvim doesn't have null functions " call call(test_null_function(), []) " Nvim doesn't have null partials " call call(test_null_partial(), []) + " Nvim doesn't have null functions + " call assert_fails('call test_null_function()()', 'E1192:') + " Nvim doesn't have null partials + " call assert_fails('call test_null_partial()()', 'E117:') endfunc func Test_char2nr() -- cgit From 68ca16c376bd8786ffc0c7ce7619b9a0ce5657e8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 08:54:07 +0800 Subject: vim-patch:8.2.3783: confusing error for using a variable as a function Problem: Confusing error for using a variable as a function. Solution: If a function is not found but there is a variable, give a more useful error. (issue vim/vim#9310) https://github.com/vim/vim/commit/2ef9156b4284e4a52613c36e3d4667245273a28d Co-authored-by: Bram Moolenaar --- test/functional/lua/luaeval_spec.lua | 4 ++-- test/old/testdir/test_functions.vim | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index 9f313eab9e..32bb894be1 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -545,7 +545,7 @@ describe('v:lua', function() eq("Vim:E15: Invalid expression: v:['lua'].foo()", pcall_err(eval, "v:['lua'].foo()")) eq("Vim(call):E461: Illegal variable name: v:['lua']", pcall_err(command, "call v:['lua'].baar()")) - eq("Vim:E117: Unknown function: v:lua", pcall_err(eval, "v:lua()")) + eq("Vim:E1085: Not a callable type: v:lua", pcall_err(eval, "v:lua()")) eq("Vim(let):E46: Cannot change read-only variable \"v:['lua']\"", pcall_err(command, "let v:['lua'] = 'xx'")) eq("Vim(let):E46: Cannot change read-only variable \"v:lua\"", pcall_err(command, "let v:lua = 'xx'")) @@ -553,7 +553,7 @@ describe('v:lua', function() eq("Vim:E107: Missing parentheses: v:lua.func", pcall_err(eval, "'bad'->v:lua.func")) eq("Vim:E274: No white space allowed before parenthesis", pcall_err(eval, "'bad'->v:lua.func ()")) eq("Vim:E107: Missing parentheses: v:lua", pcall_err(eval, "'bad'->v:lua")) - eq("Vim:E117: Unknown function: v:lua", pcall_err(eval, "'bad'->v:lua()")) + eq("Vim:E1085: Not a callable type: v:lua", pcall_err(eval, "'bad'->v:lua()")) eq("Vim:E15: Invalid expression: v:lua.()", pcall_err(eval, "'bad'->v:lua.()")) end) end) diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index abea3b2538..fb53248d5a 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2019,6 +2019,12 @@ func Test_call() " call assert_fails('call test_null_function()()', 'E1192:') " Nvim doesn't have null partials " call assert_fails('call test_null_partial()()', 'E117:') + + let lines =<< trim END + let Time = 'localtime' + call Time() + END + CheckScriptFailure(lines, 'E1085:') endfunc func Test_char2nr() -- cgit From d7965293ec18314df284ef53c363b73c2f3c1db8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 16 Apr 2023 09:29:41 +0800 Subject: vim-patch:8.2.3786: test fails because of using Vim9 syntax in legacy function Problem: Test fails because of using Vim9 syntax in legacy function. Solution: Add "call". https://github.com/vim/vim/commit/4f16e9de985c5178e9cf15d69facfec6f15a5e09 Add test_nested_function.vim changes from patches 8.{0.0141,2.1432}. Co-authored-by: Bram Moolenaar --- test/old/testdir/test_functions.vim | 2 +- test/old/testdir/test_nested_function.vim | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index fb53248d5a..7d3d74caad 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2024,7 +2024,7 @@ func Test_call() let Time = 'localtime' call Time() END - CheckScriptFailure(lines, 'E1085:') + call CheckScriptFailure(lines, 'E1085:') endfunc func Test_char2nr() diff --git a/test/old/testdir/test_nested_function.vim b/test/old/testdir/test_nested_function.vim index afaaea6ceb..5599655461 100644 --- a/test/old/testdir/test_nested_function.vim +++ b/test/old/testdir/test_nested_function.vim @@ -1,5 +1,7 @@ -"Tests for nested functions -" +" Tests for nested functions + +source check.vim + func NestedFunc() func! Func1() let g:text .= 'Func1 ' @@ -48,6 +50,9 @@ func Recurse(count) endfunc func Test_max_nesting() + " TODO: why does this fail on Windows? Runs out of stack perhaps? + CheckNotMSWindows + let call_depth_here = 2 let ex_depth_here = 5 set mfd& @@ -61,3 +66,5 @@ func Test_max_nesting() set mfd& endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit