1
0
forked from aniani/vim

patch 9.1.1245: need some more tests for curly braces evaluation

Problem:  need some more tests for curly braces evaluation
Solution: Add a test for the regression introduced by patch v9.1.1242
          (Yegappan Lakshmanan)

closes: #16986

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-03-27 17:31:31 +01:00
committed by Christian Brabandt
parent 35cb38d34b
commit d9b82cfe84
2 changed files with 22 additions and 0 deletions

View File

@@ -93,6 +93,26 @@ func Test_let()
let [l[0], l[1]] = [10, 20] let [l[0], l[1]] = [10, 20]
call assert_equal([10, 20, 3], l) call assert_equal([10, 20, 3], l)
" Test for using curly brace name in the LHS of an assignment
let listvar = [1, 2]
let s = 'listvar'
let {s} = [3, 4]
call assert_equal([3, 4], listvar)
" Test for using curly brace name as a list and as list index in the LHS of
" an assignment
let listvar = [1, 2]
let idx = 1
let s = 'listvar'
let {s}[0] = 10
let s = 'idx'
let listvar[{s}] = 20
call assert_equal([10, 20], listvar)
let s1 = 'listvar'
let s2 = 'idx'
let {s1}[{s2}] = 30
call assert_equal([10, 30], listvar)
" Test for errors in conditional expression " Test for errors in conditional expression
call assert_fails('let val = [] ? 1 : 2', 'E745:') call assert_fails('let val = [] ? 1 : 2', 'E745:')
call assert_fails('let val = 1 ? 5+ : 6', 'E121:') call assert_fails('let val = 1 ? 5+ : 6', 'E121:')

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1245,
/**/ /**/
1244, 1244,
/**/ /**/