Skip to content

Commit d9b82cf

Browse files
yegappanchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 35cb38d commit d9b82cf

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/testdir/test_let.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ func Test_let()
9393
let [l[0], l[1]] = [10, 20]
9494
call assert_equal([10, 20, 3], l)
9595

96+
" Test for using curly brace name in the LHS of an assignment
97+
let listvar = [1, 2]
98+
let s = 'listvar'
99+
let {s} = [3, 4]
100+
call assert_equal([3, 4], listvar)
101+
102+
" Test for using curly brace name as a list and as list index in the LHS of
103+
" an assignment
104+
let listvar = [1, 2]
105+
let idx = 1
106+
let s = 'listvar'
107+
let {s}[0] = 10
108+
let s = 'idx'
109+
let listvar[{s}] = 20
110+
call assert_equal([10, 20], listvar)
111+
let s1 = 'listvar'
112+
let s2 = 'idx'
113+
let {s1}[{s2}] = 30
114+
call assert_equal([10, 30], listvar)
115+
96116
" Test for errors in conditional expression
97117
call assert_fails('let val = [] ? 1 : 2', 'E745:')
98118
call assert_fails('let val = 1 ? 5+ : 6', 'E121:')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1245,
707709
/**/
708710
1244,
709711
/**/

0 commit comments

Comments
 (0)