mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 11:56:30 +00:00
tests: endfunc allows uncommented bar
This commit is contained in:
@@ -2,16 +2,11 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
|
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local funcs = helpers.funcs
|
|
||||||
local dedent = helpers.dedent
|
local dedent = helpers.dedent
|
||||||
local redir_exec = helpers.redir_exec
|
local redir_exec = helpers.redir_exec
|
||||||
|
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
local function check_nofunc(fname)
|
|
||||||
eq(0, funcs.exists('*' .. fname))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function check_func(fname, body, indent)
|
local function check_func(fname, body, indent)
|
||||||
if type(body) == 'number' then
|
if type(body) == 'number' then
|
||||||
body = ('return %i'):format(body)
|
body = ('return %i'):format(body)
|
||||||
@@ -141,12 +136,12 @@ describe(':endfunction', function()
|
|||||||
]]))
|
]]))
|
||||||
check_func('F1', 42)
|
check_func('F1', 42)
|
||||||
end)
|
end)
|
||||||
it('errors out on an uncommented bar', function()
|
it('accepts uncommented bar', function()
|
||||||
eq('\nE488: Trailing characters: | echo 42', redir_exec([[
|
eq('\n42', redir_exec([[
|
||||||
function F1()
|
function F1()
|
||||||
endfunction | echo 42
|
endfunction | echo 42
|
||||||
]]))
|
]]))
|
||||||
check_nofunc('F1')
|
check_func('F1')
|
||||||
end)
|
end)
|
||||||
it('allows running multiple commands', function()
|
it('allows running multiple commands', function()
|
||||||
eq('\n2', redir_exec([[
|
eq('\n2', redir_exec([[
|
||||||
|
Reference in New Issue
Block a user