Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 19437:5d34ae66118e v8.2.0276
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Commit: https://github.com/vim/vim/commit/38a5f517a70d7b76361152d2898d7f826c5b2491
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 19 12:40:39 2020 +0100
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Problem: Vim9: not allowing space before ")" in function call is too
restrictive. (Ben Jackson)
Solution: Skip space before the ")". Adjust other space checks.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 19 Feb 2020 12:45:04 +0100 |
parents | f3e8e74cb747 |
children | f8408ba21982 |
comparison
equal
deleted
inserted
replaced
19436:d44f610825c1 | 19437:5d34ae66118e |
---|---|
4 | 4 |
5 " Check that "line" inside ":def" results in an "error" message. | 5 " Check that "line" inside ":def" results in an "error" message. |
6 func CheckDefFailure(line, error) | 6 func CheckDefFailure(line, error) |
7 call writefile(['def! Func()', a:line, 'enddef'], 'Xdef') | 7 call writefile(['def! Func()', a:line, 'enddef'], 'Xdef') |
8 call assert_fails('so Xdef', a:error, a:line) | 8 call assert_fails('so Xdef', a:error, a:line) |
9 call delete('Xdef') | |
10 endfunc | |
11 | |
12 " Check that "line" inside ":def" results in an "error" message when executed. | |
13 func CheckDefExecFailure(line, error) | |
14 call writefile(['def! Func()', a:line, 'enddef'], 'Xdef') | |
15 so Xdef | |
16 call assert_fails('call Func()', a:error, a:line) | |
9 call delete('Xdef') | 17 call delete('Xdef') |
10 endfunc | 18 endfunc |
11 | 19 |
12 func CheckDefFailureList(lines, error) | 20 func CheckDefFailureList(lines, error) |
13 call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef') | 21 call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef') |
723 | 731 |
724 func CallMe(arg) | 732 func CallMe(arg) |
725 return a:arg | 733 return a:arg |
726 endfunc | 734 endfunc |
727 | 735 |
736 func CallMe2(one, two) | |
737 return a:one .. a:two | |
738 endfunc | |
739 | |
728 def Test_expr7_trailing() | 740 def Test_expr7_trailing() |
729 " user function call | 741 " user function call |
730 assert_equal(123, CallMe(123)) | 742 assert_equal(123, CallMe(123)) |
743 assert_equal(123, CallMe( 123)) | |
744 assert_equal(123, CallMe(123 )) | |
745 assert_equal('yesno', CallMe2('yes', 'no')) | |
746 assert_equal('yesno', CallMe2( 'yes', 'no' )) | |
731 assert_equal('nothing', CallMe('nothing')) | 747 assert_equal('nothing', CallMe('nothing')) |
732 | 748 |
733 " partial call | 749 " partial call |
734 let Part = function('CallMe') | 750 let Part = function('CallMe') |
735 assert_equal('yes', Part('yes')) | 751 assert_equal('yes', Part('yes')) |
759 endfunc | 775 endfunc |
760 | 776 |
761 func Test_expr_fails() | 777 func Test_expr_fails() |
762 call CheckDefFailure("let x = '1'is2", 'E488:') | 778 call CheckDefFailure("let x = '1'is2", 'E488:') |
763 call CheckDefFailure("let x = '1'isnot2", 'E488:') | 779 call CheckDefFailure("let x = '1'isnot2", 'E488:') |
764 endfunc | 780 |
781 call CheckDefExecFailure("CallMe ('yes')", 'E492:') | |
782 call CheckDefFailure("CallMe2('yes','no')", 'E1069:') | |
783 call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:') | |
784 endfunc |