vim-patch:9.1.0335: String interpolation fails for List type (#28364)

Problem:  String interpolation fails for List type
Solution: use implicit string(list) for string interpolation and :put =
          (Yegappan Lakshmanan)

related: vim/vim#14529
closes: vim/vim#14556

bce51d9005

Cherry-pick eval_to_string_eap() from patch 8.2.1914.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2024-04-16 10:18:24 +08:00
committed by GitHub
parent b1e8b799a5
commit e3c083832c
5 changed files with 71 additions and 10 deletions

View File

@@ -907,6 +907,18 @@ func Test_string_interp()
#" Dict interpolation
VAR d = {'a': 10, 'b': [1, 2]}
call assert_equal("{'a': 10, 'b': [1, 2]}", $'{d}')
VAR emptydict = {}
call assert_equal("a{}b", $'a{emptydict}b')
VAR nulldict = v:_null_dict
call assert_equal("a{}b", $'a{nulldict}b')
#" List interpolation
VAR l = ['a', 'b', 'c']
call assert_equal("['a', 'b', 'c']", $'{l}')
VAR emptylist = []
call assert_equal("a[]b", $'a{emptylist}b')
VAR nulllist = v:_null_list
call assert_equal("a[]b", $'a{nulllist}b')
#" Stray closing brace.
call assert_fails('echo $"moo}"', 'E1278:')