aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-04-15 07:11:39 +0800
committerGitHub <noreply@github.com>2024-04-15 07:11:39 +0800
commit43f8d7e3ef2db733f01f2d4c03214cd90c5a09be (patch)
tree002e8a305a2217ce1b6f7f7ab7fef548fcd6b8b7 /test/old/testdir
parent7180ef690180cf92d1d49811820c46dd60e4d1c6 (diff)
downloadrneovim-43f8d7e3ef2db733f01f2d4c03214cd90c5a09be.tar.gz
rneovim-43f8d7e3ef2db733f01f2d4c03214cd90c5a09be.tar.bz2
rneovim-43f8d7e3ef2db733f01f2d4c03214cd90c5a09be.zip
vim-patch:9.1.0329: String interpolation fails for Dict type (#28335)
Problem: String interpolation fails for Dict type Solution: Support Dict data type properly, also support :put =Dict (without having to convert it to string() first) (Yegappan Lakshmanan) fixes: vim/vim#14529 closes: vim/vim#14541 https://github.com/vim/vim/commit/f01493c55062c01b1cdf9b1e946577f4d1bdddf3 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test/old/testdir')
-rw-r--r--test/old/testdir/test_edit.vim4
-rw-r--r--test/old/testdir/test_expr.vim4
-rw-r--r--test/old/testdir/test_let.vim7
-rw-r--r--test/old/testdir/test_put.vim9
4 files changed, 22 insertions, 2 deletions
diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim
index abd30074d5..57ff63f26d 100644
--- a/test/old/testdir/test_edit.vim
+++ b/test/old/testdir/test_edit.vim
@@ -1983,8 +1983,8 @@ func Test_edit_ctrl_r_failed()
let buf = RunVimInTerminal('', #{rows: 6, cols: 60})
- " trying to insert a dictionary produces an error
- call term_sendkeys(buf, "i\<C-R>={}\<CR>")
+ " trying to insert a blob produces an error
+ call term_sendkeys(buf, "i\<C-R>=0z\<CR>")
" ending Insert mode should put the cursor back on the ':'
call term_sendkeys(buf, ":\<Esc>")
diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim
index d316e63818..82377aaf19 100644
--- a/test/old/testdir/test_expr.vim
+++ b/test/old/testdir/test_expr.vim
@@ -904,6 +904,10 @@ func Test_string_interp()
endif
call assert_equal(0, tmp)
+ #" Dict interpolation
+ VAR d = {'a': 10, 'b': [1, 2]}
+ call assert_equal("{'a': 10, 'b': [1, 2]}", $'{d}')
+
#" Stray closing brace.
call assert_fails('echo $"moo}"', 'E1278:')
#" Undefined variable in expansion.
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim
index bdf08c29bf..797cedcb07 100644
--- a/test/old/testdir/test_let.vim
+++ b/test/old/testdir/test_let.vim
@@ -687,6 +687,13 @@ END
END
call assert_equal(['let a = {abc}', 'let b = X', 'let c = {'], code)
+ " Evaluate a dictionary
+ let d1 = #{a: 10, b: 'ss', c: {}}
+ let code =<< eval trim END
+ let d2 = {d1}
+ END
+ call assert_equal(["let d2 = {'a': 10, 'b': 'ss', 'c': {}}"], code)
+
let code = 'xxx'
let code =<< eval trim END
let n = {5 +
diff --git a/test/old/testdir/test_put.vim b/test/old/testdir/test_put.vim
index b1cf268a58..e01984228d 100644
--- a/test/old/testdir/test_put.vim
+++ b/test/old/testdir/test_put.vim
@@ -323,4 +323,13 @@ func Test_put_visual_replace_fold_marker()
bwipe!
endfunc
+func Test_put_dict()
+ new
+ let d = #{a: #{b: 'abc'}, c: [1, 2], d: 0z10}
+ put! =d
+ call assert_equal(["{'a': {'b': 'abc'}, 'c': [1, 2], 'd': 0z10}", ''],
+ \ getline(1, '$'))
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab