diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-14 18:40:19 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-14 18:40:19 +0100 |
commit | 0289a093a4d65c6280a3be118d1d3696d1aa74da (patch) | |
tree | f3ba35c77e5af05beeb3befbe64c0f13078029c5 /src/testdir/test_vim9_expr.vim | |
parent | 240309c9bfa8a0d2f154712f8e0dd33589f181d3 (diff) | |
download | vim-git-0289a093a4d65c6280a3be118d1d3696d1aa74da.tar.gz |
patch 8.2.2605: Vim9: string index and slice does not include composing charsv8.2.2605
Problem: Vim9: string index and slice does not include composing chars.
Solution: Include composing characters. (issue #6563)
Diffstat (limited to 'src/testdir/test_vim9_expr.vim')
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index a78cf1983..9829d8800 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -2367,6 +2367,35 @@ def Test_expr7_any_index_slice() assert_equal('abcd', g:teststring[: -3]) assert_equal('', g:teststring[: -9]) + # composing characters are included + g:teststring = 'àéû' + assert_equal('à', g:teststring[0]) + assert_equal('é', g:teststring[1]) + assert_equal('û', g:teststring[2]) + assert_equal('', g:teststring[3]) + assert_equal('', g:teststring[4]) + + assert_equal('û', g:teststring[-1]) + assert_equal('é', g:teststring[-2]) + assert_equal('à', g:teststring[-3]) + assert_equal('', g:teststring[-4]) + assert_equal('', g:teststring[-5]) + + assert_equal('à', g:teststring[0 : 0]) + assert_equal('é', g:teststring[1 : 1]) + assert_equal('àé', g:teststring[0 : 1]) + assert_equal('àéû', g:teststring[0 : -1]) + assert_equal('àé', g:teststring[0 : -2]) + assert_equal('à', g:teststring[0 : -3]) + assert_equal('', g:teststring[0 : -4]) + assert_equal('', g:teststring[0 : -5]) + assert_equal('àéû', g:teststring[ : ]) + assert_equal('àéû', g:teststring[0 : ]) + assert_equal('éû', g:teststring[1 : ]) + assert_equal('û', g:teststring[2 : ]) + assert_equal('', g:teststring[3 : ]) + assert_equal('', g:teststring[4 : ]) + # blob index cannot be out of range g:testblob = 0z01ab assert_equal(0x01, g:testblob[0]) |