aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-16 10:42:11 +0800
committerGitHub <noreply@github.com>2023-04-16 10:42:11 +0800
commit54dab9ed9e200f7c5bcac4a8f4901770fa15fa4f (patch)
treee07099845b2da8889f38a6f742ca8901f439782c /test
parent6adfd24a066c207334609a6b149ada19c0f568d4 (diff)
parentd7965293ec18314df284ef53c363b73c2f3c1db8 (diff)
downloadrneovim-54dab9ed9e200f7c5bcac4a8f4901770fa15fa4f.tar.gz
rneovim-54dab9ed9e200f7c5bcac4a8f4901770fa15fa4f.tar.bz2
rneovim-54dab9ed9e200f7c5bcac4a8f4901770fa15fa4f.zip
Merge pull request #23118 from zeertzjq/vim-8.2.3783
vim-patch:8.2.{1945,2848,2977,2978,3783,3786}
Diffstat (limited to 'test')
-rw-r--r--test/functional/lua/luaeval_spec.lua4
-rw-r--r--test/old/testdir/test_functions.vim16
-rw-r--r--test/old/testdir/test_listdict.vim6
-rw-r--r--test/old/testdir/test_nested_function.vim11
4 files changed, 33 insertions, 4 deletions
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 ad2b6dc563..7d3d74caad 100644
--- a/test/old/testdir/test_functions.vim
+++ b/test/old/testdir/test_functions.vim
@@ -2009,6 +2009,22 @@ 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:')
+
+ " 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:')
+
+ let lines =<< trim END
+ let Time = 'localtime'
+ call Time()
+ END
+ call CheckScriptFailure(lines, 'E1085:')
endfunc
func Test_char2nr()
diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim
index ba95e2ea9a..cbed71bb0a 100644
--- a/test/old/testdir/test_listdict.vim
+++ b/test/old/testdir/test_listdict.vim
@@ -747,6 +747,12 @@ 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:')
+ " 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()
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