summaryrefslogtreecommitdiff
path: root/src/testdir/test_listdict.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-30 17:45:33 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-30 17:45:33 +0100
commit3e518a8ec74065aedd67d352c93d6ae6be550316 (patch)
tree239505fa04b1012bfccad56d6cc3f7f6517bfe78 /src/testdir/test_listdict.vim
parentf92cfb1acc3fef74eef0c83c1a35a2b6a9f93a9b (diff)
downloadvim-git-3e518a8ec74065aedd67d352c93d6ae6be550316.tar.gz
patch 9.0.0331: cannot use items() on a stringv9.0.0331
Problem: Cannot use items() on a string. Solution: Make items() work on a string. (closes #11016)
Diffstat (limited to 'src/testdir/test_listdict.vim')
-rw-r--r--src/testdir/test_listdict.vim11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index c87d701a3..89c4243bd 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -206,7 +206,16 @@ func Test_list_items()
endfor
call assert_equal([[0, 'a'], [1, 'b'], [2, 'c']], r)
- call assert_fails('call items(3)', 'E1227:')
+ call assert_fails('call items(3)', 'E1225:')
+endfunc
+
+func Test_string_items()
+ let r = []
+ let s = 'ábツ'
+ for [idx, val] in items(s)
+ call extend(r, [[idx, val]])
+ endfor
+ call assert_equal([[0, 'á'], [1, 'b'], [2, 'ツ']], r)
endfunc
" Test removing items in list