patch 9.1.1245: need some more tests for curly braces evaluation
Commit:
https://github.com/vim/vim/commit/d9b82cfe846e988772f2eec40643d7009d61ffdf
Author: Yegappan Lakshmanan <[email protected]>
Date: Thu Mar 27 17:31:31 2025 +0100
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]>
diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim
index dffc5c695..a90b55cb4 100644
--- a/src/testdir/test_let.vim
+++ b/src/testdir/test_let.vim
@@ -93,6 +93,26 @@ func Test_let()
let [l[0], l[1]] = [10, 20]
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
call assert_fails('let val = [] ? 1 : 2', 'E745:')
call assert_fails('let val = 1 ? 5+ : 6', 'E121:')
diff --git a/src/version.c b/src/version.c
index 1e1d769d3..7e02ea5d2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1245,
/**/
1244,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1txqLr-001YpW-RJ%40256bit.org.