mirror of
https://github.com/neovim/neovim.git
synced 2025-10-22 17:11:49 +00:00
functests: Fix legacy/eval_spec
This commit is contained in:
@@ -6,6 +6,7 @@ local clear, command, expect = helpers.clear, helpers.command, helpers.expect
|
|||||||
local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file
|
local eq, eval, write_file = helpers.eq, helpers.eval, helpers.write_file
|
||||||
local wait = helpers.wait
|
local wait = helpers.wait
|
||||||
local exc_exec = helpers.exc_exec
|
local exc_exec = helpers.exc_exec
|
||||||
|
local dedent = helpers.dedent
|
||||||
|
|
||||||
describe('eval', function()
|
describe('eval', function()
|
||||||
setup(function()
|
setup(function()
|
||||||
@@ -617,42 +618,32 @@ describe('eval', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('function name not starting with a capital', function()
|
it('function name not starting with a capital', function()
|
||||||
command('try')
|
eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()\\nendfunction',
|
||||||
command(' func! g:test()')
|
exc_exec(dedent([[
|
||||||
command(' echo "test"')
|
function! g:test()
|
||||||
command(' endfunc')
|
endfunction]])))
|
||||||
command('catch')
|
|
||||||
command(' let tmp = v:exception')
|
|
||||||
command('endtry')
|
|
||||||
eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()', eval('tmp'))
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('Function name followed by #', function()
|
it('Function name followed by #', function()
|
||||||
command('try')
|
eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#\\nendfunction',
|
||||||
command(' func! test2() "#')
|
exc_exec(dedent([[
|
||||||
command(' echo "test2"')
|
function! test2() "#
|
||||||
command(' endfunc')
|
endfunction]])))
|
||||||
command('catch')
|
|
||||||
command(' let tmp = v:exception')
|
|
||||||
command('endtry')
|
|
||||||
eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#', eval('tmp'))
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('function name includes a colon', function()
|
it('function name includes a colon', function()
|
||||||
command('try')
|
eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()\\nendfunction',
|
||||||
command(' func! b:test()')
|
exc_exec(dedent([[
|
||||||
command(' echo "test"')
|
function! b:test()
|
||||||
command(' endfunc')
|
endfunction]])))
|
||||||
command('catch')
|
|
||||||
command(' let tmp = v:exception')
|
|
||||||
command('endtry')
|
|
||||||
eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()', eval('tmp'))
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('function name starting with/without "g:", buffer-local funcref', function()
|
it('function name starting with/without "g:", buffer-local funcref', function()
|
||||||
command('function! g:Foo(n)')
|
command([[
|
||||||
command(" $put ='called Foo(' . a:n . ')'")
|
function! g:Foo(n)
|
||||||
command('endfunction')
|
$put ='called Foo(' . a:n . ')'
|
||||||
|
endfunction
|
||||||
|
]])
|
||||||
command("let b:my_func = function('Foo')")
|
command("let b:my_func = function('Foo')")
|
||||||
command('call b:my_func(1)')
|
command('call b:my_func(1)')
|
||||||
command('echo g:Foo(2)')
|
command('echo g:Foo(2)')
|
||||||
|
Reference in New Issue
Block a user