diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-01-01 07:27:46 +0000 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-05 19:55:11 +0000 |
commit | 7002a3433bed7600ec02d64927ae0e77d077f34e (patch) | |
tree | ea9d586f0c4c56924991dd84d434880926bf1371 /src/nvim/testdir | |
parent | 92e92f02e7106fcad1597bb8f0edf1e43186a07f (diff) | |
download | rneovim-7002a3433bed7600ec02d64927ae0e77d077f34e.tar.gz rneovim-7002a3433bed7600ec02d64927ae0e77d077f34e.tar.bz2 rneovim-7002a3433bed7600ec02d64927ae0e77d077f34e.zip |
vim-patch:8.2.2658: :for cannot loop over a string
Problem: :for cannot loop over a string.
Solution: Accept a string argument and iterate over its characters.
https://github.com/vim/vim/commit/74e54fcb447e5db32f9c2df34c0554bbecdccca2
v8.2.2659 is already ported.
N/A patches for version.c:
vim-patch:8.2.2736: Vim9: for loop over string is a bit slow
Problem: Vim9: for loop over string is a bit slow.
Solution: Avoid using strlen().
https://github.com/vim/vim/commit/175a41c13f3e27e30c662f2f418c5a347dbc645d
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_vimscript.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index 34733f127f..c59cab5f36 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -1692,6 +1692,26 @@ func Test_function_defined_line() call delete('Xtest.vim') endfunc +func Test_for_over_string() + let res = '' + for c in 'aéc̀d' + let res ..= c .. '-' + endfor + call assert_equal('a-é-c̀-d-', res) + + let res = '' + for c in '' + let res ..= c .. '-' + endfor + call assert_equal('', res) + + let res = '' + for c in v:_null_string + let res ..= c .. '-' + endfor + call assert_equal('', res) +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |