Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 20015:c001ee73519a v8.2.0563
patch 8.2.0563: Vim9: cannot split a function line
Commit: https://github.com/vim/vim/commit/5e774c7579a4a00d3f44fdcfcb56861bd73372e4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 12 21:53:00 2020 +0200
patch 8.2.0563: Vim9: cannot split a function line
Problem: Vim9: cannot split a function line.
Solution: Continue in next line so long as the function isn't done.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 12 Apr 2020 22:00:04 +0200 |
parents | efe864a7ce4f |
children | ee823254dda5 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -561,6 +561,22 @@ def Test_func_return_type() CheckDefFailure(['let str: string', 'str = FuncNoArgRetNumber()'], 'E1013: type mismatch, expected string but got number') enddef +def MultiLine( + arg1: string, + arg2 = 1234, + ...rest: list<string> + ): string + return arg1 .. arg2 .. join(rest, '-') +enddef + +def Test_multiline() + assert_equal('text1234', MultiLine('text')) + assert_equal('text777', MultiLine('text', 777)) + assert_equal('text777one', MultiLine('text', 777, 'one')) + assert_equal('text777one-two', MultiLine('text', 777, 'one', 'two')) +enddef + + " When using CheckScriptFailure() for the below test, E1010 is generated instead " of E1056. func Test_E1056_1059()