Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 22625:0afa30d6dc72 v8.2.1861
patch 8.2.1861: Vim9: no specific error when parsing lambda fails
Commit: https://github.com/vim/vim/commit/a2c026d0fd470d68d679616fddfc285cb4834412
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 18 18:03:17 2020 +0200
patch 8.2.1861: Vim9: no specific error when parsing lambda fails
Problem: Vim9: no specific error when parsing lambda fails.
Solution: Also give syntax errors when not evaluating. (closes https://github.com/vim/vim/issues/7154)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 18 Oct 2020 18:15:03 +0200 |
parents | 336ac63fb987 |
children | 5bd53bf63836 |
comparison
equal
deleted
inserted
replaced
22624:d2b721a599f9 | 22625:0afa30d6dc72 |
---|---|
1803 CheckDefExecFailure(["var s = 'asdf'->{a -> a}('x')"], | 1803 CheckDefExecFailure(["var s = 'asdf'->{a -> a}('x')"], |
1804 'E1106: One argument too many') | 1804 'E1106: One argument too many') |
1805 CheckDefExecFailure(["var s = 'asdf'->{a -> a}('x', 'y')"], | 1805 CheckDefExecFailure(["var s = 'asdf'->{a -> a}('x', 'y')"], |
1806 'E1106: 2 arguments too many') | 1806 'E1106: 2 arguments too many') |
1807 CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:', 1) | 1807 CheckDefFailure(["echo 'asdf'->{a -> a}(x)"], 'E1001:', 1) |
1808 | |
1809 CheckDefSuccess(['var Fx = {a -> #{k1: 0,', ' k2: 1}}']) | |
1810 CheckDefFailure(['var Fx = {a -> #{k1: 0', ' k2: 1}}'], 'E722:', 2) | |
1811 CheckDefFailure(['var Fx = {a -> #{k1: 0,', ' k2 1}}'], 'E720:', 2) | |
1812 | |
1813 CheckDefSuccess(['var Fx = {a -> [0,', ' 1]}']) | |
1814 CheckDefFailure(['var Fx = {a -> [0', ' 1]}'], 'E696:', 2) | |
1808 enddef | 1815 enddef |
1809 | 1816 |
1810 def Test_expr7_lambda_vim9script() | 1817 def Test_expr7_lambda_vim9script() |
1811 var lines =<< trim END | 1818 var lines =<< trim END |
1812 vim9script | 1819 vim9script |
2369 call CheckDefFailure(["var x = ''", "var y = x.memb"], 'E715:', 2) | 2376 call CheckDefFailure(["var x = ''", "var y = x.memb"], 'E715:', 2) |
2370 | 2377 |
2371 call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 1) | 2378 call CheckDefFailure(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 1) |
2372 | 2379 |
2373 call CheckDefExecFailure(["[1, 2->len()"], 'E697:', 2) | 2380 call CheckDefExecFailure(["[1, 2->len()"], 'E697:', 2) |
2374 call CheckDefExecFailure(["#{a: 1->len()"], 'E488:', 1) | 2381 call CheckDefExecFailure(["#{a: 1->len()"], 'E722:', 1) |
2375 call CheckDefExecFailure(["{'a': 1->len()"], 'E723:', 2) | 2382 call CheckDefExecFailure(["{'a': 1->len()"], 'E723:', 2) |
2376 endfunc | 2383 endfunc |
2377 | 2384 |
2378 let g:Funcrefs = [function('add')] | 2385 let g:Funcrefs = [function('add')] |
2379 | 2386 |