diff options
| author | Michael Ennen <mike.ennen@gmail.com> | 2016-11-24 23:45:05 -0700 |
|---|---|---|
| committer | Michael Ennen <mike.ennen@gmail.com> | 2016-11-25 18:23:11 -0700 |
| commit | 8f84c1da83a2ef0912325f48b23637c706f3f2f0 (patch) | |
| tree | c6b1eda7b44aed43e466596795f90fa7b8fa8d22 /src/nvim/testdir | |
| parent | 5f0260808cf3712718555ee177476b8aefd78280 (diff) | |
| download | rneovim-8f84c1da83a2ef0912325f48b23637c706f3f2f0.tar.gz rneovim-8f84c1da83a2ef0912325f48b23637c706f3f2f0.tar.bz2 rneovim-8f84c1da83a2ef0912325f48b23637c706f3f2f0.zip | |
vim-patch:7.4.1707
Problem: Cannot use empty dictionary key, even though it can be useful.
Solution: Allow using an empty dictionary key.
https://github.com/vim/vim/commit/0921ecff1c5a74541bad6c073e8ade32247403d8
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_expr.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index 7ea4ebc7df..51d6a0931c 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -23,3 +23,17 @@ func Test_strcharpart() call assert_equal('a', strcharpart('axb', -1, 2)) endfunc + +func Test_dict() + let d = {'': 'empty', 'a': 'a', 0: 'zero'} + call assert_equal('empty', d['']) + call assert_equal('a', d['a']) + call assert_equal('zero', d[0]) + call assert_true(has_key(d, '')) + call assert_true(has_key(d, 'a')) + + let d[''] = 'none' + let d['a'] = 'aaa' + call assert_equal('none', d['']) + call assert_equal('aaa', d['a']) +endfunc |