diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-05-10 19:10:31 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-05-10 19:10:31 +0200 |
commit | 1cc2a94f80ba982f83d1e2d37c4726867e36bd9f (patch) | |
tree | 0a3e665fd7584d8f18f32000a020f9774eae2ca3 /src/testdir/test_vim9_cmd.vim | |
parent | 89483d40438830fb9e74a5ec6c92d2470b05e4c2 (diff) | |
download | vim-git-1cc2a94f80ba982f83d1e2d37c4726867e36bd9f.tar.gz |
patch 8.2.0730: Vim9: Assignment to dict member does not workv8.2.0730
Problem: Vim9: Assignment to dict member does not work.
Solution: Parse dict assignment. Implement getting dict member.
Diffstat (limited to 'src/testdir/test_vim9_cmd.vim')
-rw-r--r-- | src/testdir/test_vim9_cmd.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index 70437b901..12260c355 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -44,5 +44,27 @@ def Test_syn_include_wildcards() delete('Xthemine.vim') enddef +def Test_assign_list() + let l: list<string> = [] + l[0] = 'value' + assert_equal('value', l[0]) + + l[1] = 'asdf' + assert_equal('value', l[0]) + assert_equal('asdf', l[1]) + assert_equal('asdf', l[-1]) + assert_equal('value', l[-2]) +enddef + +def Test_assign_dict() + let d: dict<string> = {} + d['key'] = 'value' + assert_equal('value', d['key']) + + d[123] = 'qwerty' + assert_equal('qwerty', d[123]) + assert_equal('qwerty', d['123']) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |