diff options
author | ZyX <kp-pav@yandex.ru> | 2017-06-20 18:31:27 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-06-21 10:58:47 +0300 |
commit | ae457ff64a8d6ad322b2d44bde05b28bf14931d9 (patch) | |
tree | 53661c5d417092aff203020ef4b647fe2a5324c5 /test/functional/viml/function_spec.lua | |
parent | 607dc3e0f9119fa4939d9cfa8ee1f7f764c6e530 (diff) | |
download | rneovim-ae457ff64a8d6ad322b2d44bde05b28bf14931d9.tar.gz rneovim-ae457ff64a8d6ad322b2d44bde05b28bf14931d9.tar.bz2 rneovim-ae457ff64a8d6ad322b2d44bde05b28bf14931d9.zip |
functests: Check that minimal distance between commands works
Diffstat (limited to 'test/functional/viml/function_spec.lua')
-rw-r--r-- | test/functional/viml/function_spec.lua | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/test/functional/viml/function_spec.lua b/test/functional/viml/function_spec.lua index c5458e38ea..0cf92f7d40 100644 --- a/test/functional/viml/function_spec.lua +++ b/test/functional/viml/function_spec.lua @@ -12,7 +12,7 @@ local function check_nofunc(fname) eq(0, funcs.exists('*' .. fname)) end -local function check_func(fname, body) +local function check_func(fname, body, indent) if type(body) == 'number' then body = ('return %i'):format(body) end @@ -20,7 +20,9 @@ local function check_func(fname, body) function %s()%s endfunction]] - ), 3):format(fname, body and ('\n1 ' .. body) or ''), + ), 3):format( + fname, + body and ('\n1' .. (' '):rep(2 + (indent or 8)) .. body) or ''), redir_exec('function ' .. fname)) end @@ -172,5 +174,48 @@ describe(':endfunction', function() check_func('F3', 'echo 3') check_func('F4', 'echo 4') end) + it('allows running multiple commands with only one character in between', + function() + eq('\n3', redir_exec(dedent([[ + function! F1() + echo 3 + endfunction! + call F1()]]))) + check_func('F1', 'echo 3', 2) + eq('\n4', redir_exec(dedent([[ + function F5() + echo 4 + endfunction + call F5()]]))) + check_func('F5', 'echo 4', 2) + eq('\n5', redir_exec(dedent([[ + function F6() + echo 5 + endfunction " TEST + call F6()]]))) + check_func('F6', 'echo 5', 2) + eq('\n6', redir_exec(dedent([[ + function F7() + echo 6 + endfunction F7 + call F7()]]))) + check_func('F7', 'echo 6', 2) + eq('\n2\n3\n4', redir_exec(dedent([[ + function F2() + echo 2 + endfunction F2 + function F3() + echo 3 + endfunction " F3 + function! F4() + echo 4 + endfunction! + call F2() + call F3() + call F4()]]))) + check_func('F2', 'echo 2', 2) + check_func('F3', 'echo 3', 2) + check_func('F4', 'echo 4', 2) + end) end) -- vim: foldmarker=▶,▲ |